The key to this is having a PRNG that you can set the seed value of.
I don't think AS3 has any way to set the seed for Math.random(), but a quick web search turned up a few results for custom PRNGs that do.
As for the distribution, you have to play around more. What didn't you like about 'circular distribution'?
Bear in mind that you can use a lot of different distributions of random numbers --other than uniform-- using a uniform distribution and some function.
发布评论
评论(3)
关键是拥有一个可以设置种子值的 PRNG。
我不认为 AS3 有任何方法来设置 Math.random() 的种子,但是快速的网络搜索发现了一些自定义 PRNG 的结果。
至于分配,还得多玩玩。您不喜欢“循环分发”的哪些方面?
请记住,您可以使用许多不同的随机数分布(除了均匀分布之外),即使用均匀分布和某些函数。
The key to this is having a PRNG that you can set the seed value of.
I don't think AS3 has any way to set the seed for Math.random(), but a quick web search turned up a few results for custom PRNGs that do.
As for the distribution, you have to play around more. What didn't you like about 'circular distribution'?
Bear in mind that you can use a lot of different distributions of random numbers --other than uniform-- using a uniform distribution and some function.
我认为你需要更仔细地考虑一下这一点。显然,不存在“太随机”这样的事情。有些东西要么是随机的,要么不是。
您真正想要的是某种不可预测(对于最终用户而言)、可重复且美观的布局。
I think you need to think a bit more carefully about this. Clearly, there is no such thing as "too random". Something is either random, or it is not.
What you really want is some layout that is, unpredictable (to the end user), repeatable, and aesthetically pleasing.
为了简单起见,您可以对 x 和 y 位置使用随机数。这应该会给你一个分散的外观。
它们可以重叠吗?如果没有,在生成随机数后,您可以查看该位置是否与屏幕上的其他位置重叠。
To keep it simple, you can just use random numbers for the x and the y positions. That should give you a scattered look.
Can they overlap? If not, after you generate the random numbers you can see if that position will overlap with other one's on screen.