CS计算机代考程序代写 # for all constructors, x is the result of the first simulation run

# for all constructors, x is the result of the first simulation run

Results(R::Type, sim, value, reps) = ( R <: StoredValues ) ? R(sim, value, reps) : R(sim, value) function Sum(sim::Simulation, x) Sum(1, x) end function BinomialStats(sim::Simulation, x) BinomialStats(1, x) end function NormalStats(sim::Simulation, x) NormalStats(1, x, x^2, x, x) end function StoredValues(sim::Simulation, x, n::Int) ElType = typeof(x) values = Vector{ElType}(undef, n + 1) # (n + 1) for the n run values plus the init value values[1] = x StoredValues{ElType}(values, 2) end