生成确定性随机分布的实际点系列确定性、实际、系列

2023-09-11 23:28:10 作者:没什么能够阻挡的未来丶

我在做一个应用程序,需要生成确定性随机事件。他们需要的是确定性的,所以我可以计算出,当应用程序被关闭的事件发生。 基本上,我的事件是沿着线散点和我需要一个函数f(A,B),告诉我的位置a和b之间的点的数量。我可以离散我的线,并随机决定是否有一个点使用的位置种子我生成的每个位置,但是,似乎是作弊。我想知道是否有使用实数更优雅的方式来做到这一点。

I'm making an app that needs to generate deterministic random events. They need to be deterministic so I can compute which events happened when the app was closed. Basically, my events are points scattered along a line and I need a function f(a,b) that tells me the number of points between the locations a and b. I could discretize my line and randomly decide whether there is a point at every location using the location to seed my generator, but that seems like cheating. I would like to know if there is a more elegant way to do this that uses real numbers.

我相信这个问题可能与泊松分布的一些连接。

I believe this problem may have some connections with the Poisson distribution.

推荐答案

伪随机数发生器是确定性函数,它们将产生相同的序列中给出的相同的初始种子。如果您使用的PRNG,并记录种子值,你应该能够重复使用的顺序进行后处理。

Pseudo-random number generators are deterministic functions, they will produce exactly the same sequence given the same initial seed. If you use a PRNG and record the seed value you should be able to re-use the sequence for post-processing.

另外,让你的输出的随机序列的部分。

Alternatively, make the random sequence part of your output.