Skip to content

Call rnd(table) to get a random table element#14

Open
andrewedstrom wants to merge 1 commit intowh0am1-dev:gh-pagesfrom
andrewedstrom:patch-1
Open

Call rnd(table) to get a random table element#14
andrewedstrom wants to merge 1 commit intowh0am1-dev:gh-pagesfrom
andrewedstrom:patch-1

Conversation

@andrewedstrom
Copy link
Copy Markdown

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].

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](https://www.lexaloffle.com/pico-8.php?page=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].
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant