Easy · Math

Random number

Given integers minVal and maxVal in [−10⁹, 10⁹] (in either order) and a signed 64-bit seed, return an integer chosen uniformly at random from their inclusive range using a generator seeded with seed, so the same inputs always give the same result.

Examples

Example 1

[3, 8] seed 7

Output: pick = 5

Example 2

[10, 4] seed 42

Output: pick = 9

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Math problems