Skip to content

With jruby SecureRandom.random_number is always 0 #448

@duritong

Description

@duritong

Ensure the following before filing this issue

  • I verified it reproduces with the latest version with - uses: ruby/setup-ruby@v1 (see Versioning policy)

  • I tried to reproduce the issue locally by following the workflow steps (including all commands done by ruby/setup-ruby, except for Downloading Ruby & Extracting Ruby),
    and it did not reproduce locally (if it does reproduce locally, it's not a ruby/setup-ruby issue)

Are you running on a GitHub-hosted runner or a self-hosted runner?

GitHub-hosted runner

The workflow code or a link to the workflow file

https://github.com/duritong/ruby-actions-test/blob/main/.github/workflows/ruby.yml

Link to the log of a failed workflow job, or to a gist with the output

https://github.com/duritong/ruby-actions-test/actions/runs/3859056296/jobs/6578227554#step:4:106

The command and output of the failing step

The following script returns always 0 as a random number:

https://github.com/duritong/ruby-actions-test/blob/main/test.rb

So essentially I am showing that for many invocations SecureRandom.random_number on jRuby always returns 0.

If you run that script locally with jRuby this is not the case.

Any other notes?

This also affects tests in other projects: https://github.com/duritong/trocla/actions/runs/3859059179/jobs/6578233962

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions