pico8-api icon indicating copy to clipboard operation
pico8-api copied to clipboard

Call rnd(table) to get a random table element

Open andrewedstrom opened this issue 4 years ago • 0 comments
trafficstars

As of 2.0.0, you can call rnd with a table as the argument to get a random element from the table.

This PR adds that to the tables tab.

From the PICO-8 manual:

	rnd x
		Returns a random number n, where 0 <= n < x
		If you want an integer, use flr(rnd(x))
		If x is an array-style table, return a random element between table[1] and table[#table].

andrewedstrom avatar Jan 28 '21 23:01 andrewedstrom