Generate random numbers without repeating a value: Difference between revisions

Content added Content deleted
(Added Swift solution)
Line 301: Line 301:
<lang ring>
<lang ring>
see "working..." + nl
see "working..." + nl
decimals(3)

time1 = clock()
for num = 1 to 5
for num = 1 to 5
pRand()
pRand()
next
next


time2 = clock()
time3 = time2/1000 - time1/1000
see "Elapsed time = " + time3 + " s" + nl
see "done..." + nl
see "done..." + nl


Line 333: Line 337:
<pre>
<pre>
working...
working...
3 16 2 5 18 19 8 11 15 7 17 9 1 20 12 10 14 6 4 13
6 11 16 19 10 15 3 1 8 7 2 9 20 5 4 14 12 13 17 18
15 9 13 19 17 20 16 11 8 1 18 5 10 12 14 3 7 4 6 2
7 20 2 15 8 5 9 13 17 19 1 6 4 16 11 18 3 12 10 14
19 2 9 11 18 20 12 5 13 15 3 6 8 1 4 10 16 17 7 14
5 19 12 3 1 10 15 7 9 17 18 4 20 13 2 11 8 14 16 6
13 1 11 3 10 5 6 12 15 17 14 4 20 18 2 9 8 7 16 19
11 10 17 1 5 19 15 4 18 9 20 12 13 6 3 2 7 8 16 14
2 7 1 9 12 5 11 14 20 4 10 8 13 6 16 18 3 15 19 17
2 14 15 6 19 20 3 17 5 1 8 13 4 18 7 9 10 16 11 12
Elapsed time = 0.008 s
done...
done...
</pre>
</pre>