Re: Random Integers


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

Re: Random Integers



What calculator?  What language?

In ASM:

        ld      a, (yournumber)
        add     a, r

gives a very not-so-random number without using a routine of any sort.

In BASIC:

        INT(RAND*MAX+1)->NUM

Where MAX is the highest number you want and NUM will be 1-MAX.  Take out
the 1 for 0-(MAX-1)

At 10:04 PM 9/4/97 -0700, Hermann Chong wrote:
>I am writing a program, and I added a random integer in it.  It stayed at
>one number, and I couldn't get it to be erratic.  How can I add that in?
>
>                                  Hermann Chong
>
>---
>
>If we were dolphins, we would call this planet Ocean.
>
>
---
Evil Jim
Viva La Mexico
<eviljim@writeme.com>
http://members.tripod.com/~eviljim/
I want to die in my sleep like my Grandfather, not screaming in pain like
the passengers in my car...


References: