Skip to content

STL Random

TheRealMichaelWang edited this page Jun 30, 2021 · 2 revisions

STL random.min

The code found in this file implements a few wrapper methods around extern random to facilitate random number generation.

Usage

Type include "random.min" to include this library. If that isn't working, please make sure that:

  • The unzipped contents of stl.zip are placed in the working directory of minima.exe.
  • Your version of minima is up to date.

Some Examples

include "random.min"

rem Generates a random numerical between 1 and 100
extern printl(goproc random(0, 100))

rem Generates a random value that is 1 or 0. 
extern printl(goproc randbit)

rem Selects a random element of a collection/array and returns it.
extern printl(goproc select_random({"Hello!", "Hi!", "Greetings!"})

Procedures

Identifier Expected Arguments Functionality
random min, max Generates a random number greater than or equal to min and less than max.
randbit Returns a random value that is either true/false.
select_random array Selects a random element from array and returns it

Clone this wiki locally