Quantum Dice QEaaS API 1.0.5
 
Loading...
Searching...
No Matches
Running python demo

Overview

The python demo is the simplest to run as it does not require anything to be built.

Steps

Unpack the software package.

Unpack the software package into a convenient directory. In that directory you now have:

qdremdemo.py
qdremrand.py

The qdremdemo program fetches and prints out various forms of randomness: raw bytes, integers, uniformly distributed floating point numbers, and normally distributed floating point numbers.

Run the demo script

Run the demo script with the command below:

python3 qdremdemo.py qeaas.q-dice.com 20804 qdservroot.pem zeffereor_chain.pem zeffereor.key

It should print something like this:

256 random bytes: b'M\x9d?[\n\xf0\xe2!A{X\xb6\xa0\xb1\xcd\xac4\x97\xc3\xa6\x1c\x96\xd2\x98\xbe.\x1d\x8c~6\xfa\xbai\x02\xcf\xc1\x8eNF\x81\xa3\xb80i\r L\ne\x1f\xc9M\x91\x8f\xcb\xed\x0c_\x9b\xaa\xc4\x12\xc5\xc5P\xdeM\x82\xb4\xb6\x82v\xe2\xdam\x9f\xacXn\xdffqV\xbd\xcb\xd6Y\xc9,\x0e\xb5\xe2[K\x01NV\xe3J\xb5pv,\xbd\x90\xd0\xff\x8a6\x1d\x88"\xa2\x1d\xaeW\xf9\x93\x1d\x19\x9eR\xd7\xdb\x00!\x7fp\xdf\x81:\xd7\xdb\xf7?B\xbc\xdb\x82h\xb1\x834\x86/\xe8,\x0c\xf7\xd0w}\x00\xdf,v\xe7&_\xcb<\xe5\x95\x9bJ\xe9=u\xcc]\xb0\xc6\x91\x07\x14\'\xd9\xe4\x08\xb9:\xf6\xe03ry_\xc2b@\xba\x9e5\xfc\x0c\xdc\xcd\xfb\xa9\x99PD\x86\x1b\xfc\xb3P\xcf\x9e\xdc\xcd\x98\x02n\x04\x83)3\x1b\x98\xdcs\x06\x82mY\xb1\xb8\xa6(\x8a@\xdc\xbe\xee\xb3OPe@\xe4hZ\x1f\xcd_\xa0\xf4\x81S\x83\x85]\xdb\xc1\x94'
Random 32-bit integers:
2217162
1019222
5836605
5988316
4194168
6439052
5544599
7134906
Random floating point numbers from uniform distribution [0.0, 1.0):
0.5497786944254515
0.82426737826219
0.21252745697550543
0.915079405664101
0.9802547672202888
0.5820760952342642
0.6926112706641641
0.38650297300085307
Random floating point numbers from normal distribution mean=42, standard deviation=5:
39.60684742184043
50.10536941007494
40.47614346418243
47.55651864284506
50.83312081901092
39.324223360266394
36.65632995615108
48.006603374361646
Certified random data:
da 89 d4 55 ff a7 ff 71 from 120 bits, with 66.4140625 bits of entropy
36 d3 7f a2 f4 c1 f8 f4 from 120 bits, with 66.484375 bits of entropy
22 c8 87 76 76 fe 76 e2 from 120 bits, with 66.4609375 bits of entropy
76 f1 d8 0f cb eb b1 11 from 120 bits, with 66.3984375 bits of entropy
a3 cb ed 33 5c a5 18 1d from 120 bits, with 66.4453125 bits of entropy
9b 6e fb eb a0 25 cc 2c from 120 bits, with 66.484375 bits of entropy
29 fa 62 bf 50 74 65 2b from 120 bits, with 66.390625 bits of entropy
54 8a ab 82 ad 03 8d 2a from 120 bits, with 66.4609375 bits of entropy

Certified random data is provided in blocks which contain 64 bits of randomness each. Each block was generated from unconditioned data, the size of which is shown. The estimated entropy content of that unconditioned data is also shown. While the entropy is shown as being greater than 64, obviously the actual conditioned data cannot fit more than 64 bits of entropy into 64 bits of data. The entropy estimate is larger because the conditioning guarantees to provide at least (and therefore exactly) 64 bits of entropy in the 64 random bits. If a fault arises in the entropy source, the reported number of bits will be less than 64 (in fact, almost certainly 0) which shows the randomness should be discarded. In contrast, fetching uncertified random bits during a fault condition will block until the fault is corrected - it will never return data which has an entropy estimate less than its size.