Differences java.util.Random differ between JRE or platforms?

The method next java.util.Randomwhen I look at the source in Eclipse is essentially:

seed = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1);
return (int)(seed >>> (48 - bits));

How can I determine if different JDKs or JVMs will implement nextdifferently or with different constants?

I have already met different constructors with no arguments for strange behavior when sowing Java Random . I want to know if this can happen with a method next. Where can I find the source for different implementations?

+5
source share
2 answers

Javadoc for Random.next()explicitly indicates which algorithm is used to generate the next number.

, JVM , , JVM ', Sun/Oracle.


JDK?

, , , . , Sun/Oracle - Java- , 15 .

:

  • javadoc Java 1.3.1 Java 1.7 (*) ,

  • "Java",

  • ( ) Java (TM) , Oracle/Sun,

  • , ... .

, Java (TM) .

(* Java 1.1 javadocs , , .)

+5

, JDK JVM - ?

JVM , , .

, JDK , , next :

next Random

(seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1)

(int)(seed >>> (48 - bits)).

, . . . " ", 3: " ", 3.2.1.

... , , ,

next , int, bits 1 32 (), () , () 0 1.

... , , .

?

, , . , ...

+4

All Articles