Random Number

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Business Rules > Business rules examples > Perform Math operations >

Random Number


This section describes Bizagi random number functions. These functions are as follows:




Rand (from,to)

This function returns an integer random number between two numbers.




The parameters of this function can be defined as Xpaths, variables or numbers.



Input parameters must be integers.

The supported attribute type to use as input XPath parameter (or Xpaths stored in variables) is integer.

The function returns an error if the ValueFrom is greater than the ValueTo parameter.

Use the IsNaN function to validate the parameters used are numbers.



A company uses Bizagi to raffle different prizes among its clients. Each customer is given a number between 0 and 100. Bizagi must generate a random number between the available numbers to obtain a winner.


To implement this logic you can use the Rand function:




//Generate the winner number

<RaffleProcees.WinnerNumber> = CHelper.Math.Rand(0,100)



This function returns a decimal between 0.0 to 1.0, and it has NO parameters.





Suppose you need to generate a random number between 10 and 20 with two decimal places.

You have to use two functions: one to generate a random number between 10 and 20 and one to generate the decimal places. Then you can add both results.





<Request.RandomNumber> = (CHelper.Math.Rand(10,20))+(CHelper.Math.Rand())