VEX removepoint random / Random with percentage probabilities for different results

   5702   3   0
User Avatar
Member
48 posts
Joined: Feb. 2018
Offline
Hi,
sorry for this question, but how is it possible to remove a single point by a random function with a seed.

removepoint(0,rand(1234)) doesn't work. What must I do?

thanks.
Edited by Christoph_H_ - April 17, 2018 03:51:42
User Avatar
Member
2038 posts
Joined: Sept. 2015
Offline
Two things,

removepoint() takes an integer for its' arguments, rand() returns a float between 0 and 1.


int Unique;

Unique = int( rand(1234) * npoints(geoself()) );
removepoint(0, Unique);
Edited by BabaJ - April 15, 2018 09:09:55
User Avatar
Member
48 posts
Joined: Feb. 2018
Offline
thanks.

In this context, how could I best invert the random selection? So that's exactly what's left?

How can I also extend chance so that no selection is possible or even several?

I really try to do it alone, but I still lack so many techniques and experience.
Edited by Christoph_H_ - April 15, 2018 13:34:49
User Avatar
Member
7749 posts
Joined: Sept. 2011
Offline
If you frame it in terms of probability, instead of in terms of point number, you can get the outcomes of none/several. Also if you use a group instead of removing the points within the attrib vop evaluation, you can get a speed boost as well as easily invert the intention when applying the group to a blast sop.

for example:

float prob = chf('probability');
float seed = chf('seed');
float u = rand(set(@elemnum%65535, @elemnum/65535, seed));
@group_ptgrp = prob > u;

Then either blast ptgrp or !ptgrp, depending on if you want to remove or keep the proportion specified by the probability.
  • Quick Links