> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/js/val/prim/num/random/randomint.md).

# randomInt()

[🔰 JS](/web/js.md) ⟩ [Functions](/web/js/val/func.md) ⟩ [Global](/web/appendix/custom.md) ⟩

{% tabs %}
{% tab title="randomInt( )" %}

```javascript
// ⭐️ syntax:
//    randomInt(min, max)
// ⭐️ examples:
//    randomInt(0, 255)    // choose from 0 ... 255 (included)
export function randomInt(min, max) {
  return Math.floor(Math.random()*(max-min+1)) + min;
}
```

{% endtab %}

{% tab title="📗 參考" %}

{% endtab %}

{% tab title="⬇️ 應用" %}

* [randomPassword()](/web/appendix/custom/custom-functions/random-password.md)
* [randomColor()](/web/appendix/custom/custom-functions/randomcolor.md)
* array.[random()](/web/js/val/builtin/arr/ext/random.md)
  {% endtab %}
  {% endtabs %}
