Weighted Random Number
Roger Guay
irog at mac.com
Mon Mar 4 10:05:54 EST 2013
I want to thank Paul, Peter, Dunbar, Jacques and Scott for helping me with this problem. I now have enough to keep me out of your hair for months!!
Thanks and cheers,
Roger
On Mar 3, 2013, at 7:27 PM, Paul D. DeRocco <pderocco at ix.netcom.com> wrote:
>> From: Roger Guay
>>
>> Thanks, Scott. I'm not sure I follow what you're saying, so
>> let me expand on what I'm trying to do: I want a number (25
>> to 200) of objects randomly positioned on the stack/window
>> but favoring the center of the stack/window. Would your
>> described method do this for me? Sorry for being slow...
>
> You need to devise a simple mathematical function that translates the range
> of the basic random number generator into the appropriate range, with a
> curve that has a greater slope at the extremes than in the middle.
>
> First, generate a random number with a reasonably big range, subtract the
> midpoint of the range to get a bipolar value, and then compute a third-order
> polynomial. The zeroth-order coefficient should be the middle pixel value of
> the screen, the second-order coefficient should be zero to make it
> symmetric, the first-order should be small enough that by itself you'd get a
> range that covers only a small portion of the screen, then the third-order
> should be sufficient to cover the full width of the screen. You can fiddle
> the first- and third-order coefficients to adjust the weighting.
>
> --
>
> Ciao, Paul D. DeRocco
> Paul mailto:pderocco at ix.netcom.com
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list