Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 random numbers
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jonos




PostPosted: 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...
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Wed Mar 31, 2004 1:42 pm   Post subject: (No 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.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
sport




PostPosted: 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
guruguru




PostPosted: Wed Mar 31, 2004 4:51 pm   Post subject: (No 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 !!!
Thuged_Out_G




PostPosted: 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
jonos




PostPosted: Wed Mar 31, 2004 5:21 pm   Post subject: (No 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
Dan




PostPosted: Wed Mar 31, 2004 8:40 pm   Post subject: (No subject)

u could just be very very very lucky or unlucky denpands on how u see it, lol.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: