Skip to content
Lists & Helpers chance

$chance — Returns true with the given probability

Returns `true` with the given probability. `$chance[25]` is true one time out of four.

Syntax

$chance[percent]

Parameters

  • percent (number, required) — From 0 to 100.

Return Value

  • true or false.

Usage

$if[$chance[10]==true]Rare drop!$endif

Example

$if[$chance[10]==true]
  $sendMessage[Rare drop!]
$else
  $sendMessage[Common drop.]
$endif

Try it

Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.