In one of our previous blog posts, we showed you how to build a cluster of five SwiftRNG Pro devices to achieve a random number generation speed of 1 Gbps of. In this post, we will demonstrate how to measure the speed and verify the quality of random bits produced by a cluster of ten SwiftRNG Pro devices.

For best results, your host machine should meet or exceed the following specifications:

  • A fast CPU with at least 6 cores. (We used a six core I7-8700 CPU at 3.2 GHz.)
  • A mainboard that supports at least 10 USB high-speed ports (USB 3.0 is recommended). We used a ‘Gigabyte Ultra Durable Motherboard Z370 HD3P LGA 1151’.
  • Cent OS 7.
  • 10 SwiftRNG Pro devices — each device should be plugged directly into an available USB port. No USB hubs should be used in between.
  • SwiftRNG software utilities are built and available for CentOS from a command line. Please visit this address for specific details.

Verify that all ten SwiftRNG Pro devices are ready and accessible by entering the following in the command line:

swrng -ld

The output may look like this:

{DevNum=0 DevModel=SWRNGPRO DevVer=V2.0 DevS/N=26AB737E1C09D20}
{DevNum=1 DevModel=SWRNGPRO DevVer=V2.0 DevS/N=A8258CD5FE7B964}
{DevNum=2 DevModel=SWRNGPRO DevVer=V2.0 DevS/N=7F68712D6D6EB12}
{DevNum=3 DevModel=SWRNGPRO DevVer=V2.0 DevS/N=C73785CD7552FCD}
{DevNum=4 DevModel=SWRNGPRO DevVer=V2.0 DevS/N=C1890C098FB1B92}
{DevNum=5 DevModel=SWRNGPRO DevVer=V2.0 DevS/N=F36D8EA26BA7522}
{DevNum=6 DevModel=SWRNGPRO DevVer=V2.0 DevS/N=52CB6954F44C84E}
{DevNum=7 DevModel=SWRNGPRO DevVer=V2.0 DevS/N=66E05DA74F52BDE}
{DevNum=8 DevModel=SWRNGPRO DevVer=V2.0 DevS/N=B2C27DB40F2409A}
{DevNum=9 DevModel=SWRNGPRO DevVer=V2.0 DevS/N=2B2EE4AFBB420F8}

Verify the cluster generation speed is at 2 Gbps by entering the following in the command line:

swperf-cl-test 10

The output may look like this:

-- swperf-cl-test - SwiftRNG device cluster performance test utility  --

Cluster preferred size: 10, actual cluster size: 10 (successfully open)

Setting power profiles to 9 ------------------------------- Success

Post processing  ---( for devices with version 1.2+ )----- disabled 
Performance ------- in progress ------------------ 2000.00 Mbits/sec

Post processing  ------------------------------------------- SHA256 
Performance ------- in progress ------------------ 1333.33 Mbits/sec

Post processing  ------------------------------------------- SHA512 
Performance ------- in progress ------------------ 2000.00 Mbits/sec

Post processing  ---( for devices with version 1.2+ )--- xorshift64 
Performance ------- in progress ------------------ 2000.00 Mbits/sec
Closing device -------------------------------------------- Success

Available for Windows, macOS and Linux, bitcount is a utility that can be used to count the number of 0 and 1 bits in a random byte stream generated by a SwiftRNG device for quality verification. An ideal generator will produce an equal amount of 0 and 1 bits over a period of time; however that is rarely achievable when using real random number generators.

We will use bitcount-cl utility (a cluster version of bitcount) for calculating arithmetic mean of zeroes among all of the random bytes generated by the SwiftRNG Pro cluster. The following command demonstrates how to count 1 and 0 bits for 75,000,000 random blocks (about 1 TB) retrieved from a SwiftRNG Pro cluster (one block equals to 16,000 bytes):

bitcount-cl 75000000 10

This could result in the following output (it will take around 90 minutes to get results):

--- A program for counting 1's and 0's bits retrieved from a SwiftRNG cluster ---

SwiftRNG cluster of 10 devices open successfully

*** downloading random bytes and counting bits using 'default' post processing method ***
retrieved 9600000000000 total bits, 0's bit count: 4800000240406, 1's bit count: 4799999759594, 0's arithmetic mean: 0.500000025

In the output shown above, you will notice a discrepancy between 0 and 1 counts. The cluster produced more 0 bits than 1 bits, however that discrepancy is small and can be ignored. A tiny amount of bias or a small error in random sources would have resulted in a huge discrepancy in counts for 1 terabyte of random data.

Let’s run the same bitcount-cl test several times and record the resulting statistics in a table.

We may end up with the following:

| Total bits sampled | number of bits with 0 values | number of bits with 1 values |  0's arithmetic mean |
| ------------------ | ---------------------------- | ---------------------------- | -------------------- |
| 9600000000000      | 4799999080595                | 4800000919405                | 0.499999904          |
| 9600000000000      | 4800001980675                | 4799998019325                | 0.500000206          |
| 9600000000000      | 4799999260118                | 4800000739882                | 0.499999923          |