URL
https://opencores.org/ocsvn/rng_lib/rng_lib/trunk
[/] [rng_lib/] [trunk/] [bench/] [vhdl/] [rng_lib.vhd] - Diff between revs 8 and 11
Show entire file |
Details |
Blame |
View Log
Rev 8 |
Rev 11 |
Line 153... |
Line 153... |
rnd_out := rng(rnd_out);
|
rnd_out := rng(rnd_out);
|
y := -1.0 + 2.0 * rnd_out.rnd;
|
y := -1.0 + 2.0 * rnd_out.rnd;
|
z := (x * x) + (y * y);
|
z := (x * x) + (y * y);
|
end loop;
|
end loop;
|
-- Box-Mueller transform
|
-- Box-Mueller transform
|
rnd_out.rnd := rnd_out.y + rnd_out.z * y * sqrt(-2.0 * log(z)/z);
|
rnd_out.rnd := rnd_out.y + rnd_out.z * y * sqrt(-2.0 * ln(z)/z);
|
-- Exponential distribution
|
-- Exponential distribution
|
when EXPONENTIAL =>
|
when EXPONENTIAL =>
|
rnd_out := rng(rnd);
|
rnd_out := rng(rnd);
|
rnd_out.rnd := -rnd_out.y * log(1.0 - rnd_out.rnd);
|
rnd_out.rnd := -rnd_out.y * log(1.0 - rnd_out.rnd);
|
when others =>
|
when others =>
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.