mirror of
https://github.com/rjNemo/exercism-elixir
synced 2026-06-06 02:16:48 +00:00
8 lines
394 B
Elixir
8 lines
394 B
Elixir
defmodule CaptainsLog do
|
|
@planetary_classes ["D", "H", "J", "K", "L", "M", "N", "R", "T", "Y"]
|
|
|
|
def random_planet_class(), do: Enum.random(@planetary_classes)
|
|
def random_ship_registry_number(), do: "NCC-#{Enum.random(1000..9999)}"
|
|
def random_stardate(), do: 41_000.0 + 1_000.0 * :rand.uniform()
|
|
def format_stardate(stardate), do: :io_lib.format("~.1f", [stardate]) |> to_string()
|
|
end
|