Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e4876d0a250c
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 990e2271a90f
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Jul 17, 2017

  1. Copy the full SHA
    accb13d View commit details
  2. Copy the full SHA
    990e227 View commit details
Showing with 6 additions and 5 deletions.
  1. +6 −5 core/src/main/java/org/jruby/RubyRandom.java
11 changes: 6 additions & 5 deletions core/src/main/java/org/jruby/RubyRandom.java
Original file line number Diff line number Diff line change
@@ -56,10 +56,10 @@ public static final class RandomType {
// c: rand_init
RandomType(IRubyObject seed) {
this.seed = seed.convertToInteger();
if (seed instanceof RubyFixnum) {
this.impl = randomFromFixnum((RubyFixnum) seed);
} else if (seed instanceof RubyBignum) {
this.impl = randomFromBignum((RubyBignum) seed);
if (this.seed instanceof RubyFixnum) {
this.impl = randomFromFixnum((RubyFixnum) this.seed);
} else if (this.seed instanceof RubyBignum) {
this.impl = randomFromBignum((RubyBignum) this.seed);
} else {
throw seed.getRuntime().newTypeError(
String.format("failed to convert %s into Integer", seed.getMetaClass().getName()));
@@ -220,7 +220,7 @@ public static RubyBignum randomSeed(Ruby runtime) {
return RubyBignum.newBignum(runtime, randomSeedBigInteger(runtime.random));
}

@SuppressWarnings("deprecated")
@SuppressWarnings("deprecation")
public static RubyClass createRandomClass(Ruby runtime) {
RubyClass randomClass = runtime
.defineClass("Random", runtime.getObject(), RANDOM_ALLOCATOR);
@@ -603,6 +603,7 @@ public static IRubyObject srandCommon(ThreadContext context, IRubyObject recv) {
}

// c: rb_f_srand
@SuppressWarnings("deprecation")
public static IRubyObject srandCommon(ThreadContext context, IRubyObject recv, IRubyObject newSeed) {
RandomType defaultRand = getDefaultRand(context);
IRubyObject previousSeed = defaultRand.getSeed();