On 12/9/19 8:54 PM, Dennis Lee Bieber wrote: > On Mon, 9 Dec 2019 18:52:11 -0600, Tim Daneliuk <i...@tundraware.com> > declaimed the following: > >> >> - Each of these services needs to produce a string of ten digits guaranteed >> to be unique >> on a per service instance basis AND to not collide for - oh, let's say - >> forever :)s >> >> Can anyone suggest a randomization method that might achieve this >> efficiently? >> >> My first thought was to something like nanonseconds since the epoch plus >> something >> unique about the service instance - like it's IP? (This is in a K8s >> cluster) - to >> see the randomization and essentially eliminate the string being repeated. >> >> Ideas welcome .. >> > > Well, 10 digits is rather short, but studying > https://en.wikipedia.org/wiki/Universally_unique_identifier might provide > some ideas. > >
For a variety of reasons the length of this string cannot exceed 10 digits. It is believed that - in this application - the consumption of values will be sparse over time. All I really need is a high entropy way to select from among the billion possible values to minimize the possibility of collisions (which require retry and time we don't want to burn). -- https://mail.python.org/mailman/listinfo/python-list