Last active
August 29, 2015 14:02
-
-
Save tkbremnes/b8f7cbf96aa15d994c26 to your computer and use it in GitHub Desktop.
Random room name generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var randomRoomNameGenerator = function () { | |
// predefine the alphabet used. | |
var alphabet = 'qwertyuiopasdfghjklzxcvbnm1234567890'; | |
// set the length of the room name | |
var roomNameLength = 30; | |
// initialize the room name as an empty string | |
var roomName = ''; | |
// repeat this 30 times | |
for (var i=0; i<roomNameLength; i++) { | |
// get a random character from the alphabet | |
var character = alphabet[Math.round(Math.random()*(alphabet.length-1))]; | |
// add the character to the roomName | |
roomName = roomName + character; | |
} | |
// pre- and append appear.in URL elements | |
roomName = 'https://appear.in/' + roomName + '?lite'; | |
// return the result | |
return roomName; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment