RandomArray

Creates array of random numbers, returns 1 Dim array

CodeFunctionName
What is this?

Public

Tested

Imported
Function RandomArray(aLen, Lbound, Ubound)
Dim I, J, Exists, Nextrand, Newrandom, Result(1)
Result = Null
If (aLen >= 1) Then
Redim Result(aLen - 1)
Randomize
For I = 0 To aLen - 1
Nextrand = True
Do While Nextrand
Exists = False
Newrandom = Int((Ubound - Lbound + 1) * Rnd + Lbound)
For J = 0 To I - 1
Exists = Exists Or (Result(J) = Newrandom)
Next
If (Not Exists) Then
Nextrand = False
Result(I) = Newrandom
End If
Loop
Next
End If
RandomArray = Result
End Function

aLen, Lbound, Ubound

Views 4,126

Downloads 1,330

CodeID
DB ID

ANmarAmdeen
608
Revisions

v1.0

Monday
July
2
2018