I have a system where tens of thousands of users log in whenever they like and my server has to assign them to one of many databases. I would like to distribute the users evenly amongst the databases. I was thinking of using one of two methods, and cannot decide which will give me a more even distribution:
- RAND_bytes from OpenSSL modulo number of databases.
- Current Timestamp (in seconds) modulo number of databases.
The first option relies on RAND_bytes and the second relies on the Law of Large Numbers.
Users log in mostly during certain peak hours.
Which one will give me a more even distribution?