局部的无礼? [英] localized srandom?

查看:81
本文介绍了局部的无礼?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用std :: random_shuffle和srandom,想知道是否有可能将srandom()的作用限制在本地代码块中.

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.

谢谢

推荐答案

您要查找的例程是srandom_r(3)random_r(3):

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

这篇关于局部的无礼?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