Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -0,0 +1,30 @@
defmodule Random do
def init() do
:random.seed(:erlang.now())
end
def generate_point() do
x = :random.uniform(31) - 16
y = :random.uniform(31) - 16
if 10*10 <= x*x + y*y and x*x + y*y <= 15*15 do
{x, y}
else
generate_point()
end
end
def circle() do
points = for _ <- 1..100, do: generate_point()
for x <- -15..15 do
for y <- -15..15 do
if Enum.member?(points, {x, y}) do
IO.write "x"
else
IO.write " "
end
end
IO.puts ""
end
end
end
Random.init()
Random.circle()