Jump to content

Why Are My Random Numbers Not Random?


pabush20

Recommended Posts

Ok, here's the scene. I'm making a precedural house of cards. The location of each card is controled by point locations on a line, with the cards then instanced to the points to make the house. Works well enough.

Now what I want it to assign random textures to the cards. I dug through some of the old posts here, and found a method that SHOULD work.

In the Object level, I've created 9 geo objects, each with a basic card and a different color texture. In the point node for each line, where the card is instanced in, I've put an expression that picks a random card for each point on the line:

/obj/card`rint(rand($PT)*8)+1`

Is the expression I'm using. I have a total of nine textures to choose from. Now I know that since the random number seed is based on the point number, and since that each line starts at point 0, each line would generate the same pattern of cards, since then have the same point numbers. To counter that, I offset the points on each line by differing amounts. Even with that, the results i'm getting are FAR from random:

lolrandom.jpg

Out of the nine possible choices, Houdini picked FIVE, and picked them in patterns.

Here, I used this expression:

/obj/card`($PT%8+1)`

Same offset point numbers.

I get this lovely, patterned output.

lolrandom2.jpg

What am I doing wrong?

Edit: nevermind, I'm stupid. I realized why its not working. Someone can delete this. I just shifted the points, not renumbered them. Back to the drawing board.

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...