Jump to content

Generate random numbers without repeating a value: Difference between revisions

(Added Swift solution)
Line 301:
<lang ring>
see "working..." + nl
decimals(3)
 
time1 = clock()
for num = 1 to 5
pRand()
next
 
time2 = clock()
time3 = time2/1000 - time1/1000
see "Elapsed time = " + time3 + " s" + nl
see "done..." + nl
 
Line 333 ⟶ 337:
<pre>
working...
36 11 16 219 510 1815 193 1 8 11 15 7 172 9 1 20 125 104 14 6 412 13 17 18
7 20 2 15 8 5 9 13 17 19 171 206 4 16 11 8 1 18 5 103 12 1410 3 7 4 6 214
5 19 2 9 11 18 20 12 53 131 10 15 37 69 817 118 4 1020 1613 172 711 8 14 16 6
13 1 11 3 10 517 61 125 19 15 174 1418 49 20 1812 213 96 83 2 7 8 16 1914
2 714 115 96 1219 520 113 1417 205 4 101 8 13 6 164 18 37 159 1910 1716 11 12
Elapsed time = 0.008 s
done...
</pre>
2,468

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.