Misc

Generate Random Numbers

0calls
Free

Need a single random number, or a string of unique decimals? This endpoint covers both.

Overview

This is a flexible random-number generator. You can specify the range (min/max), how many numbers to generate, whether duplicates are allowed, and whether to generate decimals (with a configurable number of decimal places).

Flow

Diagram

Things to know

Warning

Constraint when duplicates are disabled When allow_repeat=false, make sure the value range (max - min + 1) is greater than or equal to the requested count. Otherwise the API cannot produce enough distinct numbers and the request will fail with a 400 error.

Query parameters

min
integeroptional

Minimum value of the generated random number (inclusive).

max
integeroptional

Maximum value of the generated random number (inclusive).

count
integeroptional

How many random numbers to generate.

allow_repeat
booleanoptional

Whether duplicate values are allowed in the generated set.

allow_decimal
booleanoptional

Whether to generate decimal (floating-point) numbers. When false, only integers are produced.

decimal_places
integeroptional

When allow_decimal=true, controls the number of decimal places.

Response

200 / OK

Generation succeeded. Returns an array of random numbers.

JSON

400 / Bad Request

Invalid request parameters. For example, min is greater than max, or duplicates are disabled but the requested count exceeds the number of distinct values that can be generated.

JSON