随机数之 xorShift128Plus 板子

ull k1, k2;
const int threshold = 10000000; 
ull xorShift128Plus() {
	ull k3 = k1, k4 = k2;
	k1 = k4;
	k3 ^= (k3 << 23);
	k2 = k3 ^ k4 ^ (k3 >> 17) ^ (k4 >> 26);
	return k2 + k4;
}
void gen(ull _k1, ull _k2) {
	k1 = _k1, k2 = _k2;
        int x = xorShift128Plus() % threshold + 1;
      // do sth
}
posted @ 2020-10-27 21:52  deaf  阅读(798)  评论(0编辑  收藏  举报