随机播种 [英] Random Seeding

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

问题描述

如果你只为随机数发生器使用32位种子,

这意味着你只能产生最大值

2 ^ 32(约4十亿)不同的序列?


Mersenne Twister怎么样呢?它的周期很长

of 2 ^ 19937-1。如果你只使用32位种子,你是否只能获得这个数字环的一小部分?

这组序列是否仅限于

期间的开始,即你的序列必须从某个地方开始

之间的指数1到40亿(忽略

之后所有可能的数据)?.


或者我误解了种子的概念?


(我正在使用来自...的原始c代码 http://www.math.sci.hiroshima-u.ac.j...at/MT/emt.html )

If you only use a 32 bit seed for a random number generator,
does that mean you can only ever produce a maximum of
2^32 (approx 4 billion) different sequences?

What about the Mersenne Twister, with it''s massive period
of 2^19937-1. Will you only ever have access to a tiny
portion of this ring of numbers, if you only use a 32-bit seed?
Will this set of sequences be confined to the beginning of the
period, ie, your sequence will have to start at some place
between index number 1 and 4 billion of the period (ignores
all the possible data after this)?.

Or have I misunderstood the concept of a seed?

(I am using the original c code from...
http://www.math.sci.hiroshima-u.ac.j...at/MT/emt.html)

推荐答案

我建​​议你可能得到2 ^ 32个序列,其中2 ^ 19937-1



元素每个。

I would suggest that your possibly get 2^32 sequences with 2^19937-1
number
of elements in each.


> (在此之后忽略所有可能的数据)?


这应该是:


(忽略所有可能的起点)在此之后)?
> (ignores all the possible data after this)?.

this should have read:

(ignores all the possible "starting points" after this)?.
我建议您可能获得2 ^ 32个序列,每个序列中包含2 ^ 19937-1
元素。
I would suggest that your possibly get 2^32 sequences with 2^19937-1
number of elements in each.




这就是我的想法。这看起来相当有限。

然而,我刚刚意识到Mersenne Twister c代码

由它的发明者提供更长的种子。

"那些需要初始种子超过32位

长度的人可以使用init_by_array()进行初始化,

允许任意长度的数组为种子


我想你可以使用随时间播种的阵列,

进程ID,以及来自
$ b $的压缩信息b / dev / random或/ dev / audio。我仍然认为它会是非常难以保证起点

在数字环上均匀分布?



That''s kind of what I thought. It seems fairly limited.
However, I just realised the Mersenne Twister c code
provided by it''s inventors allows for longer seeds.

"Those who need initial seed with more than 32-bit
length may use init_by_array() for initialization which
admits an array of arbitrary length as seeds"

I guess you could use an array seeded with the time,
the process ID, and some compressed info from
/dev/random or /dev/audio. Still I imagine it would
still be very difficult to guarantee starting points
distibuted uniformly around the ring of numbers?


>如果你只为一个随机数生成器使用32位种子,
>If you only use a 32 bit seed for a random number generator,
这意味着你只能生成最多的
2 ^ 32(约40亿)不同的序列?


是的,假设您总是在播种后生成第一个数字

的序列。可以使用二级

种子。通过使用一个来获取和丢弃N个伪随机数,然后使用一个,这取决于发生器,可能会也可能不会改善

任何东西。

Mersenne Twister怎么样,它的时间很长,是^ ^ 19937-1。如果你只使用32位种子,你是否只能访问这个数字环的一小部分?


很可能瘫痪一个好的伪随机数发生器

种子很差。

这套序列被限制在
期间的开头,即你的序列必须从某个地方开始,在指数1到40亿之间(忽略
所有可能的数据)这个)?。
does that mean you can only ever produce a maximum of
2^32 (approx 4 billion) different sequences?
Yes, assuming you always start a sequence with the first number
generated after seeding. It may be possible to use a "secondary
seed" by getting and throwing away N pseudo-random numbers before
using one, which, depending on the generator, may or may not improve
anything.
What about the Mersenne Twister, with it''s massive period
of 2^19937-1. Will you only ever have access to a tiny
portion of this ring of numbers, if you only use a 32-bit seed?
It is quite possible to cripple a good pseudo-random number generator
with a poor seed.
Will this set of sequences be confined to the beginning of the
period, ie, your sequence will have to start at some place
between index number 1 and 4 billion of the period (ignores
all the possible data after this)?.




我认为没有任何保证,这将取决于发电机上的



Gordon L. Burditt



I don''t think there''s any guarantee of that, and it would depend
on the generator.

Gordon L. Burditt


这篇关于随机播种的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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