
-----------------------------------
jonos
Wed Mar 31, 2004 1:25 pm

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...

-----------------------------------
Dan
Wed Mar 31, 2004 1:42 pm


-----------------------------------
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.

-----------------------------------
sport
Wed Mar 31, 2004 3:30 pm

Randomize
-----------------------------------

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


-----------------------------------
guruguru
Wed Mar 31, 2004 4:51 pm


-----------------------------------
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  :lol: !!!

-----------------------------------
Thuged_Out_G
Wed Mar 31, 2004 5:11 pm

Re: random numbers
-----------------------------------
 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

-----------------------------------
jonos
Wed Mar 31, 2004 5:21 pm


-----------------------------------
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

-----------------------------------
Dan
Wed Mar 31, 2004 8:40 pm


-----------------------------------
u could just be very very very lucky or unlucky denpands on how u see it, lol.
