I'm developing a C# library with .NET Framework 4.0.
I have a process that generates numbers that must be unique (I can't show you any code because I have signed a NDA).
This algorithm has use DateTime.Now
as part of the number, and it also needs a 7 digit random value.
Now I'm using Random and I get repeated values (I have to generate N values). So, I thought that I can use DateTime.Seconds
and DateTime.Milisecond
, but with both I only have five digits.
How can I make this random value unique?
Maybe I can use DateTime.Ticks
instead.
Aucun commentaire:
Enregistrer un commentaire