testlib
testlib copied to clipboard
rnd.next((long long)1e18) produces close numbers for close seeds
First random 64bit number always similar for similar seeds
example program
long long base = 1e9;
for(int k=0;k<50;++k) {
rnd.setSeed(base+k);
long long r = rnd.next((long long)1e18);
cout<<r<<" "<<k<<endl;
}
output
738860990118730818 0
738034746940647394 1
740513472179930370 2
739687229001846946 3
735556021701364418 4
734729782818248290 5
737208503762563970 6
736382264879447842 7
732251053283998018 8
731424814400881890 9
733903535345197570 10
733077296462081442 11
728946089161598913 12
728119841688548193 13
730598566927831169 14
729772328044715041 15
752080859493229123 16
751254620610112994 17
753733345849395971 18
752907106966279843 19
748775891075862722 20
747949652192746594 21
750428377432029570 22
749602134253946146 23
745470926953463618 24
744644683775380194 25
747123409014663170 26
746297165836579746 27
742165958536097218 28
741339715358013794 29
743818444892264066 30
742992197419213346 31
712421247074766913 32
711595003896683489 33
714073729135966465 34
713247490252850337 35
709116278657400512 36
708290035479317088 37
710768765013567360 38
709942521835483936 39
705811310240034112 40
704985067061950688 41
707463796596200960 42
706637549123150240 43
702506341822667712 44
701680102939551584 45
704158828178834560 46
703332585000751136 47
725641120744232513 48
724814873271181793 49
This can be produced not intentional in polygon with simple generator
#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(int argc, char* argv[]){
registerGen(argc, argv, 1);
ll r = rnd.next(1LL, ll(1e18));
cout<<r<<endl;
return 0;
}
and any test script with arguments different in last symbol (this makes seeds different by 1)
<#list 10..49 as k>
gen ${k} > $
</#list>
<#list ['a','b','c','d','e','f','g','h','i'] as k>
gen ajsd nkajsbdk jas ${k} > $
</#list>
gen 15 this > $
gen 15 random > $
gen 15 tokens > $
gen 15 matters > $
gen 10 > $
... gen 19 > $
will generate close to each other numbers, next 10 tests will be close to each other and so on.