Return to Snippet

Revision: 641
at July 24, 2006 06:48 by dandyna


Updated Code
<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>

Revision: 640
at July 24, 2006 06:47 by dandyna


Initial Code
<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>

Initial URL
http://dandyland.org

Initial Description
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

Initial Title
Random number, without sequencial duplicates

Initial Tags
javascript

Initial Language
JavaScript