Skip to content

make SecureRandom.rand public#5877

Merged
kares merged 1 commit intojruby:masterfrom
ahorek:randfix
Sep 16, 2019
Merged

make SecureRandom.rand public#5877
kares merged 1 commit intojruby:masterfrom
ahorek:randfix

Conversation

@ahorek
Copy link
Contributor

@ahorek ahorek commented Sep 15, 2019

similar problem as #5773

in mri https://github.com/ruby/ruby/blob/master/random.c#L1568

require 'securerandom'
SecureRandom.rand
Traceback (most recent call last):
        6: from /home/ahorek/.rvm/rubies/jruby-head/bin/irb:13:in `<main>'
        5: from org/jruby/RubyKernel.java:1199:in `catch'
        4: from org/jruby/RubyKernel.java:1199:in `catch'
        3: from org/jruby/RubyKernel.java:1430:in `loop'
        2: from org/jruby/RubyKernel.java:1067:in `eval'
        1: from (irb):4:in `evaluate'
NoMethodError (private method `rand' called for SecureRandom:Module)

[1,2,3].shuffle(random: SecureRandom)
Traceback (most recent call last):
        8: from /home/ahorek/.rvm/rubies/jruby-head/bin/irb:13:in `<main>'
        7: from org/jruby/RubyKernel.java:1199:in `catch'
        6: from org/jruby/RubyKernel.java:1199:in `catch'
        5: from org/jruby/RubyKernel.java:1430:in `loop'
        4: from org/jruby/RubyKernel.java:1067:in `eval'
        3: from (irb):9:in `evaluate'
        2: from org/jruby/RubyArray.java:4289:in `shuffle'
        1: from org/jruby/RubyArray.java:4267:in `shuffle!'
NoMethodError (private method `rand' called for SecureRandom:Module)

@kares
Copy link
Member

kares commented Sep 15, 2019

seems like its not an alias in MRI but rather the impl has 2 names, kind of like:
@JRubyMethod(name: {"random_number", "rand"}) ... does it matter though?

@kares kares added this to the JRuby 9.2.9.0 milestone Sep 15, 2019
@ahorek
Copy link
Contributor Author

ahorek commented Sep 15, 2019

thanks, fixed

@kares kares merged commit 3342850 into jruby:master Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants