Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -0,0 +1,15 @@
|
|||
defmodule Rand do
|
||||
def init do # Initialize the random values.
|
||||
<< a :: 32, b :: 32, c :: 32 >> = :crypto.strong_rand_bytes(12)
|
||||
:random.seed(a,b,c)
|
||||
end
|
||||
|
||||
def num do # Returns a value between 0.0 and 1.0.
|
||||
init
|
||||
:random.uniform
|
||||
end
|
||||
|
||||
def char(list) do # Returns a random letter or a space.
|
||||
Enum.at(list, :random.uniform(length(list)) - 1)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue