The better pseudo-random number generator derived from the library function rand() in C/C++

Full Text (PDF, 227KB), PP.13-23

Views: 0 Downloads: 0


Pushpam Kumar Sinha 1 Sonali Sinha 2

1. Department of Mechanical Engineering, Netaji Subhas Institute of Technology, Amhara, Bihta, Patna, India

2. National Center of Health Statistics, Hyattsville, Maryland, USA

* Corresponding author.


Received: 25 Jun. 2019 / Revised: 18 Jul. 2019 / Accepted: 11 Aug. 2019 / Published: 8 Nov. 2019

Index Terms

pseudo-random number generator, library function, correlation coefficient.


We choose a better pseudo-random number generator from a list of eight pseudo-random number generators derived from the library function rand() in C/C++, including rand(); i.e. a random number generator which is more random than all the others in the list. rand() is a repeatable pseudo-random number generator. It is called pseudo because it uses a specific formulae to generate random numbers, i.e. to speak the numbers generated are not truly random in strict literal sense. There are available several tests of randomness, some are easy to pass and others are difficult to pass. However we do not subject the eight set of pseudo random numbers we generate in this work to any known tests of randomness available in literature. We use statistical technique to compare these eight set of random numbers. The statistical technique used is correlation coefficient.

Cite This Paper

Pushpam Kumar Sinha, Sonali Sinha," The better pseudo-random number generator derived from the library function rand() in C/C++", International Journal of Mathematical Sciences and Computing(IJMSC), Vol.5, No.4, pp.13-23, 2019. DOI: 10.5815/ijmsc.2019.04.02


[1] Kernighan, Brian W. and Ritchie, Dennis M., (1988), The C Programming Language, 2nd Ed., Pearson-Prentice Hall, New Delhi, India

[2] Park, S.K. and Miller, K.W., (1988), Commun, ACM 31, 1192-1201

[3] Press, W.H. and Teukolsky, S.A., (1992), Portable random number generators, Comput. Phys. 6, 521-524

[4] Marsaglia, G. and Zaman, A., (1995), Some very-long-period portable random number generators, Computers in Physics, 8 117–121.

[5] Knuth, Donald E., (1998), The Art of Computer Programming, Volume II, 3rdEd., Addison Wesley, Reading, Mass.

[6] MacLaren, D. and Marsaglia, G., (1965), Uniform random number generators, Journ. Assoc. for Computing Machinery, 12, 83–89.

[7] Marsaglia. G.,(1985), A current view of random number generators, Keynote Address, Statistics and Computer Science: XVI Symposium on the Interface, Atlanta, Proceedings, Elsevier.

[8] The Marsaglia Random Number CDROM, with The Diehard Battery of Tests of Randomness, produced at Florida State University under a grant from The National Science Foundation, 1985. Access available at

[9] Marsaglia, G. and Tsang, W.W., (2002), Some dif´Čücult-to-pass tests of randomness, Journal of Statistical Software, Vol 7, Issue 3.

[10] Singpurwalla, D., (2015), A Handbook of Statistics: An Overview of Statistical Methods, (Ebook)