different random values for (seemingly) identical seed

   1294   2   0
User Avatar
Member
2 posts
Joined: Dec. 2018
Offline
Hello everyone,
I am using a attribute wrangle node to move some points randomly. Points with the same y value however should be moved the same amount. To achieve this I feed @P.y into the rand() function.
Unfortunately this gives me different values for some of the points and I don't understand why. I saved the seed and rand() values as attributes to the points to look at them. This is the code I used:

f@seed = float(@P.y);
f@rnd = rand(@seed);

I attached the out
Image Not Found

come

Attachments:
Capture.PNG (22.9 KB)

User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
interesting, can you provide the hip file?
User Avatar
Member
8605 posts
Joined: July 2007
Online
with float values you can hardly be sure they are the same
and on top of that Geometry Spreadsheet rounds the values so you don't even see the real ones
maybe try rounding your seed before using in rand function to be on the safer side
float seed = @P.y;
seed = rint(seed*100000)/100000;
f@rnd = rand(seed);
Edited by tamte - May 29, 2019 09:55:37
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links