I want to generate 10 different numbers from a range of 0-9. the desired output may look like this, 9 0 8 6 5 3 2 4 1 7
Dim arraynum(9) As Integer
Dim crmd A
This is the simplest but working code. Also there are no APIs!
Dim a(1 To 10), tmp, count, isRepeated
count = 1
Randomize
While count <= 10
isRepeated = False
tmp = Left(Rnd * 10, 1)
For i = 1 To 10
If tmp = a(i) Then isRepeated = True: Exit For
Next
If isRepeated = False Then a(count) = tmp: count = count + 1
Wend
YourLine = Join(a, "")