How to generate 64 bit random numbers?

后端 未结 2 1349
执念已碎
执念已碎 2020-12-16 01:59

I\'m implementing universal hashing and using the following universal hash function :

h(k)=((A*k)mod 2^64) rsh 64-r

where A is a

2条回答
  •  抹茶落季
    2020-12-16 02:30

    ((long long)rand() << 32) | rand()
    

    EDIT: that's assuming that rand() produces 32 random bits, which it might not.

提交回复
热议问题