Hey all,
Sorry if this has been covered, could not find it.
I'm using particles and the Instancer feature to scatter geometry around. I have three different source meshes and I created my own UserScalarPP value that use use as my index value. This value is used to choose which of these three meshes will be used for that specific particle.
0 = mesh1
1 = mesh2
2 = mesh3
Here's my question. How do I get a random feature which should give me an even distribution of probabilities between these three integers?
particleShape1.userScalar1PP = rand(0,2); <- This just gives me a float between 0.00-2.00, which is convereted? to an integer. It does work, but is far from even when it comes to probability.
I've tried the usage of +0.5 together with the Floor() command, but that doesn't give an even probability either right?
Thanks!
Replies
could do 0,2.999999 or to make sure you never get 3
is there no integer rand? then you could just do rand() % 3;
So floor(rand(0,3) would work right? Floor will round downwards to the nearest integer right?
Or even floor(rand(0,2.99999).
CrazyButcher> I tried searching for an integer rand earlier, but couldn't find one.
EDIT:
Tried it out this morning and seemed to work good at glance. I did not do any exact measuring though.