Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
random numbers
Author Message
jonos

Posted: 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

Dan

Posted: 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

Posted: 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

Posted: 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 !!!
Thuged_Out_G

Posted: 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

Posted: 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

Posted: 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: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 7 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: