Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: JRuby 1.7.0.RC1
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      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
      

        Activity

        Hide
        Aman Gupta added a comment -

        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.

        Show
        Aman Gupta added a comment - 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.
        Hide
        David Calavera added a comment -

        There is a branch with a compatible version of Random here:

        https://github.com/jruby/jruby/tree/MersenneTwister

        but I think nobody merged it yet

        Show
        David Calavera added a comment - There is a branch with a compatible version of Random here: https://github.com/jruby/jruby/tree/MersenneTwister but I think nobody merged it yet
        Hide
        David Calavera added a comment -

        At first glance it seems the MersenneTwister branch matches the other implementations:

        [22:12:11][jruby-1.6.0][~/dev/jruby (MersenneTwister)]
        $ bin/jruby -ve 'srand(1); p rand'
        jruby 1.6.0.RC1 (ruby 1.8.7 patchlevel 330) (2011-04-06 fd957a1) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_24) [darwin-x86_64-java]
        0.417022004702574
        
        Show
        David Calavera added a comment - At first glance it seems the MersenneTwister branch matches the other implementations: [22:12:11][jruby-1.6.0][~/dev/jruby (MersenneTwister)] $ bin/jruby -ve 'srand(1); p rand' jruby 1.6.0.RC1 (ruby 1.8.7 patchlevel 330) (2011-04-06 fd957a1) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_24) [darwin-x86_64-java] 0.417022004702574
        Hide
        Aman Gupta added a comment -

        Yep, it appears some of the commits already exist on master but not all of them. +1 for merging that fork.

        Show
        Aman Gupta added a comment - Yep, it appears some of the commits already exist on master but not all of them. +1 for merging that fork.
        Hide
        Hiroshi Nakamura added a comment -

        Sorry for not working actively these days. Related issue is at: JRUBY-5335

        We talked that we'll merge it to master after releasing 1.6.0 for 1.7. At present, we don't have jruby_1_6 branch so merging it to master means that we'll push it for 1.6.1.

        IIRC, Tom said that we should wait to create jruby_1_6 branch for a while, for concentrating 1.6.1 development. Guys, do you think it's time to create the branch for 1.6 series?

        Show
        Hiroshi Nakamura added a comment - Sorry for not working actively these days. Related issue is at: JRUBY-5335 We talked that we'll merge it to master after releasing 1.6.0 for 1.7. At present, we don't have jruby_1_6 branch so merging it to master means that we'll push it for 1.6.1. IIRC, Tom said that we should wait to create jruby_1_6 branch for a while, for concentrating 1.6.1 development. Guys, do you think it's time to create the branch for 1.6 series?
        Hide
        Thomas E Enebo added a comment -

        I think this desire to keep development for 1.6.x is not well-enough received. Unless someone objects I will cut a 1.6 branch tomorrow when we put out 1.6.1. This means lots of cherry-picking for us though.

        Show
        Thomas E Enebo added a comment - I think this desire to keep development for 1.6.x is not well-enough received. Unless someone objects I will cut a 1.6 branch tomorrow when we put out 1.6.1. This means lots of cherry-picking for us though.
        Hide
        Charles Oliver Nutter added a comment -

        Mersenne twister will be in 1.7. Marking as such.

        Show
        Charles Oliver Nutter added a comment - Mersenne twister will be in 1.7. Marking as such.
        Hide
        Hiro Asari added a comment -

        This can be marked Resolved, right?

        Show
        Hiro Asari added a comment - This can be marked Resolved, right?
        Hide
        Charles Oliver Nutter added a comment -

        I forget when exactly we got the fix in, but it's in. Marking for RC1.

        Show
        Charles Oliver Nutter added a comment - I forget when exactly we got the fix in, but it's in. Marking for RC1.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Aman Gupta
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: