pucchinglgl/src/randomInt.ts

9 lines
200 B
TypeScript
Raw Normal View History

2020-12-29 03:33:50 +09:00
const { floor, random } = Math;
/** 範囲 [0, high] のランダムな整数を返します */
function randomInt(high: number) {
return floor(random() * (high + 1));
}
export default randomInt;