Anonymous user
Constrained random points on a circle: Difference between revisions
Constrained random points on a circle (view source)
Revision as of 01:22, 16 April 2011
, 13 years agoSimpler D version
(Simpler D version) |
|||
Line 427:
=={{header|D}}==
▲<lang d>import std.stdio, std.random, std.math, std.algorithm;
void main() {
foreach (x; -15 .. 16)▼
foreach (y; -15 .. 16)▼
if (10 <= abs(x + y * 1i) && abs(x + y * 1i) <= 15)▼
possible ~= [x, y];▼
▲ int[2] p = [x, y];
▲ }
writeln(line);▼
}
}</lang>
<pre>
* *
*
* * *
*
* * * *
*
* * * *
▲ 1 2 2 1
▲ 1 1 1 1
▲ 1 2 1
▲ 1 1
▲ 1 </pre>
=={{header|F_Sharp|F#}}==
|