Something like this:
VB Code:
' Create the arrays Dim this As New ArrayList Dim arrRand As New ArrayList ' Fill the base array For i As Integer = 0 To 9 this.Add(i) Next Dim rand As New Random 'Randomly remove items from the base array and add them to our random array For j As Integer = 0 To 9 Dim item As Integer item = rand.Next(0, this.Count - 1) arrRand.Add(this(item)) this.RemoveAt(item) Next 'Check the output to see that it is random Dim sb As New StringBuilder For i As Integer = 0 To 9 sb.Append(arrRand.Item(i)) Next MsgBox(sb.ToString())




Reply With Quote