Constrained random points on a circle: Difference between revisions

Content deleted Content added
Added Ruby version.
Line 872:
47414232164
4 </lang>
 
=={{header|Ruby}}==
<lang Ruby>points = (1...100).map {
# choose a random radius and angle
angle = rand * 2.0 * Math::PI
rad = rand * 5.0 + 10.0
# convert back from polar to cartesian coordinates
[rad * Math::sin(angle), rad * Math::cos(angle)].map(&:round)
}
 
(-15...15).each do |row|
puts((-15...15).map { |col| points.include?([row, col]) ? "X" : " " }.join)
end</lang>
 
=={{header|SystemVerilog}}==