October 29, 2020 at 12:00 am
Comments posted to this topic are about the item Funny code
Follow me on Twitter: http://www.twitter.com/way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
October 29, 2020 at 6:01 am
Interesting question, thanks Steve
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
October 29, 2020 at 4:48 pm
This is not only an interesting question but an implementation of an historically significant algorithm. Warning: it is also an extremely poorly behaved pseudo-random number generator.
The algorithm is the middle-square PRNG due to John Non Neumann. To generate a sequence, one squares a four-digit seed and takes the middle four digits as the next element of the sequence. The while condition checks for the recurrence of an element.
The algorithm generates notoriously short sequences. The longest has 111 elements. If an element under 100 occurs, the sequence collapse to 0. If a multiple of 100 occurs, the sequence will show up to 5 more multiples of 100 and then quit.
Thanks for the interesting question, Steve
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply