Skip to content

Random Numbers

In your interactive projects, a touch of unpredictability can make the experience more engaging and varied. With PandaSuite, two complementary tools let you add surprise to your scenarios: the Random Number variable and the Shuffle function.

Why use random mechanisms?

Randomness is useful for:

  • Varying the content displayed on each launch.
  • Offering unique experiences to each user.
  • Simulating random behaviors (draws, games…).
  • Shuffling elements of a list or a group.

In PandaSuite, this is achieved thanks to:

  • The Random Number variable, which generates a floating-point number between 0 and 1.
  • The Shuffle function, which randomly rearranges the order of a list or group of elements.

The Random Number variable

What is it?

The system variable Random Number generates a new value on each refresh.
It returns a decimal number between 0 and 1 (for example: 0.274 or 0.859).

This value can then be used in logical conditions, calculations, or displayed directly.

How to use it?

You can insert the Random Number variable in your scenarios to:

  • Compare this value to a threshold (example: if > 0.5…).
  • Multiply this value by an integer to get a range (example: Random Number × 5 gives a value between 0 and 5).
  • Create random effects without complex calculations.

💡 To get an integer between 1 and N, use the following formula: Round(Random Number × N) + 1

Example: display a random card

  • Create a Collection containing all your cards.
  • On the button, trigger an action to set the value of a variable random_index
random_index = Round(Random Number × (Count-1)) + 1
(where Count is the number of cards in the collection)
  • Dynamically display the corresponding card based on the value of the random_index variable.
Action to randomly set a card

The Shuffle function

The Shuffle Function

The Shuffle function allows you to randomly rearrange the order of elements in a Table or a Collection.
If applied to a Table, it returns a Table.
If applied to a Collection, it returns a Multi-reference.
You can also set a limit to control the number of elements returned.

How to use it?

  1. Place the elements you want to shuffle in a Collection.
  2. In this example, create a Multi-reference variable that points to this Collection.
  3. Add an action to initialize this newly created variable.
  4. In the Value, start from your collection and use the Shuffle function.
  5. In the Parameters, specify the number of elements to include in the shuffled result.
Action to randomly arrange a collection

Use cases

  • Shuffle quiz questions.
  • Reorder images or cards for a memory game.
  • Create dynamic lists or carousels.

Additional resources

Random Cards

Add this template to your account in just a few clicks. Edit and customize it freely.

→ Add this template to your account