Smart way of creating a random sample for process instances?

Hi everyone,

i am currently building a process in which x% of process instances need to be reviewed in a user task. Imagine something like shown in the screenshot:

Now my first guess is to just define a service task that marks a process instance with a probability of X% by adding a variable like “sample: true” to the process instance.

However, I am asking myself if there is a smarter way to do such a randomized sampling in Camunda?

Edit: I forgot to mention that currently I am working in Camunda 7 :slight_smile:

Best regards

Might be easier to an expression to one of the squence flows which returns true ~x% of the time. Then have the other sequence flow be the defult flow.

In javascript, if you wanted something to return true 25% of the times it would eb something like

 Math.random() < 0.25 

Hi @Niall ,
thanks for your reply! I managed to get to the goal by changing my diagram as suggest by you:

Best regards

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.