2011年6月26日

c++ 伪随机数生成

摘要: #include <ctime>#include <cstdlib>using namespace std;static unsigned int g_seed = 0;void seedrand(int seed) { g_seed = seed;}int rand(int xmin,int xmax) { if(xmin>xmax) throw "Invalid arguments!"; if(g_seed==0) seedrand((unsigned)time(0)); g_seed = 214013 * g_seed + 2531011 阅读全文

posted @ 2011-06-26 15:53 大宝pku 阅读(384) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示