using PyPlot
using Distributions
using QuickTypes
const 抽象浮動小数点型 = AbstractFloat
const もしもまたはそれ以外 = ifelse
const ゼロ = zero
const 長さ = length
const 乱数 = rand
const 平均 = mean
const ガンマ分布 = Gamma
const 指数分布 = Exponential
rc("font", family="IPAPGothic")
function 資産分配してからプロット!(asset, taxfunc, Dist; 回数=10^7, bins=floor(Int,sqrt(endof(asset)/2)))
figure(figsize=(8,3))
subplot(121)
plt[:hist](asset, normed=true, bins=bins, label="資産分布",
range=(0, max(2.0, maximum(asset))))
grid(ls=":")
legend()
title("分配前")
@time 資産をランダムに分配!(asset, taxfunc, 回数)
@show fitdist = fit(Dist, asset)
sleep(0.1)
subplot(122)
h = plt[:hist](asset, normed=true, bins=bins, label="資産分布")
x = linspace(0.0, max(2.0, maximum(asset)), 201)
#Dist_str = replace("$Dist", "Distributions.", "")
#plot(x, pdf.(fitdist, x), label="$Dist_str dist")
plot(x, pdf.(fitdist, x), label="指数分布")
grid(ls=":")
legend()
title("分配後")
tight_layout()
end