Refactor Maps (#2)
This commit is contained in:
@@ -44,6 +44,14 @@ export function hypotenuse(a, b) {
|
||||
}
|
||||
|
||||
export function random(min, max) {
|
||||
if (Array.isArray(min)) {
|
||||
return min[random(min.length - 1)];
|
||||
}
|
||||
|
||||
if (typeof min === 'object') {
|
||||
return min[random(Object.keys(min))];
|
||||
}
|
||||
|
||||
if (max == null) {
|
||||
max = min;
|
||||
min = 0;
|
||||
|
||||
Reference in New Issue
Block a user