2024-07-06 20:21:35 +00:00
|
|
|
export class Random {
|
|
|
|
static chance(odds) {
|
|
|
|
return Math.random() < odds;
|
|
|
|
}
|
2024-07-06 21:28:51 +00:00
|
|
|
|
|
|
|
static under(num) {
|
|
|
|
let n = Math.random() * num;
|
|
|
|
console.log("under", num, n);
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
static between(lo, hi) {
|
|
|
|
let n = Math.random() * (hi - lo) + lo;
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
static radians() {
|
|
|
|
return Math.random() * Math.PI * 2;
|
|
|
|
}
|
2024-07-06 20:21:35 +00:00
|
|
|
}
|