How to get random enumeration value

0
In microflow value expression, how can I retreive a random enumeration. I have an enumeration called colors and I want to pick a random one.
asked
1 answers
4

you could generate a random number with random() (see https://docs.mendix.com/refguide/mathematical-function-calls) and then use an exclusive split to pick an enumeration value. The random number generation could look like follows: 

round(random() * 10).

this should generate a number between 0 and 10 [Disclaimer: I haven't tested that]

E.g. if randomNumber = 0 

then Enum.Red

else if randomNumber = 1

then Enum.Blue etc. 

answered