Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to generate random numbers 1

Status
Not open for further replies.

olabaz

Programmer
Aug 31, 2007
9
US
How do I generate random numbers. I'm using vb express edition 2005. Thanks in advance.
 
I have looked at it but none of them are for VB express 2005 all of them are VB.NET. I've been searching for an hour and I can't find anything.
 
Well I don't understand the code they use functions and some of them have a strange formula. I thought it would be

intRandomNumber = random(1, 3)

or somethingn like that.
 
Copied and pasted straight form help:

Code:
' Initialize the random-number generator.
Randomize()
' Generate random value between 1 and 6.
Dim value As Integer = CInt(Int((6 * Rnd()) + 1))


Hope this helps.



[vampire][bat]
 
Oh my! That's some pretty cool code there. Are you sure that's actually in the help files? I've never looked, but I can't imagine that Microsoft would give away such wonderful code.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Wow, thanks a lot, I really appreciate it.
 
Holiday? Hmmm.....

It was very relaxing, almost boring.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top