javascript - How to not repeat an array in math.random? -
so have javascript code, want not repeat different r_text's, same line of text r_text[] not repeated when refresh site. question is, should code be?
<script language="javascript"> <!-- var r_text = new array (); r_text[0] = "all leaves brown"; r_text[1] = "and sky grey"; r_text[2] = "i've been walk"; r_text[3] = "on winter's day"; r_text[4] = "id safe , warm"; r_text[5] = "if in l.a."; r_text[6] = "california dreaming, on such winter's day"; var = math.floor(7*math.random()) document.write(r_text[i]); //--> </script>
javascript arrays random
No comments:
Post a Comment