Computer Science Canada Need help with randomizing variables |
Author: | golden_thy89 [ Fri Jun 03, 2005 11:29 am ] |
Post subject: | Need help with randomizing variables |
Is there a way to do this? ![]() ![]() ![]() ![]() ![]() |
Author: | lyam_kaskade [ Fri Jun 03, 2005 11:38 am ] | ||
Post subject: | |||
Sure is.
1 is the lower limit, 10 is the upper limit. Change the parameters to whatever. Also, there is probably something about this in the tutorials section. Be sure to check it before you post. |
Author: | golden_thy89 [ Fri Jun 03, 2005 11:40 am ] |
Post subject: | |
what about randomizing various variables, say we were making a blackjack game and we only wanted 2 out of the many various cards to pop up, but they must be randomized, how could we go that. |
Author: | lyam_kaskade [ Fri Jun 03, 2005 11:48 am ] | ||
Post subject: | |||
You could put all the cards in an array.
Hmmm...that's probably giving you too much help. Oh well. Be sure to check out the walkthrough. http://www.compsci.ca/v2/viewtopic.php?t=8808 |
Author: | golden_thy89 [ Fri Jun 03, 2005 11:56 am ] |
Post subject: | |
hmmm thanks for the help, but unfortunatly it dosnt work.. for me anyway... |
Author: | lyam_kaskade [ Fri Jun 03, 2005 11:58 am ] |
Post subject: | |
Which part doesn't work? |
Author: | golden_thy89 [ Fri Jun 03, 2005 12:00 pm ] |
Post subject: | |
for some reason the for dosnt work |
Author: | lyam_kaskade [ Fri Jun 03, 2005 12:02 pm ] | ||
Post subject: | |||
Oh right.
Though you should have been able to figure that out... Read the tutorials |
Author: | syphon4 [ Fri Jun 03, 2005 4:01 pm ] |
Post subject: | random things |
for turing to randomly select something to do the best command to use is the "randint" |
Author: | Cervantes [ Fri Jun 03, 2005 5:08 pm ] |
Post subject: | |
The function, Rand.Int(), is much more flexible than the procedure, randint(). |