First Spear Posted December 30, 2015 Share Posted December 30, 2015 Can anyone show an example of how to pull random words from a Label in IntyBASIC? If I have something like MyLabel1: Data 11 , 23 , 234 , 654 , 43 MyLabel2: Data 546 , 2 , 3504 , 43 , 209 I would like to do make a Procedure call and get any one of those values assigned to MyLabel1 but nothing from MyLabel2. How would that be possible? Thanks. Quote Link to comment Share on other sites More sharing options...
+nanochess Posted December 30, 2015 Share Posted December 30, 2015 The easiest way would be: A = MyLabel1[RANDOM(5)] 2 Quote Link to comment Share on other sites More sharing options...
+DZ-Jay Posted December 30, 2015 Share Posted December 30, 2015 The easiest way would be: A = MyLabel1[RANDOM(5)] And just to clarify for everyone, you used RANDOM(5) because there are 5 entries in the list, right? -dZ. Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted December 30, 2015 Share Posted December 30, 2015 5 is the modulo operator for the RANDOM command. Quote Link to comment Share on other sites More sharing options...
+nanochess Posted December 30, 2015 Share Posted December 30, 2015 And just to clarify for everyone, you used RANDOM(5) because there are 5 entries in the list, right? -dZ. That's right. 5 is the modulo operator for the RANDOM command. Exact! Quote Link to comment Share on other sites More sharing options...
PuzZLeR Posted December 30, 2015 Share Posted December 30, 2015 And very important reminder to note here in EVERY thread on random numbers. Do something that actually makes your program "random" with external intervention - the "human factor". Like do something in timing, like when you press the disc, or when you start the game etc. Something that will be different almost every time to plant a "seed" for your program to work with and further transform. Nanochess'es idea, in another thread, of including a title screen to "begin" the game was perfect for my game I'm putting together for this contest. This different "timing" is important, otherwise your program will give you the same random number(s) every running. AFAIK, there are no "random numbers" from a computer. A computer does the same thing every time you ask it with the same instructions. They need YOUR help on this one. 1 Quote Link to comment Share on other sites More sharing options...
GroovyBee Posted December 30, 2015 Share Posted December 30, 2015 AFAIK, there are no "random numbers" from a computer. A computer does the same thing every time you ask it with the same instructions. They need YOUR help on this one. There is some entropy to be had with uninitialised RAM contents. The latest version of IntyBASIC uses this technique to generate its random number seed before handing control over to your game. 2 Quote Link to comment Share on other sites More sharing options...
+nanochess Posted December 30, 2015 Share Posted December 30, 2015 And very important reminder to note here in EVERY thread on random numbers. Do something that actually makes your program "random" with external intervention - the "human factor". Like do something in timing, like when you press the disc, or when you start the game etc. Something that will be different almost every time to plant a "seed" for your program to work with and further transform. Nanochess'es idea, in another thread, of including a title screen to "begin" the game was perfect for my game I'm putting together for this contest. This different "timing" is important, otherwise your program will give you the same random number(s) every running. AFAIK, there are no "random numbers" from a computer. A computer does the same thing every time you ask it with the same instructions. They need YOUR help on this one. You're right, there are really no random numbers, but pseudo-random even though all the tricks. There is some entropy to be had with uninitialised RAM contents. The latest version of IntyBASIC uses this technique to generate its random number seed before handing control over to your game. Yes, and thanks Mark for allowing me to use your code 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.