Hp Algorithm to create random numbers
|
08-25-2024, 02:50 PM
(This post was last modified: 08-26-2024 11:22 AM by Albert Chan.)
Post: #16
|
|||
|
|||
RE: Hp Algorithm to create random numbers
(08-25-2024 12:02 PM)DavidM Wrote: In your second example, it appears that you may have inadvertently left out the "6" when executing "0.002567 RDZ": Assuming 1E-16 ≤ seed < 1, we know original state must end in 001 --> state * 2851130928467 ≡ 163041130928467 (mod 10^15) 1/2851130928467 ≡ -46007610876197 ≡ 953992389123803 (mod 10^15) (*) --> state ≡ 163041130928467 * 953992389123803 ≡ 002570000000001 (mod 10^15) --> seed = 0.00257 (*) Calculations based on Euclidean GCD calculations, then scale-up for mod inverse, see here 1E15 --> -floor(446607260/9707247377 * 1E15) = -46007610876197 2851130928467 + 2104175036550 - 746955891917 + 610263252716 - 136692639201 + 63492695912 - 9707247377 --> +floor(13843/300885 * 9707247377) = 446607260, 9.71E9*6.35E10 ≈ 6.2E20 5249211650 - 4458035727 + 791175923 - 502156112 + 289019811 - 213136301 + 75883510 - 61369281 + 14514229 - 3312365 + 1264769 - 782827 + 481942 - 300885 --> -floor(-19/413 * 300885) = 13843, 3.01E5*4.82E5 ≈ 1.4E10 181057 + 119828 - 61229 + 58599 - 2630 + 739 - 413 --> -floor(1/21 * 413) = -19, 413*739 = 305207 326 + 87 - 65 + 22 - 21 --> 1/1 ≡ 1 (mod 21), 21*22 = 462 1 = gcd |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 16 Guest(s)