Barotrauma 潜渊症

Barotrauma 潜渊症

评价数不足
Random Number Generator
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
更新日期
136.067 KB
2020 年 4 月 12 日 上午 8:50
2020 年 4 月 12 日 上午 8:50
2 项改动说明 ( 查看 )

订阅以下载
Random Number Generator

描述
This primitive psuedo-random number generator uses the equation $X_{n+1} = (aX_{n}+b) mod m$ to generate a random number. By default, it is between 0 and 100. This can be changed by tweaking m (the maximum number generated is m-1). The initial values of a and b can also be changed to change the initial number, and how they cycle - the order will always be the same.

This has some pretty major limitations:
- The adder and multiplier components are both clamped between ±999999, meaning any number bigger than 999999 becomes 999999 (and similar for -999999) so the system has to not create numbers larger than that. This reduces the quality of the random sequence. If you want to tweak the range of the generated number, I recommend highly that you adjust all of a, b, and m to get the best results.
- The initial value will always be the same. It will also always follow the same order. To get different numbers each time, selecting numbers based on a variable time is easier than selecting the 1st, then 2nd etc. number.
- Given initial conditions may not be capable of generating every number in the range. If this happens, tweak a or b slightly and try again.

Some tricks on selecting values for a and b:
The clamps are at roughly 1000000 = 10^6. So we can work with numbers up to that big. The first number to consider is m. Try and select a such that a * m is roughly 10^5. Then select b anywhere up to the order 10^5. This maximises the quality generated.

Hopefully this will be obsolete soon - a random number component should be coming soon (TM).
3 条留言
Black Lenin 2023 年 3 月 11 日 上午 6:16 
@Mr.WereWolph )))
Mr.WereWolph 2023 年 2 月 25 日 上午 10:22 
"A random number component should be coming soon"

Made in 2020 and as of 2023 there is yet to be a random component.

I cry.
Macie 2020 年 4 月 13 日 上午 7:04 
really good