Skip to content

Instantly share code, notes, and snippets.

@bonsak
Last active November 11, 2017 15:16
Show Gist options
  • Select an option

  • Save bonsak/f987259d8e778c8d05723d665591f0e7 to your computer and use it in GitHub Desktop.

Select an option

Save bonsak/f987259d8e778c8d05723d665591f0e7 to your computer and use it in GitHub Desktop.
Houdini Vex Randomize point numbersFrom https://www.sidefx.com/forum/topic/52579/?page=1#post-236410
// Run in a detail wrangle. Added .h to get syntax highlighting
i[]@index;
int rand;
vector newpos;
int succ;
// create a simple ordered array
for (int i=0; i<@numpt;i++){
@index[i] = i;
}
// set new point position from a random array index and shrinking the array for each iteration so we only select unused indexes.
for (int i = 0; i < @numpt; i++){
rand = int(fit01(rand(i + chf('seed')),0 ,len(@index)));
newpos = pointattrib( 0, 'P', pop(@index, rand), succ );
setpointattrib(0,'P', i, newpos);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment