Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 std::random_shuffle 和 srandom,想知道是否可以将 srandom() 的效果限制在本地代码块中。
更准确地说,对于服务器应用程序,我需要为不同的客户端提供不同的随机种子,并继续使用这个预先确定的种子为每个客户端生成随机数。
谢谢
您正在寻找的例程是srandom_r(3)和random_r(3):
srandom_r(3)
random_r(3)
http://www.kernel.org/doc/man-pages/online/pages/man3/random_r.3.html