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.
19 lines
524 B
19 lines
524 B
|
4 years ago
|
function oneOf(collection) {
|
||
|
|
return collection[Math.floor(Math.random()*collection.length)];
|
||
|
|
}
|
||
|
|
|
||
|
|
function playSound(sound, extension = null) {
|
||
|
|
let audio = new Audio('/timetrack/assets/audio/' + sound + (extension ?? '.mp3'));
|
||
|
|
audio.play();
|
||
|
|
}
|
||
|
|
|
||
|
|
function getRandomID() {
|
||
|
|
let text = '';
|
||
|
|
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||
|
|
|
||
|
|
for (let i = 0; i < 10; i++) {
|
||
|
|
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||
|
|
}
|
||
|
|
return text;
|
||
|
|
}
|