Jump to content

copy stamping, rand() and probability


Recommended Posts

hi every one, i've a question about the rand() expression fonction.

I use it in a classic copy stamping context.

my "template" is a simple grid and "my primitive to copy" input is plug to a switch node who have many differents input (here 12).

the expressions i used to control switch stamping is :

int(fit(rand($PT),0,1,0,12))

a 10*10 points grid gives me this.

copybigc.jpg

the result is pretty good to me. all the switch input are present. Every inputs haves between 6% and 12 % chance to be present. it's exactly what i need.

now

a 4*4 points grid gives me this.

copysmall.jpg

here come my problem.

i'm agree with the fact that some input appears more than one time. But why some inputs are so present (here the a11 input).

Here 6 input are not used and the a11 input made 31% of the all thing.

Is there any math\expression genius who can help me to get a more "spread" result when my template have a low point count.

thanks a lot for your help.

Link to comment
Share on other sites

I think it would be the easiest to just change your seed value.

rand($PT * 123)

Then you can change the number around until you are happy.

Hope that helps,

Jason

you right, i try a lot of differents seed value and one give me the result i need.

I was thinking to something more "cartesian" but i'm completly happy with this.

thanks for tips and quick reply ;) .

Link to comment
Share on other sites

An alternative thing you could do, if you just want randomization and don't really care about it being a purely randomized distribution, is you can just use a Sort SOP to randomize the point order and then just stamp $PT % (number of choices).

.

thanks graham, your way is just perfect and more flexible for my asset. I think i will use $PT % a lot of time now.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...