First commit
This commit is contained in:
14
exercises/ch03/ex3_7.lua
Normal file
14
exercises/ch03/ex3_7.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
local function random_normal()
|
||||
local u = math.random()
|
||||
local v = math.random()
|
||||
return math.sqrt(-2 * math.log(u, math.exp(1))) * math.cos(2 * math.pi * v)
|
||||
end
|
||||
|
||||
local function generate()
|
||||
for _ = 0, 10 do
|
||||
local value = random_normal()
|
||||
print(value)
|
||||
end
|
||||
end
|
||||
|
||||
generate()
|
||||
Reference in New Issue
Block a user