write a c program for random numbers generation without using rand() function. The program is a simple modification of linear feedback shift registers (https://en.wikipedia.org/wiki/Linear-feedback_shift_register). This method uses the fact that when we allocate a memory, system returns the address of the memory address.

c program for random numbers generation without using rand() function

C++ 11 based random number generation

How to Compile and run

#g++ -std=c++11 sample.cpp

#./a.out

Note: The template parameter of std::uniform_int_distribution<T> specifies the type of integer that should be generated. The above c++ 11 based implementation is also known as true random number generator. it is used in cryptography applications.

A random number distribution post-processes the output of an random number engine in such a way that resulting output is distributed according to a defined statistical probability density function.

Ref:

Using rand() function

http://en.cppreference.com/w/cpp/numeric/random




Related Contents to follow