Skip to content

Commit 0516d0c

Browse files
committed
Improved the Room ID Generation Algorithm
1 parent f5c4d26 commit 0516d0c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/js/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ function generateRoomID() {
303303
const random = crypto.getRandomValues(new Uint8Array(length));
304304
let room_id = "";
305305
for (let i = 0; i < length; i++) {
306-
room_id += alphabet[alphabet.length & random[i]];
306+
room_id += alphabet[random[i] % alphabet.length];
307307
}
308308
return `${room_id.slice(0, 3)}-${room_id.slice(3, 7)}-${room_id.slice(7, 10)}`;
309309
}

0 commit comments

Comments
 (0)