stdNextx=match x with
| { s1 := s1, s2 := s2 } =>
let s1 := Int.ofNats1;
let s2 := Int.ofNats2;
let k := s1/53668;
let s1' := 40014* (s1-k*53668)-k*12211;
let s1'' := if s1'<0 then s1'+2147483563 else s1';
let k' := s2/52774;
let s2' := 40692* (s2-k'*52774)-k'*3791;
let s2'' := if s2'<0 then s2'+2147483399 else s2';
let z := s1''-s2'';
let z' := if z<1 then z+2147483562 else z%2147483562;
(Int.toNatz', { s1 := Int.toNats1'', s2 := Int.toNats2'' })
randNatglohi=let lo' := if lo>hi then hi else lo;
let hi' := if lo>hi then lo else hi;
let x := RandomGen.rangeg;
match x with
| (genLo, genHi) =>
let genMag := genHi-genLo+1;
let q := 1000;
let k := hi'-lo'+1;
let tgtMag := k*q;
let x := randNatAuxgenLogenMagtgtMag(0, g);
match x with
| (v, g') =>
let v' := lo'+v%k;
(v', g')