Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 132,287 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,312 people online right now. Registration is fast and FREE... Join Now!




random number

 
Reply to this topicStart new topic

random number

Unholy
post 26 Feb, 2008 - 03:59 AM
Post #1


New D.I.C Head

*
Joined: 19 Feb, 2008
Posts: 3

im trying to make a raffle program for a LAN party i attend so i need it to be random and not display a number already been used. i also so need it to display a number everytime the random button, i dont wish it to display all the numbers in 1 go.

CODE
Dim intRandom As Integer

           Randomize
           intRandom = Int((intHighest - intLowest + 1) * Rnd + intLowest)
           lblRandom.caption = intRandom





User is offlineProfile CardPM

Go to the top of the page

LookNAO
post 27 Feb, 2008 - 10:35 AM
Post #2


D.I.C Head

**
Joined: 28 Dec, 2007
Posts: 66



Thanked 1 times
My Contributions


You have the right idea....
Since you have to keep up with what has already been chosen...

After you have chosen a new number, go through what has already been chosen, and if it has been chosen - get another number. If not, add it to the list and show it.

CODE

Dim AlreadyChosen(IntHighest) as boolean

<Get number>
if AlreadyChosen(intRandom)=true then
      goto <Get Number>
else
      AlreadyChosen(intRandom)=true
       "Show me the money!!!"
endif

User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 01:01AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month