RTEST <port> <ncycles>
<port> indicates which serial port is used (either 1 or 2. (default:2)).
<ncycles> gives the number of test runs. One test run consists of reading 26500 bytes and calculating the Chi-2 and the number of bits on each one of the eight positions within the byte. If more test runs are specified the numbers (except the chi-2) accumulate.
If the program is started it will display one sample from the specified port. More samples can be displayed by hitting the ENTER-key.
Continuous sampling of the test runs is started by the ESC key. The results will be available for further statistical analysis in the textfile 'TEST'.
RTEST is also available for Windows.
[Download RNG software for DOS/Windows]
RAND3 <port>
This program starts in the same way as RTEST by displaying individual samples after each time the ENTER key is hit. . After hitting the ESC key continuous sampling starts and the bytes are displayed tin a graphical form in real time. The continuous samples can be restarted by hitting the space-bar. Exit through the ESC key.
The software addresses the serial port directly. It is also possible to implement a driver which is interrupt driven (like the software supplied for the Mac). A driver is available upon request.
The Macintosh software is based upon the standard serial port drivers rather than on direct access of the serial ports. The bufferspace for this driver should be large enough to hold incoming bytes while the driver is active and no reading occurs. In cases where this is not clear one should close the driver and reopen it when needed.
In the examples the modem-port is used. In the listings it is indicated how to use the printer-port.
RNG_test
The program will ask for the number of test runs to perform. Each test run consists of 8192 samples. The chi-2 (df=255) and the number of '1' bits minus the number of '0' bits on each of the positions within the byte are displayed after each run. Chance expectation is of course 0. When more runs are specified the cumulative number of '1' bits minus the cumulative number of '0' bits are displayed as well as the corresponding standard deviation.
All data are saved in the file RNGTESTDATA. Each run on a separate line and the data separated by spaces.
[Download RNG software for Macintosh]
PK_test
This program asks for the number of runs, the number of trials per run and a parameter which will enable you to set the trial-rate. You specify also an id which will be the same as the filename where the results are stored.
[Download RNG software for Macintosh]
DOS
The DOS disk also contains the files RTESTR.cpp and RAND3.cpp. These are the C++ source codes for the supplied test programs. It is straightforward to translate the functions
init_com, com_ready and read_com into any other accepted programming language.
The program uses one address to indicate where the port in the address space is located. The symbolic name is: BASE. For all DOS-computers this is a standard (03F8hex and 02F8hex for PORT1 and 2 resp.). If you want to use the RNG with a non standard DOS machine it could be that the serial ports are differently located and the internal registers are differently used.
In that case you have to write your own code for the routines:
init_com (initialising the port on 9600 baud, 8 bits, no parity and 1 stopbit)
com_ready (returns '1' if the port has read a byte, '0' when nothing happened)
read_com (returns the byte from the port)
The init_com routine also sets the RTS line high. So even if you use a batchfile or a system command to set the proper baudrate etc. you might need to set this RTS.
In BASIC one could use a POKE statement (but be careful to define the proper segment with DEF SEG; consult your manual)
rem init_com for port 1
BASE_ADDRESS= 0X03F8
POKE BASE_ADDRESS+4, 2
rem com_ready; status = 1 means there is a byte available
IF (int(peek(BASE_ADRESS +5)&& 1) THEN status=1 ELSE status=0
rem read_comm
byte= peek(BASE_ADDRESS)
Macintosh
The Mac keeps the RTS line after opening the serial driver high thus ensuring proper functioning of the RNG.