Generate random numbers without repeating a value: Difference between revisions

Generate random numbers without repeating a value en BASIC256
(Generate random numbers without repeating a value en FreeBASIC)
(Generate random numbers without repeating a value en BASIC256)
Line 72:
14 2 1 18 10 7 13 11 17 4 20 9 6 3 16 19 5 15 12 8
</pre>
 
 
=={{header|BASIC256}}==
{{trans|FreeBASIC}}
<lang BASIC256>arraybase 1
for num = 1 to 5
call pRand()
next num
end
 
subroutine pRand()
dim randCheck(21)
nr = 1
do
aleat = int(rand * 20) + 1
if randCheck[aleat] = 1 then
continue do
else
randCheck[aleat] = 1
print aleat; " ";
end if
for n = 1 to randCheck[?]
if randCheck[nr] then nr += 1
next n
until nr = 21
print
end subroutine</lang>
 
 
=={{header|F_Sharp|F#}}==
2,133

edits