http://qs321.pair.com?node_id=1065851

BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:

I'm testing an algorithm involving 2D coordinate pairs. I've been generating random datasets like this:

my @points = map[ int( rand 500 ), int( rand 500 ) ], 1 .. $N;

Which is okay as far as it goes, but being pseudo-random, tends to pretty equally distribute the points throughout the 2D plane.

But the worse case scenarios for the algorithm are when you get a bunch of points grouped in one place and then a few outliers far away. Either in another bunch, or widespread.

I could generate a point; generate a bunch around that point (using a subrange of the coordinate space, and then fully randomly add a few more, b u u t... that doesn't seem kosher.

So, any thoughts on a 'better way'?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.