Jerry Avins wrote:
> hbarcellos wrote:
> > Hi all,
>
> > I'm working whit ADSP 21161 analog devices, I'm looking for a way to
> > generate a white noise in assembly, something like a random function
in C.
>
> > kind regard's
>
> A linear congruential generator is probably good enough. Thay are easy
> to code. If you don't need all the bits, discard the lower-order
ones.http://en.wikipedia.org/wiki/Linear_congruential_generator
For DSP, the linear congruential generators might be good enough.
There is a particular pair of numbers "a" and "b", such that
x(n) = (a x(n-1) + b ) % 2^32
produced what looks and sounds like uniform random integers and has a
period of 2^32 - 1. For processors that sup****t 32bit fixed-point
arithmetic (like the SHARC), this is extremely fast (the % is for
free). The numbers "a" and "b" are in one of Knuth's volumes and the
old Numerical Recipes in C (in the new version, they completely
discourage the use of linear congurential generators - a pity, because
for dithering and simple randomization, the above generator works just
fine).
Hey wait, the old version of NR is available online here:
http://www.nrbook.com/a/bookcpdf.php
Chapter 7.1 (Uniform Deviates), section Quick and Dirty Generators. So
"a" is 1664525 and "b" is 1013904223.
Regards,
Andor


|