|
-
Oct 6th, 2011, 10:43 PM
#1
Thread Starter
Junior Member
Picking a Random Number Only Once
Hello,
I'm trying to figure out how to make a number be randomly picked but only picked once when a button is clicked. I've got the simple random number code down already but I can't seem to figure out how to have it picked only once.
This is basic random code that I'm using right now.
Code:
Randomize()
Dim value As Integer = CInt(Int((14 * Rnd()) + 1))
It picks out a number from 1 to 14 and returns it as an integer in "value", and I'm using to set that to open a specific form but I don't want that specific form to open more than once in a session. So if the number three was already picked out then it could never be returned ever again. I was thinking of making it randomize again if it rolls a number that has already come out but I'm still learning basic code and don't exactly know how I would set out on doing this.
Can anyone point me in the right direction?
-
Oct 6th, 2011, 10:45 PM
#2
Re: Picking a Random Number Only Once
Follow the CodeBank link in my signature and check out my threads on Unique Random Selections and Randomising A List.
-
Oct 6th, 2011, 10:52 PM
#3
Thread Starter
Junior Member
Re: Picking a Random Number Only Once
 Originally Posted by jmcilhinney
Follow the CodeBank link in my signature and check out my threads on Unique Random Selections and Randomising A List.
Perfect! Just what I needed. Thanks a bunch
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|