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??
I think i need an example?
As you see, i've never worked with Random before, and arrays are neither one of my "favourites" hehe..as in, i dont know to much about arrays either...
So any example's would give great help !!
Didnt fully get the gist of it....
If you could make an working example, then that would really make me learn and understand this..
Cause the "mark the index in array..." didnt make sense to me,,,
So if you couuld elaborate it ,then i'd be thankfull