c# - How to distribute a cost in a normal distribution -


i've found guides on programmically getting random numbers generate normal; however, need spread out number reflects normal distribution (in least calculation time possible).

for example, have item cost $500,000 in year 2050 , spread across standard deviation of 20 years. result in area under first standard deviation (year 2030 2070) having (68% * $500,000) of cost.

is there formula can use in code achieve this? way can think of right using box muller random generator , loop through each dollar generate distribution, not efficient.

note total value under normal distribution 1. therefore, need find out percentage of curve accumulates in timeframe , multiply total cost.

instead of normal distribution, want normal cdf (cumulative density function) (here in c#).

so, sum up: find cost given range of years, find normalized values years, plug them cdf function, , multiply total cost:

start = (start_year-0.5-median)/stddev; end = (end_year+0.5-median)/stddev; cost = total_cost*(phi(end)-phi(start)); 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -