vhdl - How can I compute a random value with multimodal distribution? -


i compute random value multimodal distribution composed of n normal distributions.

i have array n elements of normal distribution parameters (std deviation, mean).

my language (vhdl) , library allow me calculate following basic distributions: - uniform distribution [-1.0; 1.0] - normal distribution (box muller transformation) - poisson distribution

how can calculate random values histogram looks n overlapping normal distributions?

two normal distributions

types , helpers:

type t_normal_dist_param record     stddev : real;     mean   : real;   end record;   type t_jitter_dist array(natural range <>) of t_normal_dist_param;   constant jitterdistribution : t_jitter_dist := (     0 => (0.2, -0.4),     1 => (0.2,  0.4)   ); 

the problems core:

procedure getmultimodaldistributedrandomnumber(seed : t_sim_seed; value : real; jitterdistribution : t_jitter_dist)   variable rand   : real;   variable result : real; begin   -- ...   in jitterdistribution'range loop     getnormaldistributedrandomvalue(seed, rand, jitterdistribution(i).stddev,  jitterdistribution(i).mean);     -- how accumulate rand?   end loop;   value := result; end procedure; 

it's used in:

procedure genclock(signal clock : out std_logic; period : time)   constant timehigh : time := period / 2;   constant timelow : time := period - timehigh;   variable rand : real; begin   initializeseed(seed);   while (not isstopped) loop     getmultimodaldistributedrandomnumber(seed, rand, jitterdistribution);     clock <= '1';     wait timehigh + (period * rand);     clock <= '0';     wait timelow;   end loop; end procedure; 


Comments