New PRNG method
|
09-12-2024, 03:55 PM
(This post was last modified: 09-12-2024 10:15 PM by Albert Chan.)
Post: #2
|
|||
|
|||
RE: New PRNG method
Because New PRNG only do shift + addition, it is not very random.
Chi Square percentage number are extremely weak. (i.e. not random) We want 10% to 90%, close to 50% is excellent (see ent.exe Chi-square Test) I reuse ent.lua to test randomness This use 10-digits integer random state, to avoid binary to decimal float conversion errors. Code: local s = floor(math.random()*1e10) Note: seed = 0 --> s = floor(0.8438413544573831 * 1e10) = 8438413544 C:\LuaJIT\bit>run ent.lua 0 | ent seed = 0 Entropy = 7.999983 bits per byte. Optimum compression would reduce the size of this 1000000 byte file by 0 percent. Chi square distribution for 1000000 samples is 23.65, and randomly would exceed this value more than than 99.99 percent of the times. Arithmetic mean value of data bytes is 127.5018 (127.5 = random). Monte Carlo value for Pi is 3.281245125 (error 4.45 percent). Serial correlation coefficient is 0.091133 (totally uncorrelated = 0.0). I don't quite understand your proposed algorithm. (s + pi) % 1 = 0.xxxxxyyyyy next(s) = (0.xxxxx + 0.yyyyy + pi) % 1 Above next(s) least sig. digts always matched pi's. Perhaps more mixing is better? next(s) = (0.xxxxxyyyyy + 0.yyyyy + pi) % 1 Patch is trivial Code: < s = (t-s + s*1e5 + k) % 1e10 C:\LuaJIT\bit>run ent.lua 0 | ent seed = 0 Entropy = 7.999923 bits per byte. Optimum compression would reduce the size of this 1000000 byte file by 0 percent. Chi square distribution for 1000000 samples is 106.69, and randomly would exceed this value more than than 99.99 percent of the times. Arithmetic mean value of data bytes is 127.4946 (127.5 = random). Monte Carlo value for Pi is 3.140748563 (error 0.03 percent). Serial correlation coefficient is -0.000728 (totally uncorrelated = 0.0). |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
New PRNG method - Namir - 09-12-2024, 01:09 PM
RE: New PRNG method - Albert Chan - 09-12-2024 03:55 PM
RE: New PRNG method - Namir - 09-12-2024, 06:39 PM
RE: New PRNG method - Namir - 09-12-2024, 10:03 PM
RE: New PRNG method - Albert Chan - 09-12-2024, 10:34 PM
RE: New PRNG method - Albert Chan - 09-12-2024, 11:36 PM
RE: New PRNG method - ttw - 09-13-2024, 02:12 AM
RE: New PRNG method - Namir - 09-13-2024, 09:19 PM
RE: New PRNG method - AnnoyedOne - 09-14-2024, 04:06 PM
RE: New PRNG method - Namir - 09-15-2024, 01:09 PM
RE: New PRNG method - ttw - 09-15-2024, 04:15 PM
RE: New PRNG method - Namir - 09-17-2024, 09:49 PM
|
User(s) browsing this thread: 1 Guest(s)