Post Reply 
Hp Algorithm to create random numbers
08-25-2024, 12:02 PM
Post: #15
RE: Hp Algorithm to create random numbers
(08-25-2024 10:52 AM)Gil Wrote:  Despite all your detailed explanations, David, would it be possible to work out a detailed example, again step by step, to get the RAND om number .510262440213
after entering 2.567 RDZ on the HP50G?

And perhaps also, if I may ask, for
RANDom number .163041130928
after entering 0.002567 RDZ?

Thanks in advance for your painstaking, David.

Regards,
Gil

In your first example, entering 2.567 RDZ produces an internal seed value of 256700000000011.
When executing RAND immediately following that, we have the following:
new_seed_value = (256700000000011 * 2851130928467) MOD 10^15 = 510262440213137

The normalization process for that integer yields 0.510262440213 for the final RAND result.

In your second example, it appears that you may have inadvertently left out the "6" when executing "0.002567 RDZ":
0.00257 RDZ RAND => 0.163041130928
0.002567 RDZ RAND => 0.377640130928


The only reason I figured that out was that I did the same exact thing when testing this after reading your post -- it had me confused for a minute or so until I subsequently typed it in correctly on a second try. Smile

So here's the same process for that input.

Entering 0.002567 RDZ produces an internal seed value of 2567000000001.
When executing RAND immediately following that, we have the following:
new_seed_value = (2567000000001 * 2851130928467) MOD 10^15 = 377640130928467

The normalization process for that integer yields 0.377640130928 for the final RAND result.

Does this help?
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-25-2024 12:02 PM



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