HP 12C Random Integer Number Generator
11-04-2018, 06:02 PM (This post was last modified: 11-04-2018 06:04 PM by Dieter.)
Post: #8
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: HP 12C Random Integer Number Generator
(11-04-2018 04:03 PM)SlideRule Wrote:  It took a little time to research, but this routine for the Sharp PC-1211 from the October 1981 edition of Your Computer (pg.54) matches your range requirement of integers from one to six.

The relevant part here is not the range of the random integers but the random number generator itself (whose results are then scaled to 1...6). If I understand this correctly, the method is

r := frac[ (r+77) · pi5 ]

Here pi5 is 306,0196848 so that before the FRC command the intermediate result is between 23563,5... and 23869,5..., which in turn means that on a 10-digit calculator the resulting random number (between 0 and 1) has merely five significant digits.

Can someone say something about other properties of this generator? How does it compare to the simple and fast frac[(r+pi)²] generator?

Dieter
 « Next Oldest | Next Newest »

 Messages In This Thread HP 12C Random Integer Number Generator - Gamo - 11-16-2017, 04:58 AM RE: HP 12C Random Integer Number Generator - Dieter - 11-16-2017, 08:06 AM RE: HP 12C Random Integer Number Generator - Dieter - 11-19-2017, 09:23 PM RE: HP 12C Random Integer Number Generator - Gamo - 11-20-2017, 04:46 AM RE: HP 12C Random Integer Number Generator - Dieter - 11-20-2017, 01:45 PM RE: HP 12C Random Integer Number Generator - Gamo - 11-21-2017, 05:13 AM RE: HP 12C Random Integer Number Generator - SlideRule - 11-04-2018, 04:03 PM RE: HP 12C Random Integer Number Generator - Dieter - 11-04-2018 06:02 PM

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