f



A random question, for a certain meaning of "random"

I'm looking at the library definitions for the C++ standard library, and 
it looks like they have a much richer selection of random number 
generators -- see the link.

I'm going to be doing some monte-carlo testing.  Does anyone have 
comments from personal experience, or articles they can point to from 
trusted sources, about which generators may be best for getting some 
semblance of white noise?

http://www.cplusplus.com/reference/random/

Thanks.

-- 

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

I'm looking for work -- see my website!
0
Tim
12/16/2016 12:00:10 AM
comp.dsp 20333 articles. 1 followers. allnor (8509) is leader. Post Follow

8 Replies
235 Views

Similar Articles

[PageSpeed] 33

Tim Wescott  <seemywebsite@myfooter.really> wrote:

>I'm looking at the library definitions for the C++ standard library, and 
>it looks like they have a much richer selection of random number 
>generators -- see the link.

>I'm going to be doing some monte-carlo testing.  Does anyone have 
>comments from personal experience, or articles they can point to from 
>trusted sources, about which generators may be best for getting some 
>semblance of white noise?

>http://www.cplusplus.com/reference/random/

Haven't used it.

I generally use the C library (cmath in C++) because I trust it more.

In the past, I've posted my code here for gaussian noise (including
a version of rand(), although some library versions may be better) --
it is searchable on dsprelated.

I'm pretty sure you do not want to try to generate gaussian noise
using something like erf(). 

Steve

0
spope33
12/16/2016 2:34:30 AM
On 16.12.16 01.00, Tim Wescott wrote:
> I'm looking at the library definitions for the C++ standard library, and
> it looks like they have a much richer selection of random number
> generators -- see the link.
>
> I'm going to be doing some monte-carlo testing.  Does anyone have
> comments from personal experience, or articles they can point to from
> trusted sources, about which generators may be best for getting some
> semblance of white noise?

For monte carlo integration any random generator is fine as long as it 
is not correlated to your model. However, the convergence depends on the 
value distribution (and of course the partial derivatives).
Choosing white noise gives you a normal distribution with finite 
variance. This will scan the range close to 0 more densely than other 
regions. Is this what you want?


Marcel
0
Marcel
12/16/2016 7:50:42 AM
On Thu, 15 Dec 2016 18:00:10 -0600, Tim Wescott
<seemywebsite@myfooter.really> wrote:

>I'm looking at the library definitions for the C++ standard library, and 
>it looks like they have a much richer selection of random number 
>generators -- see the link.
>
>I'm going to be doing some monte-carlo testing.  Does anyone have 
>comments from personal experience, or articles they can point to from 
>trusted sources, about which generators may be best for getting some 
>semblance of white noise?
>
>http://www.cplusplus.com/reference/random/
>

In my experience it depends entirely on what you're trying to
simulate, i.e., how sensitive it might be to deviations from
"whiteness".    In many, if not most, comm cases, Box-Muller is just
fine.    If you're simulating *very* high-order modulations or
reliabilities down to something like e-10, then you're in territory
where the whiteness of the noise models may start to matter more.

There are some really good and not-egregiously-complex models that are
a huge leap from Box-Muller-ish territory, but still depend ultimately
on what you're trying to do.  There was a big step a while back for
security randomization but I'll have to dig a bit to find the right
reference.

Meanwhile, here's a former colleague telling how to get really, really
good randomness in hardware, if you have an hour-and-forty-or-so to
spend:  ;)

https://www.youtube.com/watch?v=GatPIgrsGr0

I'll look for that "new" method for software, though...not sure how
long it'll take.


0
eric
12/18/2016 6:53:22 PM
Tim Wescott <seemywebsite@myfooter.really> Wrote in message:
> I'm looking at the library definitions for the C++ standard library, and 
> it looks like they have a much richer selection of random number 
> generators -- see the link.
> 
> I'm going to be doing some monte-carlo testing.  Does anyone have 
> comments from personal experience, or articles they can point to from 
> trusted sources, about which generators may be best for getting some 
> semblance of white noise?
> 
> http://www.cplusplus.com/reference/random/
> 
> Thanks.
> 
> -- 
> 
> Tim Wescott
> Wescott Design Services
> http://www.wescottdesign.com
> 
> I'm looking for work -- see my website!
> 

