VEX removepoint random / Random with percentage probabilities for different results

   137   4   0
User Avatar
Member
21 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
935 posts
Joined: Sept. 2015
Online
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
21 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
1224 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.
User Avatar
Member
21 posts
Joined: Feb. 2018
Offline
Thank you very much for your help.

Unfortunately I still have problems for the following configuration:
I tried to use an If loop to add certain percentage probabilities.
I failed, however.

In this case:
a 20 percent probability that he does not select a point.

a 35 percent probability that he selects 2 points.

a 45% probability that he selects 4 points.

The whole thing would have to be subject to a random function with seed.
So far I have the impression that I would have to combine several random functions.
I have no idea how to do this. I also searched the Internet, but found nothing that would have helped me.

Thanks again for your help so far.
  • Quick Links