paint-brush
Not All Random Number Generators Are Created Equalby@felixarpa
342 reads
342 reads

Not All Random Number Generators Are Created Equal

by Felix XuNovember 11th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

In this article, we'll delve into what RNGs are, their types, and why they are crucial. We'll also discuss the problems with existing solutions, what makes a good RNG, and introduce you to Randcast, a game-changing RNG designed for the decentralized future.

People Mentioned

Mention Thumbnail
featured image - Not All Random Number Generators Are Created Equal
Felix Xu HackerNoon profile picture

Would you play a game with an unfair and biased pattern of rewarding in-game items?


Probably not.


After all, no one wants to put all that time and money into something only to end up with very little. Yet, most of us always assume that lottery numbers are picked randomly. Or that in-game items are allocated fairly.


The reality may surprise you.


In the world of technology and Blockchain, randomness plays a pivotal role in ensuring fairness, security, and unpredictability. Whether you're participating in an online lottery, trying to get allocated rare non-fungible tokens (NFTs), or playing a game for its rare game items, the need for truly random numbers is paramount.


This is where Random Number Generators (RNGs) come into play, but not all RNGs are created equal.


In this article, we'll delve into what RNGs are, their types, and why they are crucial. We'll also discuss the problems with existing solutions, what makes a good RNG, and introduce you to Randcast, a game-changing RNG designed for the decentralized future.

What Is a Random Number Generator?

A Random Number Generator (RNG) is a fundamental component of modern computing and Blockchain technology. It's a tool that produces a sequence of numbers or values that does not follow any discernible pattern. There are three primary types of RNGs:


  1. Pseudorandom Number Generators (PRNGs)


    PRNGs generate numbers using algorithms and a seed value. While they appear random, they are actually deterministic and produce the same sequence of numbers if given the same initial seed.


    Imagine using a password generator that spins up passwords that can be recreated because it was not randomly generated. That is the risk of using PRNGs. They are widely used in software applications but are not suitable for applications requiring true randomness.


  1. True Random Number Generators (TRNGs)

    TRNGs rely on physical processes, like electronic noise or radioactive decay, to generate truly random numbers. They provide a higher level of unpredictability compared to PRNGs, as these physical phenomena are expected to be random.


    However, the physical processes that TRNGs rely on may exhibit certain patterns over a long enough time period, compromising its randomness. Furthermore, TRNGs are limited in speed, as sufficient entropy must be collected- i.e., the physical phenomena need to play out for the output to be truly random. This makes it difficult to apply TRNG solutions at scale.


  2. Hardware Random Number Generators (HRNGs)


HRNGs are dedicated hardware devices that generate random numbers based on physical phenomena within the hardware itself. These hardware devices have constant access to a physical entropy source that generates statistically random signals. They offer a high degree of security and are often used in cryptographic applications.


However, just like all physical objects, HRNGs are subject to physical decay. As the HRNG goes through decay, the numbers generated are no longer random. This situation is hard to detect, making it difficult to know when the randomness is compromised.

Why Do We Need Random Number Generators?

There are many scenarios where randomness is needed. From gambling to network security, the emergence of Web3 projects and protocols has escalated the need for verifiable random number generators.


Let’s explore a few use cases where RNGs are a must and not a “nice-to-have.”


Ensure fair NFT allocations and pick unbiased lottery numbers It seemed like a lifetime ago when Non-Fungible Tokens (NFTs) were highly sought-after commodities. Back then, NFTs that were unique and rare were selling for sky-high prices. While the NFT market currently remains bearish, this is a good opportunity to implement RNGs before the next bull run. RNGs provide a transparent and provably fair mechanism for distributing NFTs.


Furthermore, unique traits of an NFT are allocated in a random manner using RNGs. This not only safeguards the value of the NFT but also enhances trust among collectors and creators alike. Making NFTs a legitimate asset class in the eyes of the mainstream.


RNGs also play an instrumental role in conducting efficient and fair lotteries. Each number has an equal chance of being picked and is not influenced by past results. This ensures that every participant has an equal chance of winning, thus fostering transparency and trust in lottery draws.


Photo by Pixabay: https://www.pexels.com/photo/cards-casino-chance-chip-269630/


Unbiased selection of block producers

Block producers are rewarded by the network for their work. Therefore, malicious actors are incentivized to tamper with the block producer selection process. The random number generation process in some Blockchain networks can be easily manipulated.


For example, a network may use the block hashes as the source of randomness. In such a situation, malicious actors can withhold the block, which negatively affects the network security.


RNGs are instrumental in randomly selecting block producers, reinforcing the decentralization of Blockchain networks, and preventing potential tampering. As the value of the network increases, it becomes more crucial to use RNGs in the selection process.


Verifiably generating random numbers guarantees that block production remains a truly random process, preventing centralization tendencies.


Make Web3 games fun and credible Gaming may be the next wave that brings in new users to Web3 and drives the next bull run. The most exciting games are fair and unpredictable. They always give each player hope of winning, knowing that a single win can land them that rare item that turns the tide.


RNG has the potential to make Web3 games fun and exciting. Knowing that each person has the same “luck” and that their skill is what sets them apart, will drive players to play harder at the game. Any disputes by players about the game can be resolved in a transparent and fair manner.

What Makes a Random Number Generator Great?

There are two components to a Random Number Generator (RNG).


It needs to:

  • Be able to generate numbers

  • Generate numbers that are verifiably random


Most users have no issues with finding an RNG that does point number 1. However, the true value-add is from doing point 2 well.


A great Verifiable Random Number Generator (RNG) produces random numbers that

  • Can be verified to be random

  • Has a decentralized source of randomness (no single point of failure)

  • Is able to withstand attacks


