Easy Random Numbers Come To Flow

So I was reading this thread that mentioned random numbers, and then I read this great post about building a Blackjack game out of flow, and the Monty Python-caliber dry humor (which may or may not be intentional; I haven’t figured that out yet) about the complicated math necessary to generate pseudo-randomness. And then I thought about how easy it is over in Apex-land to generate random numbers, so I built a Flow Action you can install into your org that takes two values and generates a true random number in that range.

Check it out here.

0 0 vote
Article Rating
Subscribe
Notify of
guest
2 Comments
Inline Feedbacks
View all comments
Raz Gat
Raz Gat
23 days ago

Hi Alex, this is great! Any ideas how I can prevent numbers from repeating themselves?

Alex Edelstein
Admin
23 days ago
Reply to  Raz Gat

You could use Flow collection actions to store the numbers in a Collection of Numbers and then, each time a new number is generated, use Find Record In Collection to see if the number is already in the collection. If you needed the collection to persist across runs, you’d need to save it to some record field somewhere. https://unofficialsf.com/list-actions-for-flow/