开发者

localized srandom?

开发者 https://www.devze.com 2023-02-12 12:03 出处:网络
I\'m using std::random_shuffle and srandom, and wonder if it\'s possible to constrain srandom()\'s eff开发者_如何转开发ect to local block of code.

I'm using std::random_shuffle and srandom, and wonder if it's possible to constrain srandom()'s eff开发者_如何转开发ect to local block of code.

To be more precise, For a server application, I need to have different random seeds for different clients and keep using this pre-determined seed for random number generation per clients.

Thank you


The routines you are looking for are srandom_r(3) and random_r(3):

http://www.kernel.org/doc/man-pages/online/pages/man3/random_r.3.html

0

精彩评论

暂无评论...
验证码 换一张
取 消