Random numbers?
The computer chooses positions of the CPU at random so that's how
 it generates numbers at complete random.
Like you throwing a dice pretty much.
-- 


----Android NewsGroup Reader----
http://usenet.sinaapp.com/
0
Vassilios
12/21/2016 5:37:32 AM
"Tim Wescott"  wrote in message 
news:i_2dnc8Jgv8Xs87FnZ2dnUU7-fNh4p2d@giganews.com...
>I'm looking at the library definitions for the C++ standard library, and
>it looks like they have a much richer selection of random number
>generators -- see the link.
>I'm going to be doing some monte-carlo testing.  Does anyone have
>comments from personal experience, or articles they can point to from
>trusted sources, about which generators may be best for getting some
>semblance of white noise?

Hi Tim,

I wrote a small article on that subject in Circuit Cellar : June 2016, issue 
311 : "The Darker Side : Random numbers". If you want to do somethink better 
than the standard liner congruent methods I guess the easiest way is to use 
some crypto algorithms to generate white noise. Did someone tried to 
AES-cipher any sequence of numbers and check the noise characteristics of 
the result ?

Cheers,
Robert Lacoste
www.alciom.com

0
Robert
12/21/2016 9:38:35 AM
Robert Lacoste <see-alciom-dot-com@none.com> wrote:

>I wrote a small article on that subject in Circuit Cellar : June 2016, issue 
>311 : "The Darker Side : Random numbers". If you want to do somethink better 
>than the standard liner congruent methods I guess the easiest way is to use 
>some crypto algorithms to generate white noise. Did someone tried to 
>AES-cipher any sequence of numbers and check the noise characteristics of 
>the result ?

I haven't done this, but 20+ years ago I did the same with DES.

I found that counter-mode DES was not good enough to pass my 
statistical tests, but if I XOR'ed this stream with that of
a maximal-length sequence, then it did pass.

One presumes AES is better ... 

Any of these give pseudorandom results.  For closer to true random,
all modern processors contain a multiple-free-running counter
circuit that can be used to seed or post-process a pseudorandom
generator.  This method has replaced weaker past methods based
on human input (e.g. keystrokes) or other events thought to be random.
It's really quite good, but there is still a place for noise-diode
circuits and the like.

Steve
0
spope33
12/21/2016 1:15:25 PM
On Thu, 15 Dec 2016 18:00:10 -0600, Tim Wescott
<seemywebsite@myfooter.really> wrote:

>I'm looking at the library definitions for the C++ standard library, and 
>it looks like they have a much richer selection of random number 
>generators -- see the link.
>
>I'm going to be doing some monte-carlo testing.  Does anyone have 
>comments from personal experience, or articles they can point to from 
>trusted sources, about which generators may be best for getting some 
>semblance of white noise?
>
>http://www.cplusplus.com/reference/random/
>

Finally remembered to look for the reference I mentioned for this.
It's the Permuted Congruential Generator, is simple to implement and
has high performance compared to other methods, given the same or
similar entropy source.   The download tab has a number of nice
implementation examples, including in C with an Apache 2.0
(commercially permissive) license.

http://www.pcg-random.org/

The download page here:

http://www.pcg-random.org/download.html

My security/encryption friends were highly positive about this when it
came out, which wasn't very long ago.


0
eric
12/22/2016 12:10:15 AM
Am 16.12.16 um 01:00 schrieb Tim Wescott:
> I'm looking at the library definitions for the C++ standard library, and
> it looks like they have a much richer selection of random number
> generators -- see the link.
>
> I'm going to be doing some monte-carlo testing.  Does anyone have
> comments from personal experience, or articles they can point to from
> trusted sources, about which generators may be best for getting some
> semblance of white noise?

Here is a website discussing pseudo random number generators:

	http://simul.iro.umontreal.ca/testu01/tu01.html


I've also used successfully quasi-random numbers to integrate over 
volumes and statistical distributions. They are NOT random, but can 
converge faster in many cases

	http://dl.acm.org/citation.cfm?id=264064


Christian
0
Christian
12/22/2016 8:11:03 AM
Reply: