[[Math.random (JavaScript)|Math.random]]を使う。 ```ts function hit(percent: number): boolean { return Math.random() * 100 <= percent } console.log(hit(50)) ```