Percolation/Site percolation: Difference between revisions
Content added Content deleted
(+ C entry) |
(Small improvements in the D entry) |
||
Line 237: | Line 237: | ||
immutable r = rng.front / cast(double)rng.max; |
immutable r = rng.front / cast(double)rng.max; |
||
rng.popFront; |
rng.popFront; |
||
cell = r < probability ? Cell.empty : Cell.filled; |
cell = (r < probability) ? Cell.empty : Cell.filled; |
||
} |
} |
||
} |
} |
||
Line 245: | Line 245: | ||
line.writeln; |
line.writeln; |
||
foreach (const ref row; grid) |
foreach (const ref row; grid) |
||
writeln('|' |
writeln('|', cast(BaseType[nCols])row, '|'); |
||
line.writeln; |
line.writeln; |
||
} |
} |