Similar to snb's thoughts, what is your real goal? Is it translation or making a VBA routine to accomplish the same goal?
If the latter, I would guess that a solution already exists on this forum or another. If the former, can you give example input and output? I am not clear on what the numdigits means. I was thinking it might be a number of decimal places thing.
I can't remember if I was able to get the .Net Random.Next to work in VBA or not. We have used some .Net routines. e.g.
Code:
'http://www.vbaexpress.com/forum/showthread.php?48491Function ArrayListSort(a As Variant, Optional bAscending As Boolean = True)
With CreateObject("System.Collections.ArrayList")
Dim cl As Variant
For Each cl In sn
.Add cl
Next
.Sort 'Sort ascendending
If bAscending = False Then .Reverse 'Sort and then Reverse to sort descending
ArrayListSort = .Toarray()
End With
End Function
For the ++ increment, we use i=i+1 sort of thing in VBA.
Of course you could always make that into a DLL and use it in Excel. I have shown how to do that for a short vb.net example.
http://www.vbaexpress.com/forum/show...-via-vba-macro