RANDOM NUMBERS GENERATION

A pseudorandom number generator (PRNG), is an algorithm for generating a sequence of numbers whose properties approximate the properties of sequences of random numbers. PRNGs are central in applications such as simulations (e.g. for the Monte Carlo method), electronic games (e.g. for procedural generation), and cryptography.

Good statistical properties are a central requirement for the output of a PRNG. In general, careful mathematical analysis is required to have any confidence that a PRNG generates numbers that are sufficiently close to random to suit the intended use.

A PRNG suitable for cryptographic applications is called a cryptographically secure PRNG (CSPRNG). A requirement for a CSPRNG is that an adversary not knowing the seed has only negligible advantage in distinguishing the generator’s output sequence from a random sequence. In other words, while a PRNG is only required to pass certain statistical tests, a CSPRNG must pass all statistical tests that are restricted to polynomial time in the size of the seed.

**Prototype of our RNG algorithm**

Some brief explanation of RNG methods.

Coin based algorithms:

**The Four Sources of RNG Coin’s built-in functions for random number generation:**

1. The source of entropy for random number generation is the original sequence of bytes. To get it we use the Time Stamp Counter, assembler instructions for the x86 and x86_64 platforms, reading the TSC counter and returns in the EDX: EAX 64-bit number of cycles since the last reset, reboot of the processor.

https://en.wikipedia.org/wiki/Time_Stamp_Counter

2. The resulting bytes are mixed in an unrecoverable order, using RAND_add from the SSL library. A description of the function is here:

https://www.openssl.org/docs/man1.0.2/crypto/RAND_add.html

3. The OS system function of Linux is used to get another random 32 bytes. http://man7.org/linux/man-pages/man2/getrandom.2.html

4. RDRAND – Read Random Number, returns 32 bytes generated by the hardware of the computer http://www.felixcloutier.com/x86/RDRAND.html. The resulting bytes are mixed in the CSHA512 class, the Write method and the Finalize method.

**PCG family:**

PCG is a family of simple fast space-efficient statistically good algorithms for random number generation. Unlike many general-purpose RNGs, they are also hard to predict.

Permuted Congruential Generators (PCGs) are a family of RNGs which uses a linear congruential generator as the state-transition function, and uses permutation functions on tuples to produce output that is much more random than the RNG’s internal state.

*A PCG differs from a classical linear congruential generator in three ways:*

• the LCG modulus and state is larger, usually twice the size of the desired output,

• it uses a power-of-2 modulus, which results in a particularly efficient implementation with a full period generator and unbiased output bits, and

• the state is not output directly, but rather the most significant bits of the state are used to select a bitwise rotation or shift which is applied to the state to produce the output.

PCG was developed by applying TestU01 to reduced-size variants,[7] and determining the minimum number of internal state bits required to pass BigCrush. BigCrush examines enough data to detect a period of 235, so even an ideal generator requires 36 bits of state to pass it.

Comparing PCG Family with other popular RNG algorithms.

**Block hash method:**

Blockchain provides a unpredictable hash numbers. If the miner finds that the value of the bet is much higher than the block reward, they might discard the block, rather than choosing to mine on it. There is also a risk involved if there are too many bock hashes involved between the first call and the final reward call of the bet, The block hash returns the value zero if the block hash number exceeds 256. Block hash method s a very unpredictable method for receiving strong RNG seed.

Combining all these methods together, we providing strong and unpredictable RNG generation, which could pass the BigCrush examines. Late 2018 we plan to pass the certification of our RNG algorithm from the proper authorities, officially improving our RNG.

Join our Official Telegram Channel (English) and discuss about Rng Coin with more than 1500 members!

Official Telegram ChannelDid you have any questions? Write to us about your problem, and we will get back to you as soon as possible

Contact us