Re: A82: Squares and random numbers


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

Re: A82: Squares and random numbers




In a message dated 10/19/98 7:54:39 PM Eastern Daylight Time,
vimm@earthlink.net writes:

> Hello, Mr. Assembly newbie here again.  I think I've figured out the
>  basics, but now I want to get into the graphics.  I seem to learn the
>  best from disecting examples, so could someone give me an example of a
>  program that would draw a square on the graph?  Also, I hear there's no
>  clear way to generate random numbers, so could someone tell me what
>  would be the best way (or just a good way) for me to generate 10 random
>  numbers from 1-13?  Thanks for the help!
>  
>  											Vimm

first, a random number mutator is useful.  check out getrand.asm in SameGame
1.3 (wow the second endorsement for my games!).  Then you repeatedly subtract
the maximum number from the value you get from the random number mutator.  do
this until the value dips below zero, then add the maximum again.  it's
equivilant to a modulo operation.  this will give you 0-the maximum number.
To get anything useful out of the random number mutator, you must first
generate a randseed.  email me personally or look at the SameGame source *G*
for more information on randseeds.

~Adamman

PS: Sam, I haven't gotten the chance to look at the source you sent me, so
unless you sent it to more than just me you might be waiting for a while.
sorry