localized srandom?

痴心易碎 提交于 2019-12-11 17:57:57

问题


I'm using std::random_shuffle and srandom, and wonder if it's possible to constrain srandom()'s effect 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


回答1:


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



来源:https://stackoverflow.com/questions/5062474/localized-srandom

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!