<script> var randomFrame = 0; for (var i = 0; i < 50; i++) { randomFrame = ++randomFrame % 6; document.write(randomFrame+"<br>") } </script>