由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Random number generator in C++
相关主题
multiple random number generatorssl 怎样用RAND_and()来解决solaris上PRNG not seed
如何使用这个template?Application Security Engineer职业前景
问个关于随机数生成器的问题
相关话题的讨论汇总
话题: random话题: generator话题: number话题: c++话题: rand
进入Programming版参与讨论
1 (共1页)
v****c
发帖数: 32
1
Random number generator repeats itself
after exactly 2^24 calls, why?
Is there a way to change it?
Thanks in advance for your input.
I**********s
发帖数: 441
2
It's a pseudo-random number generator with a period.
Check a book on algorithm you'll find out.
To change it maybe you need to see the source code.
i***h
发帖数: 12655
3
如果在每个rand之前重新 srand(time())
可以么?
t****t
发帖数: 6806
4
then rand() is indeed a function of time(), which could be random, or could
be totally not random.
(pseudo) random generator is not a trivial topic. the quality of PRNG varies
a LOT. if your program need to use a lot of PRN (e.g. more than 2^16),
usually you have to pick a reasonable generator, instead of blindly using
the rand() comes with libc.

【在 i***h 的大作中提到】
: 如果在每个rand之前重新 srand(time())
: 可以么?

z*****a
发帖数: 3809
5
Just use a different random number generator, such as
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html

【在 v****c 的大作中提到】
: Random number generator repeats itself
: after exactly 2^24 calls, why?
: Is there a way to change it?
: Thanks in advance for your input.

1 (共1页)
进入Programming版参与讨论
相关主题
ssl 怎样用RAND_and()来解决solaris上PRNG not seed如何使用这个template?
Application Security Engineer职业前景问个关于随机数生成器的问题
multiple random number generator
相关话题的讨论汇总
话题: random话题: generator话题: number话题: c++话题: rand