Task

Using either native language concurrency syntax or freely available libraries, write a program to display the strings "Enjoy" "Rosetta" "Code", one string per line, in random order.

Concurrency syntax must use threads, tasks, co-routines, or whatever concurrency is called in your language.




const str = ["Enjoy", "Rosetta", "Code"]
 
var thr: array[3, Thread[int32]]
 
proc f(i:int32) {.thread.} =
  echo str[i]
 
for i in 0..thr.high:
  createThread(thr[i], f, int32(i))
joinThreads(thr)