I’m facing this situation where I have an ID which comes from a database (so it can be 1, 100, 1000, …) and I need to generate random colors, however equal ID’s should result in the same color.
Any suggestion on how I can achieve this?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use a cryptographic hash and clip the bytes you don’t need:
The resulting (code to generate it) looks like this for the numbers 0-20: