Subject:
|
Programming the RCX in VB
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Sat, 2 Jan 1999 21:15:28 GMT
|
Viewed:
|
1318 times
|
| |
| |
I'm starting on the program for my Mindstorms robot and I had a question.
What is the best way to get a random number using VB? At first glance I can
find a register that appears to generate a random number between 1 and 32768,
but how do I limit this range? How do I [easily] get a random number between,
say, 5 and 25?
Also, has anyone posted VB source code (with comments) either here or on a
website somewhere? That would be a big help to those of us who are just
getting started...
Thanks!
-- John
|
|
Message has 1 Reply: | | Re: Programming the RCX in VB
|
| John, here is an example how to create random numbers in VB. In the example below it will generate values between 1 and 6. The statement "Randomize" is initializing the Random Generator. The function "Rnd" is then used to get the random numbers. Dim (...) (26 years ago, 3-Jan-99, to lugnet.robotics)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|