rand ... more random?

   3290   3   2
User Avatar
Member
527 posts
Joined: July 2005
Offline
I am stamping a set of 10 objects along a grid using:

rand($PT)*9


The only problem is the objects are not appearing as random as one would hope! :roll:

Is there something I can change in the expression to help out besides increasing the number of set objects piping into the switch?


ps. I am already using a sort sop to randomize the point numbers of the grid.
soho vfx
User Avatar
Member
2199 posts
Joined: July 2005
Online
Try changing the seed a bit, just using whole number integers isn't too good with the rand function I think.

try

rand($PT/10)*9

see if that helps
The trick is finding just the right hammer for every screw
User Avatar
Member
132 posts
Joined: July 2005
Offline
The rand() function isnt really random like Maya's. It will create a random result once but that random result will be the same until you change the seed. If you have several things you want to randomize, make sure each one has a different seed.

Example:

rand($PT*99.715)*1

rand($PT*71.223)*1

rand($PT*56.3354)*1
User Avatar
Member
4140 posts
Joined: July 2005
Offline
Maya has a truly random call? Are you just talking about non-deterministic generators like the Mersenne Twister, which is a better psuedo-random generator that will give you the same results when called in the same order?

I suspect Simon's answer will sort out Warren's needs, but it's worth noting that truly random number generation isn't of much use in the interactive package. The Twister is implemented, however, in VEX and VOPs - see the nrandom() call.

Cheers,

J.C.
John Coldrick
  • Quick Links