what you describe, in general, falls within the: "drawing random samples from a random distribution (RD)". Except that you additionally want to favour certain outcomes more. That can be achieved by transforming your RD. e.g. skew it, squash it, lift the tails, etc., prior to drawing.

Drawing samples from an RD requires you to build the cumulative RD and then land randomly on any 'y'. Corresponding 'x' will be the random sample you need. You have a discrete RD, a histogram. So, build a cumulative histogram, transform the histogram to give better odds to unpopular items and then draw the sample.

I would keep the 2 tasks separately.

3day edit: in the 2nd paragraph swapped 'x' and 'y'. So basically, draw a random number from 0 to 1 this will be the 'y', the spot on the y-axis. The corresponding 'x' will be a random sample wrt this RD.

bw, bliako


In reply to Re: Randomly choosing from a set of alternatives with varying popularity by bliako
in thread Randomly choosing from a set of alternatives with varying popularity by ibm1620

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.