Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make SecureRandom.rand public #5877

Merged
merged 1 commit into from Sep 16, 2019
Merged

make SecureRandom.rand public #5877

merged 1 commit into from Sep 16, 2019

Conversation

@ahorek
Copy link
Contributor

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

This comment has been minimized.

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
pavel
@ahorek ahorek force-pushed the ahorek:randfix branch from 7b85c7f to a982d2c Sep 15, 2019
@ahorek

This comment has been minimized.

Copy link
Contributor Author

ahorek commented Sep 15, 2019

thanks, fixed

@kares kares merged commit 3342850 into jruby:master Sep 16, 2019
5 checks passed
5 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jruby.jruby Build #20190915.7 succeeded
Details
jruby.jruby (Job linux) Job linux succeeded
Details
jruby.jruby (Job mac) Job mac succeeded
Details
jruby.jruby (Job windows) Job windows succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.