Talk:Randomness

From Maze

(Difference between revisions)
Jump to: navigation, search
(→The broken RND implementation: new section)
Line 157:Line 157:
</pre>
</pre>
--[[User:MarkSample|MarkSample]] 20:26, 15 May 2011 (UTC)
--[[User:MarkSample|MarkSample]] 20:26, 15 May 2011 (UTC)
 +
 +
== The broken RND implementation ==
 +
 +
It might be worth mentioning that there are some real mixed reviews on the behavior of the Commodore 64 RND. Essentially, Microsoft got fancy with adding "improvements" on top of the RND linear congruent generator, and in doing so dramatically broke it, introducing behaviors that dramatically shorten how many different numbers it generates in sequence before the entire sequence repeats. In studying the first 1000 seeds that could be set by RND(-X), Afflerbach discovered that the vast majority (958) would fall into a short repeating sequence of just 13,379 numbers, a far cry from the ~100,000,000,000 non-repeating numbers that could be possible.
 +
 +
In the case of 10 PRINT, this means that, with 25x40=1000 characters making up a page, most random seeds will fall into a cycle of just 13 printed pages appearing in endless repetition. This "repetition" is complicated slightly by the fact that the cycle "starts over" mid-line. The result is a form of partial repetition -- the same alignment of maze walls scroll by, but shifted along the x axis so as to appear partially wrapped across the screen. [NEED TO TEST THIS, possibly screen cap it.]
 +
 +
<blockquote>Afflerbach, Lothar. Algorithms: The pseudo-random number generators iCommodore and Apple microcomputers. Statistische Hefte (Statistical Papers) 26, 321-333. Springer-Verlag, 1985.
 +
 +
[In 1995, by contrast, Bowman finds the C64 BASIC RND output to perform at least as well as much more contemporary professional implementations such as Mathematica -- although I'm not sure if this is based on some different (much later) implementation of Commodore BASIC, or if the paper is not competent.]
 +
 +
Bowman, Richard L. "Evaluating Pseudo-Random Number Generators." Comput. & Graphics, Vol. 19, No. 2, pp. 315-324, 1995</blockquote>

Revision as of 03:00, 12 July 2011

View this revision of Talk:Randomness.

Personal tools