Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: JRuby 1.7.0.RC1
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
this breaks certain test frameworks that assume calling srand will result in a specific repeatable sequence of random numbers.
it looks like there is a compatible random implementation in org.jruby.util.Random, but it is not being used.
$ /usr/bin/ruby -ve 'srand(1); p rand' ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] 0.417022004702574
$ ruby -ve 'srand(1); p rand' ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0] 0.417022004702574
$ ruby -ve 'srand(1); p rand' rubinius 1.2.4dev (1.8.7 d9624587 yyyy-mm-dd JI) [x86_64-apple-darwin10.6.0] 0.417022004702574
$ ruby -ve 'srand(1); p rand' jruby 1.6.0 (ruby-1.8.7-p330) (2011-04-05 2701790) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_24) [darwin-x86_64-java] 0.730878190703291
fyi, the test framework in question was machinist-1.0.6 https://github.com/notahat/machinist/blob/v1.0.6/lib/sham.rb#L64-77
this is kind of a ridiculous bug, so feel free to mark as WontFix.