random-walk¶ ↑
This is an extremely simple gem for generating random-walk test data in an array. It’s useful for statistics or finance testing, where random data falls short for something like simple regression or the movement of stocks.
The resulting array will always stay within the range provided (inclusive). The random-walk adds +1, 0, or -1 on each iteration by default.
Usage¶ ↑
require 'random-walk' # RandomWalk.generate(range, array_length, step=1) RandomWalk.generate(10..40, 5) # [11, 12, 11, 10, 10] RandomWalk.generate(10..40, 5) # [27, 28, 29, 30, 29] RandomWalk.generate(10..40, 5, 2) # [34, 36, 36, 38, 36]
Contributing to random-walk¶ ↑
-
Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.
-
Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.
-
Fork the project.
-
Start a feature/bugfix branch.
-
Commit and push until you are happy with your contribution.
-
Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright¶ ↑
Copyright © 2013 Evan Tann. See LICENSE.txt for further details.