"Scott M." <s-> wrote in message
news:%...
> Why take ticks (long) and cast as a string only to cast it back to an
> Integer?
> Why take only the right 8 chars and not the whole value?
>
> Dim myRandom As New Random(CType(Now.Ticks, Integer))
>
> dim theNumber as Integer = myRandom.Next
>
> >>
> > I don't know if this is best or not but I use (this is for a random
number
> > in string format) Also you can change the 8 to a higher number for a
> > larger
> > random number.
> >
> > Dim strID as string = DateTime.Now.Ticks.tostring()
> > Dim rdm1 as Random
> > rdm1 = new Random(ctype(right(strID,
,int32))
> > strUnique = rdm1.next().tostring()
> >
> >
>
Also, the help on Random says
However, if your application runs on a fast computer the system clock might
not have time to change between invocations of this constructor; the seed
value might be the same for different instances of Random. In that case,
apply an algorithm to differentiate the seed value in each invocation.