Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ bash ./build/entropy/runtests.sh
- aesctr and aesdragontamer are random number generators based on the AES cipher (contributed by Samuel Neves).
- wyhash64 is wyhash hashing function adapted as a random number generator.
- wyrand and w1rand are random number generators based on the MUM hashing function, with w1rand being a slight modification.
- sirius64 is a 64-bit state, 64-bit output generator by Matteo Zapparoli: a golden-ratio Weyl sequence (as in splitmix64) with a multiply-xorshift-rotate output function. See [issue 30](https://github.com/lemire/testingRNG/issues/30).
- jenkinssmall is Bob Jenkins' small PRNG.
- CG64, CG128, and CG128_64 are counter-based generators producing 64-bit, 128-bit, and 128-bit outputs respectively.

Expand Down Expand Up @@ -453,6 +454,7 @@ Results will depend on your specific hardware and might be quite different on AR
| wyhash64 | :+1: | :+1: | 0.82 | 4.28 |
| wyrand | :+1: | :+1: | 0.83 | 4.22 |
| w1rand | | | 0.83 | 4.19 |
| sirius64 | :+1: | :+1: | | |
| aesdragontamer | :+1: | :+1: | 0.88 | 3.97 |
| lehmer64 | :+1: | :+1: | 1.13 | 3.10 |
| xorshift1024plus | fails! | fails! | 1.13 | 3.10 |
Expand Down
1 change: 1 addition & 0 deletions entropy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ set(ENTROPY_TESTS
testxorshift-k4
testxorshift-k5
testw1rand
testsirius64
)

# AES-based tests only on x86
Expand Down
1 change: 1 addition & 0 deletions practrand/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ set(PRACTRAND_TESTS
testwyhash
testwyrand
testw1rand
testsirius64
)

# AES-based tests only on x86
Expand Down
48 changes: 48 additions & 0 deletions practrand/results/testsirius64-H.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
RNG_test using PractRand version 0.93
RNG = RNG_stdin64, seed = 0xa0315ad7
test set = normal, folding = standard (64 bit)

rng=RNG_stdin64, seed=0xa0315ad7
length= 1 gigabyte (2^30 bytes), time= 3.6 seconds
no anomalies in 180 test result(s)

rng=RNG_stdin64, seed=0xa0315ad7
length= 2 gigabytes (2^31 bytes), time= 7.3 seconds
no anomalies in 191 test result(s)

rng=RNG_stdin64, seed=0xa0315ad7
length= 4 gigabytes (2^32 bytes), time= 14.4 seconds
no anomalies in 201 test result(s)

rng=RNG_stdin64, seed=0xa0315ad7
length= 8 gigabytes (2^33 bytes), time= 29.0 seconds
Test Name Raw Processed Evaluation
[Low1/64]BCFN(2+1,13-3,T) R= -6.9 p =1-8.6e-4 unusual
...and 211 test result(s) without anomalies

rng=RNG_stdin64, seed=0xa0315ad7
length= 16 gigabytes (2^34 bytes), time= 58.3 seconds
no anomalies in 223 test result(s)

rng=RNG_stdin64, seed=0xa0315ad7
length= 32 gigabytes (2^35 bytes), time= 116 seconds
Test Name Raw Processed Evaluation
[Low16/64]DC6-9x1Bytes-1 R= -4.9 p =1-3.7e-3 unusual
...and 232 test result(s) without anomalies

rng=RNG_stdin64, seed=0xa0315ad7
length= 64 gigabytes (2^36 bytes), time= 237 seconds
no anomalies in 244 test result(s)

rng=RNG_stdin64, seed=0xa0315ad7
length= 128 gigabytes (2^37 bytes), time= 476 seconds
no anomalies in 255 test result(s)

rng=RNG_stdin64, seed=0xa0315ad7
length= 256 gigabytes (2^38 bytes), time= 937 seconds
no anomalies in 265 test result(s)

rng=RNG_stdin64, seed=0xa0315ad7
length= 512 gigabytes (2^39 bytes), time= 1878 seconds
no anomalies in 276 test result(s)

50 changes: 50 additions & 0 deletions practrand/results/testsirius64.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
RNG_test using PractRand version 0.93
RNG = RNG_stdin64, seed = 0xc7faaf7
test set = normal, folding = standard (64 bit)

rng=RNG_stdin64, seed=0xc7faaf7
length= 1 gigabyte (2^30 bytes), time= 3.6 seconds
no anomalies in 180 test result(s)

rng=RNG_stdin64, seed=0xc7faaf7
length= 2 gigabytes (2^31 bytes), time= 7.3 seconds
Test Name Raw Processed Evaluation
BCFN(2+2,13-1,T) R= -7.5 p =1-6.5e-4 unusual
...and 190 test result(s) without anomalies

rng=RNG_stdin64, seed=0xc7faaf7
length= 4 gigabytes (2^32 bytes), time= 14.5 seconds
Test Name Raw Processed Evaluation
[Low1/64]BCFN(2+0,13-3,T) R= -7.5 p =1-3.4e-4 unusual
...and 200 test result(s) without anomalies

rng=RNG_stdin64, seed=0xc7faaf7
length= 8 gigabytes (2^33 bytes), time= 29.1 seconds
no anomalies in 212 test result(s)

rng=RNG_stdin64, seed=0xc7faaf7
length= 16 gigabytes (2^34 bytes), time= 58.5 seconds
no anomalies in 223 test result(s)

rng=RNG_stdin64, seed=0xc7faaf7
length= 32 gigabytes (2^35 bytes), time= 116 seconds
Test Name Raw Processed Evaluation
[Low4/64]BCFN(2+0,13-0,T) R= +7.9 p = 9.3e-4 unusual
...and 232 test result(s) without anomalies

rng=RNG_stdin64, seed=0xc7faaf7
length= 64 gigabytes (2^36 bytes), time= 237 seconds
no anomalies in 244 test result(s)

rng=RNG_stdin64, seed=0xc7faaf7
length= 128 gigabytes (2^37 bytes), time= 476 seconds
no anomalies in 255 test result(s)

rng=RNG_stdin64, seed=0xc7faaf7
length= 256 gigabytes (2^38 bytes), time= 937 seconds
no anomalies in 265 test result(s)

rng=RNG_stdin64, seed=0xc7faaf7
length= 512 gigabytes (2^39 bytes), time= 1878 seconds
no anomalies in 276 test result(s)

2 changes: 1 addition & 1 deletion practrand/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ NC='\033[0m' # No Color
echo "Testing "$MEM " of data per run"
echo "Note: running the tests longer could expose new failures."

declare -a commands=('testmitchellmoore' 'testmersennetwister' 'testxorshift-k4' 'testxorshift-k5' 'testwidynski' 'testaesctr' 'testaesdragontamer' 'testv8xorshift128plus -H' 'testv8xorshift128plus' 'testxorshift128plus -H' 'testxorshift128plus' 'testxoroshiro128plus -H' 'testxoroshiro128plus' 'testpcg32' 'testpcg64 -H' 'testpcg64' 'testsplitmix64 -H' 'testsplitmix64' 'testxorshift32' 'testxorshift1024star' 'testxorshift1024star -H' 'testxorshift1024plus' 'testxorshift1024plus -H' 'testwyhash' 'testwyhash -H' 'testwyrand' 'testwyrand -H' 'testw1rand' 'testw1rand -H');
declare -a commands=('testmitchellmoore' 'testmersennetwister' 'testxorshift-k4' 'testxorshift-k5' 'testwidynski' 'testaesctr' 'testaesdragontamer' 'testv8xorshift128plus -H' 'testv8xorshift128plus' 'testxorshift128plus -H' 'testxorshift128plus' 'testxoroshiro128plus -H' 'testxoroshiro128plus' 'testpcg32' 'testpcg64 -H' 'testpcg64' 'testsplitmix64 -H' 'testsplitmix64' 'testxorshift32' 'testxorshift1024star' 'testxorshift1024star -H' 'testxorshift1024plus' 'testxorshift1024plus -H' 'testwyhash' 'testwyhash -H' 'testwyrand' 'testwyrand -H' 'testw1rand' 'testw1rand -H' 'testsirius64' 'testsirius64 -H');
for t in "${commands[@]}"; do
exe=$(echo $t | awk '{print $1}')
if [ ! -x "./$exe" ]; then
Expand Down
37 changes: 37 additions & 0 deletions practrand/src/testsirius64.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <getopt.h>

#include "sirius64.h"

#define buffer_size 512
int main(int argc, char **argv) {
int c;
int castingtohigh32 = 0;
while ((c = getopt(argc, argv, "H")) != -1)
switch (c) {
case 'H':
castingtohigh32 = 1;
break;
default:
abort();
}
uint64_t seedvalue = 12345678;
sirius64_seed(seedvalue);
if (castingtohigh32) {
uint32_t buffer[buffer_size];
while (1) {
for (int k = 0; k < buffer_size; k++)
buffer[k] = (sirius64() >> 32);
fwrite((void *)buffer, sizeof(buffer), 1, stdout);
}
} else {
uint32_t buffer[buffer_size];
while (1) {
for (int k = 0; k < buffer_size; k++)
buffer[k] = sirius64();
fwrite((void *)buffer, sizeof(buffer), 1, stdout);
}
}
}
33 changes: 33 additions & 0 deletions source/sirius64.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef SIRIUS64_H
#define SIRIUS64_H

// Sirius64: a 64-bit state, 64-bit output PRNG by Matteo Zapparoli.
// Adapted to this project from https://github.com/matteo65/Sirius64
// (Apache-2.0). See also https://github.com/lemire/testingRNG/issues/30
//
// The state is a Weyl sequence with the golden-ratio increment (as in
// splitmix64); the output function is a multiply-xorshift-rotate mix of the
// state that is not a bijection (it passes 64-bit collision tests).
#include <stdint.h>

#define SIRIUS64_GAMMA UINT64_C(0x9e3779b97f4a7c15)

uint64_t sirius64_x; /* The state can be seeded with any value. */

// call sirius64_seed before calling sirius64
static inline void sirius64_seed(uint64_t seed) { sirius64_x = seed; }

static inline uint64_t sirius64_stateless(uint64_t *s) {
uint64_t z = (*s += SIRIUS64_GAMMA);
z = SIRIUS64_GAMMA * (z ^ (z >> 17));
z = (z << 32) | (z >> 32);
return SIRIUS64_GAMMA * ((*s) ^ z ^ (z >> 17));
}

// returns random number, modifies sirius64_x
static inline uint64_t sirius64(void) { return sirius64_stateless(&sirius64_x); }

// returns the 32 least significant bits of a call to sirius64
static inline uint32_t sirius64_cast32(void) { return (uint32_t)sirius64(); }

#endif // SIRIUS64_H
2 changes: 2 additions & 0 deletions speed/src/rng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "wyhash.h"
#include "wyrand.h"
#include "w1rand.h"
#include "sirius64.h"
#include "trivium32.h"
#include "trivium64.h"
#include "CG128.h"
Expand Down Expand Up @@ -77,6 +78,7 @@ gen64_entry generators64[] = {
{wyhash64, "wyhash64"},
{wyrand, "wyrand"},
{w1rand, "w1rand"},
{sirius64, "sirius64"},
{jenkinssmall, "jenkinssmall"},
{CG64, "CG64"},
};
Expand Down
1 change: 1 addition & 0 deletions testu01/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ set(TESTU01_TESTS
testwyhash
testwyrand
testw1rand
testsirius64
)

# AES-based tests only on x86
Expand Down
Loading
Loading