Post Reply 
Modification of Linear Congruential Generator
10-16-2020, 01:44 AM
Post: #7
RE: Modification of Linear Congruential Generator
(10-16-2020 01:18 AM)Namir Wrote:  Many years ago I was looking at how the HP-41CX is able to generate pseudo-random numbers using it's clock (using date and time whose combination is unique). This approach absolved the user from providing an initial seed.

I implemented a Visual Basic (for Excel) class that implemented a clock-based random number. Rather than using the PC's own clock (the first obvious choice), I devised a virtual clock. Each time you requested a random number, the clock ticked one virtual second (and update the number of minutes, hours, days, etc. if need be). I also realized that I can design a custom time system where, for example, a virtual minute could be 100 second, and a virtual hour be 100 virtual minutes, and so on. You can replace the 100s with other numbers (such as prime numbers) if they give you better results.

Bottom line, my conviction that using a virtual clock with a custom time/date system can help generate good random numbers.

Namir

I mostly worked on Crays which had a clock that updated at system speed. The Cray-1 had a clock that updated (64 bits) every 12.5 nanoseconds. It made a good seed source. Some micros have "real-time clocks" that update too slowly. (Though the Hp50g is good, the whole thing runs slowly.) When teaching, I always suggested using the clock, writing it out to re-use for debugging if things go wrong and to ignore when things go right.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Modification of Linear Congruential Generator - ttw - 10-16-2020 01:44 AM



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