Answer the question
In order to leave comments, you need to log in
Generating a random unique sequence of numbers?
Good afternoon, Please tell me
the algorithm for generating random unique sequences of 14 digit numbers, like
84569389558070
65644309975202
73482199181645
37108151186406
17319599862033 It is
necessary to get numbers that do not repeat and are generated on the fly. A small number of collisions is allowed and will be decided at the level of crap in the table. Critical is the speed of generation, uniqueness and non-repeatability.
There should be sooo many numbers, so the option with pre-generation is not suitable for two reasons:
1) a large amount of stored data;
2) pulling out random sequences, without the ability to "predict" the next number
Thank you very much.
Answer the question
In order to leave comments, you need to log in
Thanks everyone, I found this library
https://github.com/NebulousLabs/fastrand
And what, in go there is no call for CSPRNG?
https://golang.org/pkg/crypto/rand/#Int
1e13 + random number from 0 to 1e14
You can try to generate a GUID and take the required number of digits from the end.
According to GIT, the last 6 characters in a commit hash are almost never repeated.
Win has an API, for example this:
https://msdn.microsoft.com/ru-ru/library/windows/d...
Many databases, if you plan to use them out of the box, can generate a GUID.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question