Discussion posts and replies are publicly visible
Is there a way to use rand(), to randomly select user from a group?
Yes. You'll need to do this steps:
Hope this helps
Another option is tointeger(rand()*ri!range) . If you're going to be using rand() to pick a random item from a list, you should use tointeger(rand()*ri!range +1) to ensure that you don't include 0 in the results (because when you round 0.1242287 to 1's place you get 0) and you do include the top value of your range. If you don't include the +1 at the end you could find yourself running into errors due to Appian arrays starting at 1.
You may also, depending on the method you use to convert to integer, see Appian rounding up and already including the top number of your range. In that case, you may want to reduce your range by 1 so you don't get 11 in your results on occasion when you want 1 - 10. If it's vitally important that all random numbers be equally likely you may want to refine further how you convert response from rand() to an integer.
Why are you randomly selecting users from a group?
© 2022 Appian. All rights reserved.