This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function XorShift128Plus(seed: number) { | |
const state0 = { hi: seed ^ 0xAF410049, lo: seed ^ 0x1F9D38AF }; | |
const state1 = { hi: seed ^ 0xD19D592C, lo: seed ^ 0xBD21E214 }; | |
const s1 = { hi: 0, lo: 0 }; | |
const s0 = { hi: 0, lo: 0 }; | |
const t = { hi: 0, lo: 0 }; | |
function update() { | |
// s1 = state0; | |
s1.hi = state0.hi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code adapted from http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html | |
// Original copyright: | |
/* | |
A C-program for MT19937, with initialization improved 2002/1/26. | |
Coded by Takuji Nishimura and Makoto Matsumoto. | |
Before using, initialize the state by using init_genrand(seed) | |
or init_by_array(init_key, key_length). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.Reader; | |
import java.io.StringReader; | |
public class PhantomTypes { | |
abstract static class Data { | |
private Data() {} | |
} | |
static class Unvalidated extends Data { | |
private Unvalidated() {} |