Package jline.opt.solver.de
Class MT19937
java.lang.Object
jline.opt.solver.de.MT19937
Bit-exact reimplementation of numpy's legacy MT19937 core, matching the
generator underlying
numpy.random.RandomState.
This reproduces the exact 32-bit output stream numpy produces so that
NumpyRandomState and the differential-evolution optimizer generate
identical draws to the native-Python line-opt implementation for a given
seed. Seeding follows numpy's _legacy_seeding: a scalar seed that
fits in 32 bits uses init_genrand; otherwise the seed words are fed
to init_by_array.
Java 8 compatible. Unsigned 32-bit words are held as int; callers
that need the unsigned value use & 0xFFFFFFFFL.
-
Constructor Summary
ConstructorsConstructorDescriptionMT19937(long seed) Seed with a single non-negative integer, matching RandomState(int). -
Method Summary
Modifier and TypeMethodDescriptionintgetPos()Current position into the 624-word key (numpy get_state pos).int[]Copy of the internal 624-word key (for state validation/tests).voidinitByArray(long[] initKey) numpy/Matsumoto init_by_array (used for seeds > 32 bits).voidinitGenrand(long s) numpy/Matsumoto init_genrand.longDraw the next tempered 32-bit word as an unsigned value in [0, 2^32).voidseed(long seed) Seed matching numpy legacy behavior for a scalar integer seed.
-
Constructor Details
-
MT19937
public MT19937(long seed) Seed with a single non-negative integer, matching RandomState(int).
-
-
Method Details
-
seed
public void seed(long seed) Seed matching numpy legacy behavior for a scalar integer seed. -
initGenrand
public void initGenrand(long s) numpy/Matsumoto init_genrand. -
initByArray
public void initByArray(long[] initKey) numpy/Matsumoto init_by_array (used for seeds > 32 bits). -
nextUint32
public long nextUint32()Draw the next tempered 32-bit word as an unsigned value in [0, 2^32). -
getStateKey
public int[] getStateKey()Copy of the internal 624-word key (for state validation/tests). -
getPos
public int getPos()Current position into the 624-word key (numpy get_state pos).
-