k y m a • t w e a k y — the kyma collective || view the current website || February 2015 Archive

/ WebHome / How.GetTwoRandomNumbers

Search


How Section


How do I...
Add a question...

Home 
Topics 
More... 

All Sections


Products
Order
Company
Community
Share
Learn

Login / Register 
Change password
Forgot password?
%SESSION_IF_AUTHENTICATED% Site Map
%SESSION_ENDIF%

Symbolic Sound


Home
Kyma Forum
Eighth Nerve

TWiki Links


%SESSION_IF_AUTHENTICATED% TWiki Shorthand
TWiki Formatting FAQ
What is TWiki?
%SESSION_ENDIF% twiki.org

Question (or Task)

How can I ensure that two different random number streams in the same CapyTalk expression are uncorrelated with each other?

Solution(s)

If you use exactly the same expression for generating both streams, the common subexpression eliminator will optimize one of them away and leave you with the same random stream as the result of both subexpressions. To ensure two independent streams of numbers, use a different seed on each, for example:


((!Trigger nextRandomWithSeed: 222) + (!Trigger nextRandomWithSeed: 65)) * 0.5

The expression above would give you a new random number on each !Trigger, from a triangular distribution.

Contrary to expectation, using a seed does not ensure repeatability in CapyTalk expressions. (This is something we'd like to alter in the future).

-- CarlaScaletti - 11 Nov 2005

WebForm
Question: How can I ensure that two different random number streams in the same CapyTalk expression are uncorrelated with each other?
Keywords: seed random CapyTalk? triangular distribution

 
 
© 2003-2014 by the contributing authors. / You are TWikiGuest