Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Truly Random" isn't actually random? #144

Open
bryc opened this issue Mar 2, 2021 · 1 comment
Open

"Truly Random" isn't actually random? #144

bryc opened this issue Mar 2, 2021 · 1 comment
Labels

Comments

@bryc
Copy link

bryc commented Mar 2, 2021

randomColor({hue: 'random',luminosity: 'random',count: 54});

More of a pet peeve than an severe issue: On the demo page, you have the above code for Truly Random colors, but it produces dark colors more often than not, so it appears biased and/or constrained to certain saturations and luminosities (which means its not truly random).

Comparison of randomColor on the left, to fully random RGB values (on the right).

image

@davidmerfield
Copy link
Owner

Hmm, good catch, I had wondered that myself. I'm not sure why this is happening, it should picking between 0 and 100 for both Saturation and Brightness in the HSB color space. Will investigate.

Code for Brightness: https://github.com/davidmerfield/randomColor/blob/master/randomColor.js#L172-L174
Code for Saturation: https://github.com/davidmerfield/randomColor/blob/master/randomColor.js#L129-L131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants