Open main menu

CDOT Wiki β

Changes

Midnight Tiger

12 bytes removed, 23:23, 4 April 2016
Task Parallelized Pi Program
var counts: [0..#tasks] int;
'''coforall''' tid in 0..#tasks {
var rs = new RandomStream(seed, parSafe=false);
const nPerTask = n/tasks,
}
var count = + '''reduce''' counts;
const te = getCurrentTime();
writeln("Approximation of pi = ", count * 4.0 / n);