func BenchmarkCMWC32Next(b *testing.B) { b.StopTimer() c := core.MakeCMWC32(3278470471, 4) b.StartTimer() for i := 0; i < b.N; i++ { c.Next() } }
func CMWCSpec(c gospec.Context) { c.Specify("CMWC32 produces the same output as SlowCMWC.", func() { fast := core.MakeCMWC32(11, 4) slow := core.MakeSlowCMWC(11, 1<<32, 1<<4) N := 100000 for i := 0; i < N; i++ { f := fast.Next() s := slow.Next() c.Expect(f, Equals, s) if f != s { break } } }) }
// Creates a Cmwc RNG with a very long period func MakeGoodCmwc() *Cmwc { return &Cmwc{core.MakeCMWC32(3945340957, 5)} }
// Creates a Cmwc RNG with (A, B, R) = (a, 2^32, 1<<lb2_r) func MakeCmwc(a, lb2_r uint32) *Cmwc { return &Cmwc{core.MakeCMWC32(a, lb2_r)} }