VEX rand() and VOP random

   8780   2   0
User Avatar
Member
509 posts
Joined: July 2005
Offline
.. are they supposed to give different result .. given the same seed?

I “translated” the following simple VEXpression (i love to call 'em this way!! eheh)

$TX+($VX*rand($F*$PT)))/20


into a VOPsop …

but I have slightly different result when I compare point positions….
JcN
VisualCortexLab Ltd :: www.visualcortexlab.com
User Avatar
Staff
2593 posts
Joined: July 2005
Offline
sum][one
.. are they supposed to give different result .. given the same seed?

I “translated” the following simple VEXpression (i love to call 'em this way!! eheh)

$TX+($VX*rand($F*$PT)))/20


into a VOPsop …

but I have slightly different result when I compare point positions….

The VEX random() is different and only looks at the integer component of the seed (providing more platform-independent consistent results).

The hscript rand() function takes a floating point number as a seed and hashes this. However, from compiler to compiler or platform to platform, the results may (though not usually) be different.

VEX also has the hscript_rand() function which uses the exact same floating point hashing that the hscript() expression function uses. It should provide the same results.
User Avatar
Member
509 posts
Joined: July 2005
Offline
Thanks a lot for your explanation
now it makes sense.
JcN
VisualCortexLab Ltd :: www.visualcortexlab.com
  • Quick Links