Weighted Random Number
Peter W A Wood
peterwawood at gmail.com
Sun Mar 3 21:54:47 EST 2013
A simple method might be:
1. Select a random number between 25 and 200
2. Select a random number between 25 and the random number selected in step 1.
This should result with the median of the numbers closer to 25 than 200. You could repeat step 3 again if you want to shift the median even nearer to 25.
It may not be mathematically correct but it does seem to offer the benefit of being easy to code :-)
On 4 Mar 2013, at 10:14, Roger Guay wrote:
> 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...
> On Mar 3, 2013, at 7:03 PM, Scott Rossi <scott at tactilemedia.com> wrote:
>> There may be a better mathematical method, but I suppose I would start
>> with the loc of the screen and add some small random offsets to the loc.
>> Then at random times when the loc is calculated, I would add some major
>> offsets to the center loc. In this way, the center loc is always favored.
>> Of course, I don't know how you're going about the calcs, so this may not
>> work for your situation.
>> Scott Rossi
>> Creative Director
>> Tactile Media, UX Design
>> On 3/3/13 5:46 PM, "Roger Guay" <irog at mac.com> wrote:
>>> I suspect this is easy, but I'm not coming up with anything. Can anyone
>>> tell me how to get weighted random numbers in LC? Say I want to position
>>> something on the screen randomly but favor the center of the screen. Any
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode