Here you can find simple Python, R, C and Java libraries for the purpose of producing radnom numbers from the quatum source. Organization providing source infromation is ANU QRNG through their API. If you use this library on the daily basis or for commercial purpose, I am encouraging you to donate to this people for ther work. Those guys and girls gave tremendous contribution to humanity and modern world by giving this informations for free.
ANU QRNG website
Every programming language(at least that I know of) contains feature for generating random numbers. Though, those numbers are not random in real meaning of the word. Random numbers that you can generate through C, Java, Pyton... are generated using speciffic algorithm. In other word, in this way generated numbers are calculated, what makes them not random, but rather, random from human perspective.
Only way to get reall random numbers using modern day technology is from quantum source. From web site of ANU QRNG you can find out more, how phisics behind all this works.
-
With Python you have to instantiate object
QuantumRand. In the class contructor, firs time is called functionnextthat returns random integer.getRandcall to get random integer.getRandhave two optional paramethersminfor minimal value andmaxfor maximal values that should be returned.getFloatto get random decimal value in between 0 and 1.getFloathave onlydecimalparamether to format return value with exact number of decimal places.nextto generate new random value from the same object.
-
With R
getRandwith paramethersminvfor minimal value andmaxvfor maximal value, that returns random integer value. With R those paramether are mandatory.getFloatreturns random value in between 0 and 1 with parametherdecimalto describe how many decimal places should be in return value.
Every time you call
getRandorgetFloatnew random value is generated. -
With C first you have to call function
QuantumRand_nextto generate random value. Then you can use this long value for your purposes or to call some of specialized functions.QuantumRand_next_minhave parametherminthat allows you to set minimun for returning value.QuantumRand_next_maxhave paramethermaxthat allows you to set maximum for returning value.QuantumRand_next_min_maxhave bothminandmaxparamethers.QuantumRand_get_floatfunction returns float value in between 0 and 1.QuantumRand_nextto generate new random value.
In Makefile, there are example of how you can compile shared object from the code from QuantumRand.h but I believe that the best course of action would be just to include this header file in new object and to compile it with it. QuantumRand.h depends on libcurl and libjson-c libraries.
-
With Java same as with Python, first you will have to instantiate object
QuantumRand. At the same time you will generate first random value for that object to work with.nextwill create new random value and return it.getLongwill return present random value for that object.getLong(min, max)is overloadedgetLongfunction that allows you to determine minimal and maximal random value.getFloatwill return double in between 0 and 1.