Hacker News new | past | comments | ask | show | jobs | submit login

That sucks.

I was thinking of ways to prevent that, but without adding a bunch of ifs it kind of kills the minimalistic approach of the original code.




You can have an outer loop that checks how many pixels are set in the avatar and keeps trying to generate a new avatar with a different seed until it's not (rejection sampling). As long as the probability of the avatar being too empty is small it should be fast.


The main problem is probably the color, maybe somehow capping the maximum brightness would be doable.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: