mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-03-24 08:07:15 +01:00
14 lines
371 B
TypeScript
14 lines
371 B
TypeScript
/**
|
|
* @param min Inclusive
|
|
* @param max Exclusive
|
|
*/
|
|
export const getWeakRandomInt = (min: number, max: number) => {
|
|
if (min >= max) {
|
|
throw new RangeError(
|
|
`The value of "max" is out of range. It must be greater than the value of "min" (${min}). Received ${max}`,
|
|
);
|
|
}
|
|
|
|
return Math.floor(Math.random() * (max - min) + min);
|
|
};
|