A Package to Access Quantum Random Numbers
To use this package, run the following command in your project's root directory:
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
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.
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
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.:
- Windows: At the moment, Windows is untested.
In case of macOS, the following error message could occur after compiling the application:
dyld: Library not loaded: /usr/local/lib/libLibQRNG.dylib Referenced from: PATH TO YOUR APPLICATION WHICH USES THIS LIB Reason: image not found
If so, please add the following command to the end of your
"postGenerateCommands-osx": ["install_name_tool -change /usr/local/lib/libLibQRNG.dylib /usr/local/lib/libQRNG.dylib $PACKAGE_DIR/bin/$$DUB_TARGET_NAME || :"]
QRNG can be used as simple wrapper for
auto ret = qrng_connect("QRNG_USERNAME", "QRNG_PASSWORD"); if (ret != 0) throw new Exception(qrng_error_strings[ret]); int ints = new int; int received; qrng_get_int_array(&(ints), 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());
- [ ] Implement a deterministic mode for the live API.
- [ ] Test building with different compilers/linkers.
- [ ] Windows, DMD
- [x] macOS, DMD
- [ ] Ubuntu, DMD
- Registered by Thorsten Sommer
- 1.0.12 released 3 years ago
- 2-clause BSD