|
-
Sep 21st, 2007, 08:04 PM
#1
Thread Starter
New Member
Random coding
is there any oyher way in VB to generate a random number other than
Code:
dim intNum as integer
IntNum = (rnd*10)
this seems to give a less than random sequence even when compiled and I want to build a random generator into my RPG software
many thanks in advance
-
Sep 21st, 2007, 08:07 PM
#2
Re: Random coding
If you put the Randomize it makes your number truly random. If you don't it follows a set sequence.
Code:
dim intNum as integer
randomize
IntNum = (rnd*10)
Edit: Randomize only needs to be called once so put it in your form load. You don't want to call it more than once.
If a post has been helpful please rate it. 
If your question has been answered, pull down the tread tools and mark it as resolved.
-
Sep 21st, 2007, 08:30 PM
#3
Thread Starter
New Member
Re: Random coding
many thanks very helpfull but I have one question
do you need to call that in the module where the sub routines are or will the form load call do that as well? and does it need to be called in each form used?
-
Sep 21st, 2007, 08:31 PM
#4
Re: Random coding
It only needs to be called once per program execution.
If a post has been helpful please rate it. 
If your question has been answered, pull down the tread tools and mark it as resolved.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|