How does this look? Basically it's shuffling an int array so you can have a weighted certain set of numbers in a random order.
Does this look ok or how would you simplify/improve it?
Does this look ok or how would you simplify/improve it?
SeedRnd MilliSecs() Local bonus:Int[] = ShuffleIntArray([1,1,1,1,1,2,2,2,3,3]) For i = 0 To bonus.length-1 Print bonus[i] Next End Function ShuffleIntArray%[](array%[]) Local intArray%[] For i = 0 To array.length-1 Local r% = Rand(array.length)-1 intArray = intArray[..intArray.length+1] intArray[i] = array[r] array = array[..r] + array[r+1..] Next Return intArray End Function