Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Random values

A topic by razetime created Dec 10, 2023 Views: 67 Replies: 1
Viewing posts 1 to 2

I was looking at a way to generate random values and I couldn’t find docs of all the overloads of random[x y]. Lilt manual says that it takes y random values from x, but it needs to mention that:

  • it will use range x if x is an integer
  • it will pick one random value from x if y is omitted
Developer(+1)

From the Decker reference manual, Built-In Functions, footnote 6:

The behavior of random[x y] depends on the type of x and whether or not y is provided:

  • if x is a number, treat it as if it were range x.
  • if x is anything else, choose random elements from it.
  • if y is missing, the result will be a single random element.
  • if y is positive, choose a list of y random elements.
  • if y is negative, choose a list of |y| random elements without repeats, provided sufficient elements in y.