-
-
Notifications
You must be signed in to change notification settings - Fork 334
Closed
Description
Random::srand seems to be not implemented, instead it fails silently.
I find this problematic because it creates inconsistent results with other Ruby implementations. I have tried this code sample in both MRI and JRuby and received the same results.
On a side note, the methods of Random can only be accessed as Object::method in Opal and not as Random::method.
srand 123
a = [rand(100), rand(100), rand(100)]
srand 123
b = [rand(100), rand(100), rand(100)]
puts "#{a} == #{b}: #{a==b}"
#Expected: [66, 92, 98] == [66, 92, 98]: trueP.S.:
I know that JavaScript's own pseudorandom number generator doesn't support seeding. Would there be any other way to fix this?