mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
* Added Xorshiro128++ random number generator. * Fixes to xorshiro implementation + tests. --------- Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
15 lines
386 B
Plaintext
15 lines
386 B
Plaintext
module xorshiro_test;
|
|
import std::math;
|
|
|
|
fn void test_vectors_xorshiro() @test
|
|
{
|
|
Xorshiro128PPRandom a = { { 0x1, 0x2, 0x3, 0x4 } };
|
|
test::eq(0x281, a.next_int());
|
|
test::eq(0x180387, a.next_int());
|
|
test::eq(0xc0183387, a.next_int());
|
|
|
|
a = { { ~0x1, ~0x2, ~0x3, ~0x4 } };
|
|
test::eq(0xfffffcfd, a.next_int());
|
|
test::eq(0x17fbf8, a.next_int());
|
|
test::eq(0x40183386, a.next_int());
|
|
} |