Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Pick-random-element/CLU/pick-random-element.clu
Normal file
15
Task/Pick-random-element/CLU/pick-random-element.clu
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
random_element = proc [T: type] (a: array[T]) returns (T)
|
||||
return(a[array[T]$low(a) + random$next(array[T]$size(a))])
|
||||
end random_element
|
||||
|
||||
start_up = proc ()
|
||||
po: stream := stream$primary_output()
|
||||
d: date := now()
|
||||
random$seed(d.second + 60*(d.minute + 60*d.hour))
|
||||
|
||||
arr: array[string] := array[string]$["foo", "bar", "baz", "qux"]
|
||||
|
||||
for i: int in int$from_to(1,5) do
|
||||
stream$putl(po, random_element[string](arr))
|
||||
end
|
||||
end start_up
|
||||
Loading…
Add table
Add a link
Reference in a new issue