In [[k6 (tool)|k6]], you can use [[Dynamic think time in js]] to create a think time that varies randomly between set values:
```js
sleep(Math.random() * 4);
```
## Random int between
There is also an available function called `randomIntBetween()` in the k6 js library, which makes sure that the number returned is an integer between two other integers.
To use it, first import the function:
```js
import { randomIntBetween } from "https://jslib.k6.io/k6-utils/1.0.0/index.js";
```
Then, use it in the script like this:
```js
sleep(randomIntBetween(1,5));
```
The line above will cause a delay from 1 to 5 seconds, inclusive.