Random

choice


(let choice (fun (_L) (...))) Select a random element from a list

Note: If the list is empty, returns nil

Parameter

  • _L: list of elements

Author

@SuperFola

Example

(import std.Random)
(print (random:choice [1 2 3]))

shuffle


(let shuffle (fun (_L) (...))) Shuffle a given list

Note: The original list is not modified

Parameter

  • _L: list to shuffle

Author

@SuperFola

Example

(import std.Random)
(let data [1 2 3 4 5])
(let randomized (random:shuffle data))