need help on Random number generation on VB

Results 1 to 4 of 4

Thread: need help on Random number generation on VB

  1. #1
    ?? Guest

    Default need help on Random number generation on VB

    I have a problem in generating the random numbers in VB, i was a developing a small psychometric test application in vb to check the memory leak, i generate three random numbers and display to the users (all the number arethree digit numbers) and after a second i display a text box for them to enter the number they saw in the screen, i have four other similar test using numbers that i generate randomly, i developed this application on VB6.0 to generate the random number iused Rnd method and multiplied that by 1000 to get a three digit number. <BR>Now the problem is when i run the application (even if i open two separate sessions) it gives the same random numbers say for example 812, 678, 890 ,.. for a while. (normally the user is allowed to enter the numbers that they saw in the screen within 60 seconds and they will press the ok button to pass on to the next test, i noticed this random numbers to be repeating if i take less time , i.e i do not enter any of the number thati see in the screen simply i press ok and after completing all the tests i restart the application again from the test 1 now the random number starts to repeat in the same sequence for all the four tests, if i keep entering the numbers in the text box ittakes time (say about 30seconds for each test so the total comes to 2 to 3 minutes) and i follow the same to the remaining tests and start the application again now the numbers does not seems to repeat again in the same sequence as that of before, it really sounds crazy, is vb using the system time or something of that sort to generate the random numbers, if so how can i handle this situation. Thank you in advance

  2. #2
    Join Date
    Dec 1969

    Default RE: this is a re-post, isn't it?

    (if it&#039s the same person) I told you before to get the VBScript language reference. look up &#039Randomize&#039<BR><BR>the link is to the left<BR><BR>j

  3. #3
    ?? Guest

    Default RE: this is a re-post, isn't it?

    ya the same person, but i couldnt find my thread in the page so i reposted it again, thank you.

  4. #4
    Sateesh Guest

    Default Here we go

    i hope u are not using the randomize statement, if you dont use the randomize satatement the system uses the time as a default seed in generating the random numbers. Try using the randomize statement before calling the rnd method.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts