Sounds like you want to a number of distributions, from "one big clump" to "almost uniform", at random.

What about generating several "poles" as clump attractors, each with a random weight for attractiveness. Then let each point "roll" down hill according to the attractor weights and distances. So generate 3D coordinates, and use the extra value as the weight. Something like this:

for my $trial (1..$max_trials) { my @attractors; for my $attractors (1..int(rand($max_attractor))+1) { my @attractor = get_random_tuple(3,\@attractor_limits); push @attractors, \@attractor; } my @grid_points; for my $points ($min_points..$max_points) { my @point = get_random_tuple(2,@grid_point_limits); # $alpha limits the distance moved downhill, and could be rand +om @point = roll_down_hill(\@point, \@attractors, $alpha); push @grid_points, \@point; } my $result = analyze_data(\@grid_points); } sub get_random_tuple { my $size_of_tuple = shift; my $limits_ref = shift; my @tuple; for my $limit (@$limits_ref) { push @tuple, rand($limit); } return @tuple; } sub roll_down_hill { # left as an exercise for OMAR! }

You can also play with variations of roll_down_hill to try different distributions, going from sub-linear to exponential (or maybe some of each), trying a host of different functions for transformations. And don't forget you can play with the distributions wherever you take a random number, including the number of attractors and their weights. For instance, you might find that fewer attractors are more likely to cause worst case behavior, and bias the number of attractors in the small direction.

-QM
--
Quantum Mechanics: The dreams stuff is made of


In reply to Re: Randomly biased, random numbers. by QM
in thread Randomly biased, random numbers. by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.