9 XS64Rand(WDL_UINT64 seed
) { st
=seed
; if (!st
) st
++; }
17 return (st
=x
) * WDL_UINT64_CONST(2685821657736338717);
20 void add_entropy(WDL_UINT64 value
) { st
+=value
; if (!st
) st
++; }
28 XS1024Rand(WDL_UINT64 seed
) : p(0)
30 memset(st
,0x80,sizeof(st
));
33 XS1024Rand(const void *buf
, int bufsz
) : p(0)
35 memset(st
,0x80,sizeof(st
));
36 add_entropy(buf
,bufsz
);
41 WDL_UINT64 s0
= st
[ p
], *wr
= st
+ (p
= (p
+1)&15), s1
= *wr
;
45 return ( *wr
= s0
^ s1
) * WDL_UINT64_CONST(1181783497276652981);
48 void add_entropy(WDL_UINT64 value
)
51 for (int x
=0;x
<16;x
++) st
[x
]+=r
.rand64();
53 void add_entropy(const void *buf
, int bufsz
)
55 unsigned char *wr
= (unsigned char *)st
;
56 if (bufsz
> (int) sizeof(st
)) bufsz
= (int) sizeof(st
);
59 const unsigned char *rd
= (const unsigned char *)buf
;
60 while (bufsz
-->0) *wr
++ += *rd
++;