*My question*: I would like to generate a random number in the given range.

For eg: I would like to generate a value between 234545 and 5565756

*I’ve already tried*: YES

*My question*: I would like to generate a random number in the given range.

For eg: I would like to generate a value between 234545 and 5565756

*I’ve already tried*: YES

Hello there,

to generate a random number between 234545 and 5565756, you can do like this.

```
function randInt(min, max) {
return Math.round((Math.random() * Math.abs(max - min)) + min);
}
console.log("Random integer: " + randInt(234545, 5565756));
```

I hope it’ll help you.

Best Regards,

Rishi Purwar

2 Likes

Thank you for your quick reply

2 Likes

@tulasi Welcome to the Community

You can create function like below,

```
let min = 234545;
let max = 5565756;
// for generating random number
function randomNumber(min, max) {
return Math.random() * (max - min) + min;
}
console.log(Math.round(randomNumber(min, max)));
```

to reuse it

Else you can directly use

```
console.log(Math.round(Math.random() * (5565756 - 234545) + 234545));
```

And assign this to another variable as per your needs

1 Like

Thank you very much for your quick support. I am new to PostMan

1 Like