[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interesting one-line BASIC program



On Mar 28, 3:48 am, Roger Johnstone
<ro...@roger.geek.nz.removethisbit> wrote:
> In <47ebc7eb$0$20462$afc38...@news.optusnet.com.au> tonza wrote:
> > On 2008-03-26 23:44:43 +1100, Jake Featherston
> > <Jake_Feathers...@comcast.net> said:
>
> >> I came up with this in 1984 or '85.  Its a lot of fun.  Sometimes not
> >> much happens, but occasionally you get some really peculiar and
> >> unexpected results.  Here it is:
>
> >> 10 A=INT(RND(1)*65535)+1:B=INT(RND(1)*256):POKE A,B:GOTO 10
>
> >> Just sit back and watch the chaos....
>
> > And how is this program at all interesting?!
>
> If you leave it running long enough it will eventually reproduce the
> complete works of Shakespeare.
>
In truth, it would not do any such thing, even disregarding the fact
that it would eventually overwrite itself.

All pseudorandom number generators have a limited, though large,
amount of entropy to work with. They therefore must eventually repeat
their sequence, after a large number of bytes. In order to produce all
possible combinations of bytes, the period would have to be as least
as large as the total number of combinations, which is of course
impossible.