|
-
Apr 2nd, 2003, 05:15 PM
#1
Thread Starter
Hyperactive Member
Need Help On a Random Function...
i have this code:
VB Code:
If Check.Value = 1 Then
Randomed = True
Randomize List.ListCount
RanVal = Int(List.ListCount * Rnd + 1)
MsgBox RanVal
End If
So what it (should) do is to make a random number
from 0 to max(list.listcount)
and so it does, but i noticed that if i had a small amount of items in the list then it could generate numbers like: 1,5,3,7,6,7,5,6,5,3,2,3,4,8,9,8,8,4,5,2,1,2 and so on,...
And as you see from my example, it repeats many numbers often
what i'd like it to do is to NOT choose the same number twice before it has generated all possible numbers first...
I mean, if i have 10 items in the list, then i want it to randomly select all of them before it starts repeating any already selected items ..like 2,4,6,8,10,1,3,5,7,9 and then it repeats...in another random order ofcourse..
Can anyone helpp me do this??
***************
Please use [highlight=vb] ..your code.. [/highlight] when posting code!
When you have received the working answer to your question,
please mark it as *SOLVED* + Your Questions Title ...using your Thread's Tool menu.
Also try to point out what answer made it work for you, or edit your first post to contain a quote of the correct answer...
Please Answer All Questions With Working Code Examples...
My Unfinished Projects and My working Programs
***************
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
|