Computer Science Canada

random numbers

Author:  jonos [ Wed Mar 31, 2004 1:25 pm ]
Post subject:  random numbers

are the random numbers in turing even partly random, or maybe even different numbers every time. because im trying to get either 1 or 2 and its always coming as one. is there a way to easily seed it like in c++ so that i could actually get a random number or at least a different number every time. or would i have to create my own...

Author:  Dan [ Wed Mar 31, 2004 1:42 pm ]
Post subject: 

well the turth is nothing is random. in most languges it is an equation that uses the curent time as the seed to generate the random number.

in turing 3.x u had to put randomize b4 you used random comands to get better random numbers but i bivle in 4.x it adomaitclky calls it.

if u are having porblems u can uses randseed and randnext to chage the seed number that is used to make the random numbers.

if u realy whont to u can make your own code to find random numbers, i bivle i posted an example of how to make your own along time ago but i may be hard to find b/c i think it was in the help section.

Author:  sport [ Wed Mar 31, 2004 3:30 pm ]
Post subject:  Randomize

code:

loop
    var num, lower_number, higher_number : int
    lower_number := 1
    higher_number := 3
    randint (num, lower_number, higher_number)
    put num
    delay (100)
end loop

Author:  guruguru [ Wed Mar 31, 2004 4:51 pm ]
Post subject: 

THat should work (up)...

That's why you should learn Lisp which automatically changes its seed after every random number so that it will output a true random number Laughing !!!

Author:  Thuged_Out_G [ Wed Mar 31, 2004 5:11 pm ]
Post subject:  Re: random numbers

jonos wrote:
because im trying to get either 1 or 2 and its always coming as one. is there a way to easily seed it like in c++ so that i could actually get a random number or at least a different number every time



so you want a number between 1-2 and you want it to be different each time right?

thats not really random then, you have 2 numbers and you want the number to be diff each time, sounds pretty predicable to me

Author:  jonos [ Wed Mar 31, 2004 5:21 pm ]
Post subject: 

no i never said that, its just that for every single instance it is at 1, and i know how to use randint, thats what was not working. so i will just try to seed it. tahnks dan

Author:  Dan [ Wed Mar 31, 2004 8:40 pm ]
Post subject: 

u could just be very very very lucky or unlucky denpands on how u see it, lol.


: