Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
16
Task/Knuth-shuffle/Ring/knuth-shuffle.ring
Normal file
16
Task/Knuth-shuffle/Ring/knuth-shuffle.ring
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
shuffle(a)
|
||||
for n = 1 to len(a)
|
||||
see "" + a[n] + " "
|
||||
next
|
||||
|
||||
func shuffle t
|
||||
n = len(t)
|
||||
while n > 1
|
||||
k = random(n-1)+1
|
||||
temp = t[n]
|
||||
t[n] = t[k]
|
||||
t[k] = temp
|
||||
n = n - 1
|
||||
end
|
||||
return t
|
||||
Loading…
Add table
Add a link
Reference in a new issue