A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/stdfin/random/ below:

GitHub - stdfin/random: C++11 random addon

A collection of C++11 compatible random engines and distributions.

Item Description Threefry A fast, high quality random number generator used or large scale parallel processing. Vandercorput A simplest one dimensional low-discrepancy sequence. Item Description Non-central Chi Squared The distribution of the sum of squares of k Normal distributed variates each with variance one and lambda the sum of squares of the normal means.

The Threefry random number engine is a fast and high quality random number generator used for large scale parallel processing.

The implementation is based on a paper by John Salmon and Mark Moraes and described in their paper Parallel Random Numbers: As Easy as 1, 2, 3. (Proceedings of 2011 International Conference for High Performance Computing, Networking, Storage and Analysis). The algorithm is based on the Threefish cryptographic cipher.

Usable for large scale parallel processing:

#include <iostream>
#include "stdfin/random/threefry.hpp"
 
int main()
{
    stdfin::threefry_engine eng1, eng2;
 
    eng1.seed(0);  // reset the first engine (not really necessary)
    eng2.seed(1); // 2nd engine gets a different seed
 
    std::cout << "\nTwo independent streams.\n";
    for (int i=0; i<4; ++i)
        std::cout <<  eng1() << " " << eng2() << "\n";
 }

gives

Two independent streams.
3871888695 1931275270
153194173 145858287
1725456645 3604276868
1435770706 3225543903

A van der Corput sequence is the simplest one dimensional low-discrepancy sequence over the unit interval first published in 1935 by the Dutch mathematician J. G. van der Corput. It is constructed by reversing the base n representation of the sequence of natural numbers (1, 2, 3, …).

Low-discrepancy sequence have an advantage over pure random numbers in that they cover the domain of interest quickly and evenly. They have an advantage over grids in that those only give high accuracy when the number of datapoints is pre-set whereas in using low-discrepancy sequence the accuracy improves continually as more datapoints are added.

#include <iostream>
#include "stdfin/random/vandercorput_engine.hpp"
 
int main()
{ 
    stdfin::vandercorput_engine eng;
    for (int i=0; i<10; ++i)
        std::cout << eng() << "\n";        
}
Non-central Chi Squared distribution

The noncentral chi-squared distribution is a real valued distribution with two parameter, k and lambda. The distribution produces values > 0.

This is the distribution of the sum of squares of k Normal distributed variates each with variance one and lambda the sum of squares of the normal means.

The distribution function is $$ \displaystyle P(x) = \frac{1}{2} e^{-(x+\lambda)/2} \left( \frac{x}{\lambda} \right)^{k/4-1/2} I_{k/2-1}( \sqrt{\lambda x} ) $$

where

$$\displaystyle I_\nu(z)$$ is a modified Bessel function of the first kind.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4