Guys,
I have the below script that generates a random number, but struggling to modify it such that it generates a random number less than or equal to 2,147,483,647
Code:<html> <head> <script type="text/javascript"> function dorand(){ var dateObject = new Date(); var uniqueId = dateObject.getMonth() + '' + dateObject.getDate() + '' + dateObject.getTime(); var randomnumber = Math.floor(Math.random() * 9001); if (uniqueId.length > 10){ uniqueId = uniqueId.substring(0, 10); } var uniqueId = parseInt(randomnumber) + parseInt(uniqueId); document.write(uniqueId); } dorand(); </script> </head> <body> </html>



Reply With Quote

Bookmarks