• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Random variables number obey a normal distribution

Joined
5/11/16
Messages
3
Points
11
I was asked about generating a random number normally distributed based on uniform distribution. I told about Box-Muller transform, inverse CDF, Central Limit Theorem... So my question is, which methods is widely used by the Quants and which one is only theoretical curiosity?
 
At the university we studied Box-Muller.
As I started my career one gave me a task to rewrite an implementation of Box-Muller from C++ to Java; it was a test on a Schnuppertag (trainee test day).

Generally, quants just blindly use reputable out-of-box libraries, unless pretty the performance is really critical.
 
At the university we studied Box-Muller.
As I started my career one gave me a task to rewrite an implementation of Box-Muller from C++ to Java; it was a test on a Schnuppertag (trainee test day).

Generally, quants just blindly use reputable out-of-box libraries, unless pretty the performance is really critical.

That's about 3 lines of code... 5 minutes work :D

BTW, did you stumble on the nasty Neave side effects with Box-Muller? It's not very good. It's a show-stopper. Besides, a more efficient variant is PolarMarsaglia (no trigonometric functions).

And it's not true that quants just blindly use rngs. That's a simplification and one helluva generalization.

here is one example
sitmo | High Quality C++ Parallel Random Number Generator
 
Last edited:
That's about 3 lines of code... 5 minutes work :D
As a fresh graduate I needed a little bit more, but probably they wanted to check whether there are programming skills at all (at the Uni-Ulm the curriculum for Master Students of quantitative Finance does not contain any programming courses but clever students like me attended additional courses; in Germany you can take as many courses as you want free of charge).

And it's not true that quants just blindly use rngs
It is true in the majority of use cases. Moreover, the modeling quants often blindly use the whole software (and not just small components like RND), which is written by in-house IT or third-party providers.

Just out of curiosity .. is this the standard RNG in Java or are there also specialised libraries?
Have a look at what they use at OpenGamma.
 
Ok, I understand. But, I am still wonder which one is commonly used in a build-in software components. After quick glace of C++ environment, I often meet with inverse CDF...
 
Ok, I understand. But, I am still wonder which one is commonly used in a build-in software components. After quick glace of C++ environment, I often meet with inverse CDF...
C++11 <random> and Boost C++ Math Toolkit (see quantile function).

There are several kinds of algorithms for computing CDF. Glasserman's book on Monte Carlo.

===
Nice link to the quantile

Non-Member Properties - 1.60.0
 
Last edited:
Back
Top