Easy · Math

Random number

Given two integers minVal and maxVal (in either order) and an integer seed, return an integer chosen uniformly at random from the inclusive range between them, using a random 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

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Math problems