3 ms·
It's a funny one. On the first look it looks that random is broken then you realize, no random(n) is a random value between [0;n) so it's behaving exactly righ
by dathinab 3y ago
It's a funny one.
On the first look it looks that random is broken then you realize, no random(n) is a random value between [0;n) so it's
behaving exactly right.
It also shows really nice how "naively" choosing random points in a non rectangular shape can easily lead to a non uniform distribution.
- CyberDildonics 3y agoIt's still a uniform distribution of points, it's being warped by converting to a non uniform space and back to a uniform space.
- hgsgm 3y agoIt's not a uniform distribution of points after the warping. I'm pretty sure every bounded distribution over a compact space is uniform under some warping.
- hot_gril 3y ago> Provides interestingly titled code example "random(random(...." > Accidentally(?) shows nonuniform-looking distribution of points from uniform random() due to polar coordinate conversions > Shows effects of nesting random calls in a way reminiscent of security papers showing design flaws, but it's not really showing that > Refuses to elaborate further The more I think about this, the better it is. The imperfection is what makes this little bit of code so interesting to us nerds, while even trolling some people, but we have no idea what the intent was. It's great.