Let’s dive deep into each of these points.


Can be verified to be random The output of an RNG is random if each number produced by the RNG is statistically independent of others, ensuring that selecting one random number does not affect the probability distribution of subsequent selections. Put simply, each number has an equal chance of being selected.


Furthermore, anyone can prove that the random numbers generated by an RNG are valid. This can be done by verifying the correctness of the hash output. The proof can be calculated to ensure its verifiability, and this is key to resolving disputes. This ensures that the RNG's output remains consistent and dependable in scenarios where multiple random selections are required.


Has a decentralized source of randomness (no single point of failure)

A good RNG has decentralization at the core of its design. It does not have a single point of failure, ensuring it is highly resistant to manipulation. I.e., the output of the RNG is verified by a network of nodes, instead of a single source.


By distributing the generation process across multiple nodes in a decentralized network, it becomes nearly impossible for any single entity to exert undue influence, thus guaranteeing the integrity of the generated random numbers.


Is able to withstand attacks RNGs are always open to attacks from malicious actors who want to manipulate the outputs in their favor. A good RNG is built to withstand attacks aimed at predicting or controlling the generated numbers.


Robust cryptographic algorithms and secure protocols are employed to safeguard the integrity of the RNG, making it a trustworthy source of randomness for a wide range of use cases.

Consequences of Not Using RNGs

We have now established the benchmarks for a good RNG. But what if good RNGs are few and far between? What if games, Blockchain networks, and Decentralized Applications (DApps) do not see the need for RNGs and hence do not use them?


Firstly, the network security will be compromised. If validators know that the block producer selection process is not random, they can manipulate outcomes that only benefit themselves.


Compromising the integrity of the network and giving control of the network to these malicious actors.


Secondly, not using RNGs in games and NFT allocations means that rare in-game items and unique NFTs will be distributed according to a pattern. Players who are aware of the pattern will consistently receive benefits that far outweigh their skill set and the time they spend on the game.


Sensing that the game is rigged, honest players will lose interest over time and leave the game. Before long, the game will go into a downward spiral where players leave, and the value of in-game items drops leading to even more quitting the game.


Lastly, not using RNGs will stunt the growth of Autonomous Worlds, a concept where games are fully decentralized and owned by the players themselves. In the Autonomous World, the games are powered by Blockchain technology, and every in-game transaction can be verified on chain.


Instead of trusting the company that developed the game like what we see in Web2 games, players in the Autonomous World put their trust in the underlying Blockchain technology.


However, if the game outcomes that rely on chance are found to be biased, the community will lose trust in Blockchain technology.

Generate Random Numbers Fully On-Chain

Now that we know the implications of not using a verifiable RNG, let’s explore the advantages of ARPA Randcast, a verifiable RNG that is fully on-chain.


Randcast is an on-chain verifiable random number generation service along with an easy-to-use Smart Contract SDK that can be directly integrated to build a DApp or Web3 game that requires randomness.


The out-of-the-box functionalities it provides include but are not limited to rolling dice, shuffling arrays, determining in-game item attributes through probability, creating random in-game maps or dungeons, and managing lottery probability outcomes.


Most RNGs, especially in Web3, are off-chain, which means the data source is opaque and could be compromised without us knowing. By using Randcast, the entire process is fully on-chain, from the request to fulfillment.


The approach to decentralization and availability stands out as one of the most critical aspects. Randcast employs a threshold network and enables a fallback mechanism by all capable groups, significantly reducing the risk of a single point of failure, a problem that other RNGs in Web3 continue to face today.


This approach ensures continuous availability of the service and enhances security by distributing processing across multiple nodes. Furthermore, Randcast's automated features, such as auto-computing callback gas estimation and conducting accumulative inflight balance checks, remove the burden for the user from managing these aspects.


These factors make the system more accessible to users who may not possess high technical proficiency. Overall, these features render Randcast a more robust, user-friendly, and decentralized solution when compared to more popular alternatives such as Chainlink VRF.




Furthermore, the outputs of Randcast can be verified to be random. Randcast leverages the ARPA Network when handling random requests. ARPA Network consists of many nodes that perform BLS threshold signature tasks, which are verifiably random.


By virtue of underlying cryptographic primitives, The random number is unlikely to be forged or manipulated. Randcast will receive the randomness request, the ARPA Network nodes will generate the randomness, and the adapter contract will verify the randomness.


For a full description of Randcast, read the documentation.

Build The Future Autonomous Worlds With Randcast

The pivotal role of randomness in today's technological landscape cannot be understated, especially in the domains of blockchain and gaming. Randomness ensures fairness, security, and unpredictability.


As we journey further into the decentralized future, it's essential that our systems and applications have access to verifiable random number generation, a feat not easily achieved with traditional RNGs.


Randcast, with its on-chain approach, not only addresses the common challenges faced by other RNGs but also pushes the boundary of what's possible. It leverages the power of decentralization, making the process transparent and resistant to manipulations.


By doing so, it stands as a pillar of trust for decentralized applications, especially in a world where trust is increasingly rare.


In the dawn of Autonomous Worlds, where players don't just play but also trust the underlying blockchain technology for every move they make, it's imperative that the foundation is built on transparency, trust, and verifiable randomness.


Randcast is a significant step in that direction, heralding a future where technology serves not just to entertain or secure but to ensure fairness and credibility at every turn.


For those building the decentralized applications of tomorrow, Randcast offers a beacon of trust. It is not just a tool, but a vision of a future where fairness and unpredictability are guaranteed, where games, lotteries, and blockchain transactions are as random as nature intended.