/ Published in: JavaScript

function prints a serie of random numbers but without the next one being the same as the previous. to print, just call the function in the body
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type='text/javascript'> randomNum = 0; function noDuplicate(maxNum) { current = randomNum; while (current == randomNum) { current = Math.round(Math.random()*maxNum); } randomNum = current; return current; } </script>
URL: http://dandyland.org
Comments
