Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: One-shot random



I would like to have a composition that chooses a random number ONLY ONCE, when it's first started.

Using the "Random" object results in a new random being generated every time a frame is drawn. How can I make sure the first number that is chosen is "frozen"?

Thanks,
-Michael.


You could use a JavaScript with one output and two inputs that looked something like this:

if (outputs[0]==undefined){
    outputs[0]=math.random*(inputs[1]-inputs[0])+inputs[0]
}

This will set the random output to a number between the inputs on the first run and nothing after that.

        Alfred
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden

This email sent to email@hidden
References: 
 >One-shot random (From: Michael Kertesz <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.