> > Below I pasted an assembly source of a random number generator that uses
> an
> > algorithm based on multiplication with a prime number and XOR-ing with a
> > fixed mask.
> >
> > In its current form, it produces numbers in the range 0..27, but you can
> > easily change that. You have to know that the middle bits of the seed
are
> the
> > most "random", so use those for the result.
> Thanks Maarten. And yes, I knew that the middle bits of R were most
'random'
> but it just wasn't random enough for me.

BEWARE: R is only partially random.

On a Z80: R = memory refresh register. If you read it too soon after
eachother the difference will only be about 2 or 3. Inbetween there must be
some random wait-time (for example the joystick control routine).

On a R800: R = instruction count register. It is increased by 1 every
instruction.

On a Z380: R = normal register. Load it with a value, and it won't be
changed.

Advice: don't depend on the R register alone, but combine the R register
with JIFFY and the Clock, and some random seed generator.


~Grauw



--
>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<
 email me: [EMAIL PROTECTED] or ICQ: 10196372
      visit my homepage at http://grauw.blehq.org/
>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<


****
Problems? contact [EMAIL PROTECTED] See also http://www.faq.msxnet.org/
****

Reply via email to