Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,10 @@
import ceylon.random {
DefaultRandom
}
shared void run() {
value random = DefaultRandom();
value element = random.nextElement([1, 2, 3, 4, 5, 6]);
print(element);
}

View file

@ -0,0 +1,4 @@
(define (pick-random list)
(list-ref list (random (length list))))
(pick-random (iota 1000)) → 667
(pick-random (iota 1000)) → 179

View file

@ -0,0 +1,12 @@
' FB 1.05.0 Win64
Dim a(0 To 9) As String = {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"}
Randomize
Dim randInt As Integer
For i As Integer = 1 To 5
randInt = Int(Rnd * 10)
Print a(randInt)
Next
Sleep

View file

@ -0,0 +1,5 @@
local(
my array = array('one', 'two', 3)
)
#myarray -> get(integer_random(#myarray -> size, 1))

View file

@ -0,0 +1,2 @@
put "Apple,Banana,Peach,Apricot,Pear" into fruits
put item (random(the number of items of fruits)) of fruits

View file

@ -0,0 +1,14 @@
import math
randomize()
proc random[T](a: openarray[T]): T =
a[random(a.low..a.len)]
let ls = @["foo", "bar", "baz"]
echo ls.random()
var xs: array[10..14, string]
for i in 10..14:
xs[i] = "foo: " & $i
echo xs.random()

View file

@ -0,0 +1 @@
: pickRand(l) l size rand l at ;

View file

@ -0,0 +1,2 @@
constant s = {'a','b','c'}
puts(1,s[rand(length(s))])

View file

@ -0,0 +1,7 @@
aList = "abcdefghij"
for i = 1 to 10
letter = random(10)
if letter > 0
see aList[letter] + nl
ok
next

View file

@ -0,0 +1,3 @@
var arr = %w(north east south west);
say arr.rand;
say arr.rand(2).dump;

View file

@ -0,0 +1,4 @@
import Darwin
let myList = [1, 2, 4, 5, 62, 234, 1, -1]
print(myList[Int(arc4random_uniform(UInt32(myList.count)))])

View file

@ -0,0 +1,6 @@
# generate a stream (ursa equivalent of a list)
decl string<> str
append "these" "are" "some" "values" str
decl ursa.util.random r
out str<(r.getint (size str))> endl console