G
Guest
Hello,
I want to create a quick random generator that will not produce duplicate
random numbers. Here is what I have been able to do so far:
Function RandomTest()
Dim high, low, result, amount, i As Integer
amount = inputbox("How many values do you want generated?", "Random
Generator, Step 1")
low = inputbox("Enter starting range of selection.", "Random Generator, Step
2")
high = inputbox("Enter ending range of selection.", "Random Generator, Step
3")
For i = 1 To amount
Randomize
result = Int((high - low + 1) * Rnd() + 1)
Debug.Print result
Next i
end function
I want the user to define the number of outputs (amount), the boundaries
(high and low). So, 1) how do I make sure that these numbers do not
duplicate and 2) how do I store them so that I can use them later (either in
a table or as a way to refer back to them in code).
Thanks!
Jessica
I want to create a quick random generator that will not produce duplicate
random numbers. Here is what I have been able to do so far:
Function RandomTest()
Dim high, low, result, amount, i As Integer
amount = inputbox("How many values do you want generated?", "Random
Generator, Step 1")
low = inputbox("Enter starting range of selection.", "Random Generator, Step
2")
high = inputbox("Enter ending range of selection.", "Random Generator, Step
3")
For i = 1 To amount
Randomize
result = Int((high - low + 1) * Rnd() + 1)
Debug.Print result
Next i
end function
I want the user to define the number of outputs (amount), the boundaries
(high and low). So, 1) how do I make sure that these numbers do not
duplicate and 2) how do I store them so that I can use them later (either in
a table or as a way to refer back to them in code).
Thanks!
Jessica