quantum-random 1.0.7

A Package to Access Quantum Random Numbers


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

QuantumRandom

This package helps to access quantum random numbers of a quantum random number generator of the Humboldt University of Berlin (HU Berlin), Faculty of Mathematics and Natural Sciences I, Department of Physics. Their website: https://qrng.physik.hu-berlin.de Also, this package provides a ready-to-use D interface for libQRNG.

Current State

Right now, this package can read the downloaded random numbers of the TU Berlin in order to set up e.g. scientific experiments. Re-use the same files to gain deterministic results. If all downloaded files i.e. numbers are used, starts over with the same data.

The QRNG live API can be used to receive endless random numbers over the Internet.

Building

This package builds on top of libQRNG and thus requires the binaries from http://qrng.physik.hu-berlin.de/download to build properly. The required files for a specific target are specified in dub.json.

The DMD linker expects Win32 libraries to be in OMF, not it COFF. It is necessary to convert them. After downloading the necessary binary, copy it to the location which matches your platform, e.g.:

  • Linux: /usr/local/lib/libQRNG.so
  • macOS: /usr/local/lib/libQRNG.dylib
  • Windows: At the moment, Windows is untested.

Usage

QRNG can be used as simple wrapper for libQRNG:

auto ret = qrng_connect("QRNG_USERNAME", "QRNG_PASSWORD");
if (ret != 0)
	throw new Exception(qrng_error_strings[ret]);
	
int[] ints = new int[5];
int received;
qrng_get_int_array(&(ints[0]), 5, &received);

writeln("Random integers: ", ints);

QRNG can be used as random number cache:

// Create an instance of a random double cache which uses the live API as seed source
auto qrng = new DoubleQRNG(new StreamQuantumSeedSource!1024("QRNG_USERNAME", "QRNG_PASSWORD"), 1);
scope (exit) //Defer closing to stop generator thread
	qrng.stop();

auto q1 = qrng.createChunkProvider();

writeln("Random double: ", q1.next());

To do

  • [ ] Implement a deterministic mode for the live API.
  • [ ] Test building with different compilers/linkers.
  • [ ] Windows, DMD
  • [x] macOS, DMD
  • [ ] Ubuntu, DMD
Authors:
  • Thorsten Sommer
  • Robin Kupper
Dependencies:
none
Versions:
1.3.1 2017-Dec-12
1.3.0 2017-Oct-11
1.2.1 2017-Oct-11
1.2.0 2017-Jul-01
1.1.0 2017-Jun-05
Show all 20 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 1067 downloads total

Score:
0.0
Short URL:
quantum-random.dub.pm