3 Replies - 70868 Views - Last Post: 17 January 2010 - 09:36 AM Rate Topic: -----

#1 0FreakFire0  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 02-January 09

Random number generator.

Post icon  Posted 16 January 2010 - 03:41 PM

I do not have any idea how to make a random number generator, and I need one for what I am making. I need something that basically says, "make random number between 1 and 4."
I could use the help. Thank you Dream in Code!!
Is This A Good Question/Topic? 0
  • +

Replies To: Random number generator.

#2 zombie_chan51  Icon User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 327
  • Joined: 16-March 08

Re: Random number generator.

Posted 16 January 2010 - 03:54 PM

View Post0FreakFire0, on 16 Jan, 2010 - 02:41 PM, said:

I do not have any idea how to make a random number generator, and I need one for what I am making. I need something that basically says, "make random number between 1 and 4."
I could use the help. Thank you Dream in Code!!


the Random class

http://msdn.microsof...tem.random.aspx
Was This Post Helpful? 0
  • +
  • -

#3 0FreakFire0  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 02-January 09

Re: Random number generator.

Posted 17 January 2010 - 08:10 AM

Hey, guess what?? I did some researching and found out how to do so!!
		Randomize()
		Number = Int(Rnd() * 4)

The "* 4" says how many numbers it will go by. The output of that will either be 0, 1, 2, or 3; four different numbers. You can change the 4 to anything. There is your random number generator!! Thanks for your attempted help/response!! :D
Was This Post Helpful? 0
  • +
  • -

#4 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2240
  • View blog
  • Posts: 9,411
  • Joined: 29-May 08

Re: Random number generator.

Posted 17 January 2010 - 09:36 AM

simply
Dim rn As New Random
 
n =rn.Next(1, 4)


Was This Post Helpful? 2
  • +
  • -

Page 1 of 1