> For the complete documentation index, see [llms.txt](https://simpldb.js.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://simpldb.js.org/v2.11.0/documentation/collection/random.md).

# .random()

Returns one or more random entries from the collection.

### random(amount)

| **Parameter** | **Default** |                                                                          **Description**                                                                         |
| ------------- | ----------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| amount        | `1`         | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a> (optional)</p><p>Number of entries to return</p> |

| **Returns**                                                                                                                                                                                                                             | **Description**                                                                            |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [Data](https://simpldb.gitbook.io/docs/types-and-interfaces/data) \| [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Data](https://simpldb.gitbook.io/docs/types-and-interfaces/data)> | A single random entry, if the provided parameter is equal to 1, or multiple random entries |

```javascript
// Note: Users is a collection.

Users.get(); // [{ name: 'John' }, { name: 'Michael' }, { name: 'Peter' }]

Users.random(); // { name: 'Michael' }
Users.random(2); // [{ name: 'John' }, { name: 'Peter' }]
```
