RosettaCodeData/Task/Constrained-random-points-on-a-circle/Mathematica/constrained-random-points-on-a-circle.math
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

3 lines
213 B
Text

sample = Take[Cases[RandomInteger[{-15, 15}, {500, 2}], {x_, y_} /; 10 <= Sqrt[x^2 + y^2] <= 15], 100];
Show[{RegionPlot[10 <= Sqrt[x^2 + y^2] <= 15, {x, -16, 16}, {y, -16, 16}, Axes -> True], ListPlot[sample]}]