Last active
October 4, 2015 11:18
-
-
Save karatedog/2627355 to your computer and use it in GitHub Desktop.
Logistic map enumerator in Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enumerator based Logistic map, can be used as a PRNG as well. | |
def logistic_map(x0, r) | |
return Enumerator.new do |yielder| | |
number = x0.to_f | |
r = r.to_f | |
loop do | |
yielder.yield(number) | |
number = r * number * (1 - number) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment