RANDOMIZATION
Author |
Message |
CoNfUsEd_PrOgRaMmEr05
|
Posted: Sun Oct 02, 2005 11:46 am Post subject: RANDOMIZATION |
|
|
I'm having tissue issues with randomization, i have been tryin for like thirty minutes to get it to work I don't know what i'm doin wrong. I looked at the other posts and thats what they said to do...i'm such a noob at this...:
loop
var lala:int:= Rand.Int (1, 256)
put "Computer and Information Science"
end loop
it tells me "Rand has not been declared" wtf? I cant get it to work...urrrrghhhh. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
skootles
|
Posted: Sun Oct 02, 2005 12:55 pm Post subject: (No subject) |
|
|
to use the randint procedure haha, fixed it smartypants' , it needs to look like this:
code: | randint(variable,min,max) |
I don't really see the point in your program.... but it should look something like this:
code: |
var lala : int
loop
Randint (lala,1, 256)
put "Computer and Information Science"
end loop
|
Hope that helped. That will continually change the value of lala to any number between 1 and 256, and it will also display "Computer and Information Science" over and over again. |
|
|
|
|
|
beard0
|
Posted: Sun Oct 02, 2005 1:10 pm Post subject: (No subject) |
|
|
Rand.Int is a valid function, used as you used it, in latter verisons of Turing. You must have an earlier version, in which case skootles solution would work. |
|
|
|
|
|
Cervantes
|
Posted: Sun Oct 02, 2005 1:48 pm Post subject: Re: RANDOMIZATION |
|
|
CoNfUsEd_PrOgRaMmEr05 wrote:
it tells me "Rand has not been declared"
Go to %oot/support/predefs and check for a Rand.tu file, or a file that would contain the Rand module. Check it, and see if there is a function called "Int". If not, then your version of Turing probably just doesn't have it (though I've never heard of that before). If it is in there, check the file called "predefs.lst" or something like that. I know the extension is .lst. Check to make sure the Rand module is imported. If it is, it would look something like this:
code: |
"%oot/support/predefs/Rand.tu"
|
skootles wrote:
to use the randint function...
randint is not a function: it's a procedure. Rand.Int is the function version. |
|
|
|
|
|
[Gandalf]
|
Posted: Sun Oct 02, 2005 1:49 pm Post subject: (No subject) |
|
|
skootles wrote: to use the randint function, it needs to look like this:
randint is not a function, it is a procedure. Rand.Int is a function. Look up the difference in one of the tutorials.
*edit* Noo, Clevernuts got it before me!! |
|
|
|
|
|
skootles
|
Posted: Sun Oct 02, 2005 5:43 pm Post subject: (No subject) |
|
|
Oh well... I think he gets the point now? |
|
|
|
|
|
|
|