trigger evaluation tree construction leads to unexpected behavior with random()

Issue #67 new
Mitch Sundt
created an issue

If you have a simple form with 3 random fields: <model> <instance> <data id="rtest"> <r1/> <r2/> <r3/> </data> <bind calculate="random()" nodeset="/data/r1" type="decimal" /> <bind calculate="random()" nodeset="/data/r2" type="decimal" /> <bind calculate="random()" nodeset="/data/r3" type="decimal" /> </model>

Then the trigger expression construction algorithm incorrectly consolidates the random() calls so that only one call to random() is made, and r1, r2 and r3 are all equal.

The work-around is to add pointless arithmetic to the calculation, which subverts the trigger expression tree algorithm:

<bind calculate="random() + 0.1 - 0.1" nodeset="/data/r1" type="decimal" /> <bind calculate="random() + 0.2 - 0.2" nodeset="/data/r2" type="decimal" /> <bind calculate="random() + 0.3 - 0.3" nodeset="/data/r3" type="decimal" />

Comments (1)

  1. Log in to comment