Skip to content

Instantly share code, notes, and snippets.

@tkbremnes
Last active August 29, 2015 14:02
Show Gist options
  • Save tkbremnes/b8f7cbf96aa15d994c26 to your computer and use it in GitHub Desktop.
Save tkbremnes/b8f7cbf96aa15d994c26 to your computer and use it in GitHub Desktop.
Random room name generator
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