Random Number Generator (Scripts) Publisher's description
from ChinSoon Lim
3 MATLAB functions to generate uniformly distributed random numbers in the interval(0, 1)
This zip file contains
1) 3 MATLAB functions to generate uniformly distributed random numbers in the interval(0, 1)
-> randCrypt.mexw32, randChaos.mexw32, randQuant.mexw32
2) 3 C++ files that created these MATLAB functions
->randCrypt.cpp, randChaos.cpp, randQuant.cpp
3) 3 function references that describe each of the MATLAB function call
Before you download
1) Results from these random generating functions have precision up to a fixed numDecimalPlaces. This means that randCrypt returns number in the interval 10^-numDecimalPlaces : 10^-numDecimalPlaces : 1 - 10^-numDecimalPlaces. Increasing the precision of the number generated increases the time taken.
2) These functions are much slower than the rand available in MATLAB. This is the price to pay for generate true random numbers. Please read their function reference for more details on the time taken. Hence, if pseudorandom numbers work for you, you can ignore these programs.
3) randChaos and randQuant require internet connection to retrieve random bytes from http://www.random.org and http://www.fourmilab.ch/hotbits respectively. I would like to thank the authors of these website for providing these random bytes.
Y = randXXXXX(numDecimalPlaces, m, n)
Y = randXXXXX(numDecimalPlaces,[m n])
Y = randXXXXX(numDecimalPlaces,m,n,p,...)
Y = randXXXXX(numDecimalPlaces,[m n p ...])
Y = randXXXXX(numDecimalPlaces,size(A))
Y = randXXXXX(numDecimalPlaces, m, n) or Y = randXXXXX(numDecimalPlaces, [m n]) returns an m-by-n matrix of random scalar value drawn from a uniform distribution in the interval (0, 1).
Y = randXXXXX(numDecimalPlaces, m, n, p, ...) or Y = randXXXXX(numDecimalPlaces, [m n p ...]) returns an m-by-n-by-p-by-... array of values as described above.
Y = randXXXXX(numDecimalPlaces, size(A)) returns an array that is the same size as A.
1) numDecimalPlaces should be nonnegative integer. The absolute of the negative input is used instead.
2) The size inputs m, n, p, ... should be nonnegative integers. Negative integers are treated as zero.
randXXXXX has been motivated by a need for true random generator and a strong nonrandom pattern in Matlab default random number generator.
Please read function references for more credits. Thank you.
Each random number of type double is created as follows. Random bytes are splitted into upper and lower 4 bits. If the upper 4 bits in hexdecimal is less than 10, it is used to create one decimal place. The same applies to the lower 4 bits for the next decimal place. Process is repeated until numDecimalPlaces are created.
x = 0:0.00001:1; tic; t = randXXXXX(8,1,10000000); toc; figure; hist(t,x);
R = randXXXXX(8,1,1)
R = randXXXXX(8,3,4)
0.2190 0.6793 0.5194 0.0535
0.0470 0.9347 0.8310 0.5297
0.6789 0.3835 0.0346 0.0671
System Requirements:MATLAB 7.2 (R2006a)
Program Release Status: New Release
Program Install Support: Install and Uninstall