Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account

VB Random Rolls

  • Please log in to reply



    New Member

  • Member
  • Pip
  • 5 posts
I'm trying to make a random bonus but both methods I tried are causing me problems.

Dim intRandom As Integer
intRandom = CInt(Int((3 * Rnd()) + 1))
'every time I do this it counts 1, 1, 1, 2, 2, 2, 3 I tried changing it around a bit and now it's counting 3,2,1,2,2 every time...is this suposed to be giving me the same random numbers every time?

Dim generateRandom As New Random
intRandom = generateRandom.Next(2) + 1
'this is only giving me the results of 1-2, not 1-3 like I want

adding "Randomize()" fixed it ^.^

Edited by jamesbob, 11 September 2005 - 05:35 PM.

  • 0


Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP