kyma•tweaky . How . GetTwoRandomNumbers

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

----- Revision r1.1 - 11 Nov 2005 - 20:36 GMT - CarlaScaletti
Copyright © 1999-2014 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding kyma•tweaky? Send feedback.