testlib icon indicating copy to clipboard operation
testlib copied to clipboard

Random generator rng.next() may produce identical first number on similar parameters

Open oier-namespace-std opened this issue 2 years ago • 0 comments

save the code as rngtest.cpp and compile & run with the following parameter:

#include"testlib.h"
int main(int argc,char*argv[])
{
	registerGen(argc,argv,1);
	printf("%d\n",rnd.next(0,15));
}

These parameters

rngtest abc 0
rngtest abc 1
...
rngtest abc 9

will all give output 8. And parameters

rngtest abc a
rngtest abc b
...
rngtest abc x

will all give output 10. image

oier-namespace-std avatar Nov 10 '22 01:11 oier-namespace-std