Weighted Random Number

Scott Rossi scott at tactilemedia.com
Mon Mar 4 04:11:23 EST 2013


I'm still a bit unclear about the result you want, but thinking about it
more, I'd guess you want something like a radial orientation of objects
centered on the card.  I'm pretty sure you'd need a logarithmic function
for this, and while I'm not hip to the right way to do it, I cobbled
together an option for fun that seems to come close (via your message box):
go url "http://www.tactilemedia.com/download/random_position.livecode"

Pressing the button creates 200 graphics of random
shape/size/translucency, and
positions them radially near the center of the card.  For me, this looks
acceptable (and like modern art), but as I said, it may not be the result
you're looking for.  You can play with the randomCardPosition function to
change the results.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design




On 3/3/13 6:14 PM, "Roger Guay" <irog at mac.com> 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...
>
>Cheers,
>Roger
>
>
>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.
>> 
>> Regards,
>> 
>> 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
>>> ideas?
>>> 
>>> Thanks,
>>> Roger
>>> _______________________________________________
>>> 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
>>> 
>> 
>> 
>> 
>> _______________________________________________
>> 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
>
>
>_______________________________________________
>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