Last active
May 12, 2022 09:15
-
-
Save ismaelsadeeq/8b32aba0a3cadd31c7f86ef7d8e3e4b1 to your computer and use it in GitHub Desktop.
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
function generateId(startIn?: number){ | |
startIn? null: startIn = 1 | |
if(startIn>1000000){ | |
return false; | |
} | |
let randomId:number = 100000+Math.floor(Math.random() * 9000000); | |
if(startIn>0){ | |
while(randomId < startIn){ | |
randomId = 100000+Math.floor(Math.random() * 9000000) | |
} | |
} | |
return randomId.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment