Random

From Fancade Wiki
Revision as of 19:08, 16 May 2024 by Nikitaivanov (talk | contribs) (Created page with "A number randomizer. File:Random1.png Inputs: * Min: The minimum amount the block chooses from. * Max: The maximum amount the block chooses from. Outputs: * Random: The randomly selected number. == Notes == * The Min input is included while the Max input is *excluded*, meaning: if the min and max inputs are 0 and 5 respectively, it may generate a number within 0 to 5, possibly 0, but never 5. * The random block will generate a new value every time it is exe...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A number randomizer.

File:Random1.png

Inputs:

  • Min: The minimum amount the block chooses from.
  • Max: The maximum amount the block chooses from.

Outputs:

  • Random: The randomly selected number.

Notes

  • The Min input is included while the Max input is *excluded*, meaning: if the min and max inputs are 0 and 5 respectively, it may generate a number within 0 to 5, possibly 0, but never 5.
  • The random block will generate a new value every time it is executed. To reuse the same random value, it should be stored in a variable.
  • Note that the output would be in decimal, to avoid this use floor, ceiling, or round operators.
  • The random block behaves inconsistently when used with wire splits. /uploads/inconsistent-random.jpg

Examples

Either generate -1 or 1:

File:Screenshot 2020-06-23-23-24-42-333 com.martinmagni.fancade.png


File:Screenshot 2023 0327 105551.png