You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
513 B
15 lines
513 B
const random = {
|
|
bool: (weight) => Math.random() < (weight || 0.5),
|
|
color: () => `rgb(
|
|
${Math.floor(Math.random() * 230)},
|
|
${Math.floor(Math.random() * 230)},
|
|
${Math.floor(Math.random() * 230)}
|
|
)`,
|
|
id: () => String.fromCharCode(
|
|
random.num(65, 90), random.num(97, 122), random.num(97, 122),
|
|
random.num(97, 122), random.num(97, 122), random.num(97, 122)
|
|
),
|
|
num: (min, max) => min + Math.round(Math.random() * (max - min)),
|
|
};
|
|
|
|
export default random;
|
|
|