mirror of
https://github.com/p-stream/p-stream.git
synced 2026-03-11 17:55:33 +00:00
safely generate watch party code
This commit is contained in:
parent
c19fe77514
commit
56c14945b3
1 changed files with 4 additions and 2 deletions
|
|
@ -25,8 +25,10 @@ interface WatchPartyStore {
|
|||
}
|
||||
|
||||
// Generate a random 4-digit code
|
||||
const generateRoomCode = (): string => {
|
||||
return Math.floor(1000 + Math.random() * 9000).toString();
|
||||
export const generateRoomCode = (): string => {
|
||||
const array = new Uint32Array(1);
|
||||
crypto.getRandomValues(array);
|
||||
return (1000 + (array[0] % 9000)).toString();
|
||||
};
|
||||
|
||||
// Helper function to reset playback rate to 1x
|
||||
|
|
|
|||
Loading…
Reference in a new issue