help creating random number

For a 15 character random number try this:

Public Function GetRandom() As Double
Dim low As Double
Dim hi As Double

low = 100000000000000#
hi = 999999999999999#

GetRandom = CDbl((hi - low + 1) * Rnd + low)
End Function
this won't work as it create a number like 1.4235 E14
not good
 
It sounds like this is for Excel? Can't you format the cells to display the number the way you want? I've tried this in Access and Excel with no problems.
 
If I want to add the randomize statment to make sure it's random where should it be put ?
Seems that there is a very post on this! Amazing what you can find. :D
Proper use of the Randomize Statement

Code:
[B]Randomize[/B]
For i = 1 To 15  
     strRandom = strRandom & Int((snglRndMax - snglRnDmin + 1) * Rnd + snglRnDmin)
Next i
 
find nice Steve :)

Rick_A.
I used mgsbox to show me the result, and it looked as I posted.

as I said - throwing twice the same dice is exactly the same as throwing two identical dices at once.

running 15 times a random number of 10 (0-9) is exactly the same as trying to generate a single 15 characters long random number.


I think it's all sorted out now with Steve's find of the Randomize
 

Users who are viewing this thread

Back
Top Bottom