Post Reply 
Hp Algorithm to create random numbers
08-14-2024, 02:38 AM (This post was last modified: 08-14-2024 02:47 AM by DavidM.)
Post: #6
RE: Hp Algorithm to create random numbers
As Albert also indicated, the internal seed is actually 15 decimal digits. Here's another series of examples that might help to show what's happening.

First, I'll set the seed to a nice number with RDZ so that this can be easily replicated:

1E-13 RDZ

The internal seed now has a value of 000000000000001.

Executing RAND at this stage causes the following:
new_seed = (000000000000001 x 2851130928467) MOD 10^15 = 002851130928467
RAND result is normalized to 2.85113092846E-3
*

Next RAND:
new_seed = (002851130928467 x 2851130928467) MOD 10^15 = 261097470970089
RAND result is normalized to 0.26109747097


Next RAND:
new_seed = (261097470970089 x 2851130928467) MOD 10^15 = 335429755623563
RAND result is normalized to 0.335429755623


Next RAND:
new_seed = (335429755623563 x 2851130928467) MOD 10^15 = 468090732667921
RAND result is normalized to 0.468090732667


* The normalization step appears to shift out any leading zeros before truncating the last three digits.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Hp Algorithm to create random numbers - DavidM - 08-14-2024 02:38 AM



User(s) browsing this thread: 1 Guest(s)