I need to generate random number in specific range for postman. I wonder if there is possible to generate it and to use it in variable in postman, from what I saw at postman site is:
{{$randomint }}
will give random number between 1-1000 and I already tried to do something like this:
{{$randomint(1,5)}}
to get number between 1-5 but postman didn't get this kind of option, so how to specify range for the random in postman?
You can just use
Lodash
for this as it's a built-in module:Or just add the number
5
to the_.random()
function and this will be a number from 0 to 5.This worked for me:
In your Pre-request script define your variable with:
Then in your URL call your variable in the URL like so:
Hope this works for you.