Random Number Generator

A Random Number Generator (RNG) is used in Realm Grinder to determine the results of some actions in game. The RNG it uses is pseudorandom, which means that the results of the RNG are deterministic and can be predicted in advance with sufficient information. However, the results are qualitatively random and are very hard to distinguish from real random data without careful analysis.


Instances

The game uses more than one instance of the RNG, and some things in the game have a dedicated instance that only they make use of. In addition, there is a global RNG instance that everything else uses.

Each RNG instance has a state, which is a single number that determines all the future values that instance will output. When something uses an RNG instance, it consumes one or more RNG values, which advances the RNG state and moves up the stream of future values. After the value is consumed, it is processed in some way to make a decision about what should happen.


Persistence

Aside from values being consumed, the states of instances are not reset or otherwise affected by anything in the game, such as abdication or reincarnation. However, only some instances are persistent, meaning that their state is stored in the save file and will be restored when reopening the game or importing a save.

When opening the game, all RNG instances are reseeded, which gives them a new state, and then any persistent instances are overwritten with their state from the save file. When importing a save, no instances are reseeded, but persistent instances are overwritten in the same way. The states being in the save file enables a variety of forecasting tools to work.


List of RNG Instances

Depending on what an instance is used for, it varies what will cause a value to be consumed from the RNG and what will affect how values generated by the RNG are interpreted.

For instance, the Titan spell Lightning Strike will consume a value from its RNG instance provided at least one possible target building is owned. If you own no buildings or only own Halls of Legends and have Lightning Rod (C375), no value will be consumed. How that value is interpreted to decide which building is targeted depends on the number of available targets.

The properties of the game's RNG instances are summarized in the table below.

A Thousand Coins


Artifact Instance

The artifact RNG instance has the most complex behavior, since it is shared by all artifacts. When any number of excavations are purchased, the same process is run, once per excavation bought. First, the non-random conditions of unobtained artifacts are checked. If the non-random conditions are met, any artifacts with no random condition are found immediately.

Artifacts that have a random condition and have their non-random conditions met are eligible and will consume a value from the artifact RNG for each excavation. Eligibility does not mean that an artifact can be found, and most random artifacts can be eligible with a 0% find chance. In particular, the Scarab of Fortune and Voodoo Doll have no non-random requirements aside from owning survey equipment, and are eligible even if you are in the wrong alignment to purchase the buildings their find chances are based on, and cannot obtain them in that abdication.

Eligible artifacts use values from the RNG instance in their instantiation order as listed below. Note that instantiation order is slightly different from how artifacts are ordered in-game. RNG values consumed by eligible artifacts are interpreted as a probability, and the artifact will be found if the RNG value is less than that artifact's find chance. For example, an RNG value of 1% will find an artifact with a find chance of 1% or higher if that artifact consumes that value.

The underlying stream of values doesn't change from anything but excavating with at least one eligible artifact, but which artifact values are tested against can change. For example, if you are eligible for one artifact and will find it in 100 excavations, then the value that will find it is 100 values out. If you become eligible for a second artifact that has a much lower find chance, how that will change the first depends on which is earlier in the instantiation order. If the new artifact is earlier, then it will move the older artifact up to excavation 50, since excavations will now consume two values per excavation and the 100th value will land on the second artifact of the 50th excavation. But if the old artifact is earlier, then the 100th value will land on the new artifact and the old artifact will not be found for at least 50 excavations, until a new value that's small enough to find it occurs in the stream.

As another example, suppose again that you have one eligible artifact that will be found in 100 excavations. If you abdicate and set up a different run where you have four eligible artifacts and then excavate 24 times, that will consume 96 RNG values assuming you don't find any of them. If you then go back and become eligible for only the original artifact, it will be only 4 excavations away, or 95 earlier than before, as long as you have at least as good a find chance as before.

A Thousand Coins


Technical Details

The RNG used by Realm Grinder is the older Park-Miller minimal standard linear congruental generator (a=16807, c=0, m=(2 ^ 31) - 1). Its states are integers from 1 to (2 ^ 31) - 2. When it generates a value, it multiplies by 16807 and then divides by (2 ^ 31) - 1 and takes the remainder. The resulting value is the next output of the generator and becomes the next state. Each possible state produces a different value, so all the possible values are generated in a big cycle. The state is where a particular instance is currently in that cycle.

Special Thanks: Pseudobyte

| Resources | Soft Resets | Buildings | Heritages | Bloodlines | Spells | Excavations | Challenges | Upgrades | Trophies | Factions | Research |

| Merc Builds | Research Builds | Prestige Builds | Dragon Unlock | Neutral Prestige Builds | Research Tree |

| Vanilla Factions | Good Factions | Evil Factions | Neutral Factions | Prestige Factions | A2 Elite Factions |

| Events | Latest Major Patch | Changelog | Notation | Terminology | Tools | Kongregate Links |

| Fairy | Elven | Angel | Goblin | Undead | Demon | Titan | Druid | Faceless |

| Mercenary | Dwarf | Drow | Dragon | Archon | Djinn | Makers |

Contact me G00FBALL

Thank You!!! for all your help.

5ku||3d

6000j

7636kei

Aaborg

Aaron Cook

acbdefgfedbca

acer4321

Ach3ck

AJZ3

AKL

Alright

Altoscholto

Amirin

Anathah

AndreikaD

Antendren

apocal_88

arcanmster

Archmage

arintayn2

ARTEZZ

art-of-dom

ash1soccer

Ashthar

aurora

aviv

Azua

Bearpaws

BigGeak

bigshawnt

BillK14

BionicFrog

BioRules

blackbird

Blackeye

Blue

bobbert

Boffo

Book909

boss_mc

Boyo

brc48632

Breeze

btzeroes

burninglegion64

BuzzMarzz

CafeMaker

CamoBrie

capito27

Chaos

Chaosmancer7

chaosmarine4226

CheeseWitch

chris

chrispi

CHRullz

Ck

CluelessWonder

Coal_CC

ColdDrake13

Corgi

cralo

Cromedome

Cromieplays

Curunur

Cyden

Da Banana Man

DainDwarf

Damxacer1

Dariof4

DED SERVER

Delichtig

Dienes

djones0823

djru8ix

Doubleshoe

dox4242

DR

Draven

Drogor

drseilzug

EagleAgg03

Ebilkill

ehyder

eleganceseraph

ElJay

Eltro

Enexplogen

ensteffahn

ErrolErrolson

escalon

Essigschurke

Evengrey

Exsanguine

FastHit

FedeJossa

Fire

Flameslinger01

Fonzoland

Franelas

Freakomant

Fryguy9

furkannnO

fwbx529

gaccount

GalacManta

gamemasterty

Geno

Ghorre

Glitchstorm

Goholtramor

Grazloth

GreenMJ13

grelf

Guy

gvaiou

HeinQuek

HellTest

Heronimo2

heyitsdross

hiimahotdog

homebrewer54

Hotspot

iam10ninjas

Ignus

Igorogi

iluxa4000

Ilya

ivanovichkoslov

j8ner

jabberok

Jakeb2002

Jenetikitty

JezuzLizard

JGChan

jgchan29

Joa

johnharveybc

johnleprude

johny_blaze

jonny0panic

Just1pirate

Just1pirate

kabuto44

Kacper

Kain

Kanra

Kaos

Keben

kiluh

KRIEG

Kroll

kuerti

KuraTheDog

Kurt-bookboy

KyonLevic

Lailoken

Lapare

Lavi04

Lavi04

Lead Luigi

LeoB516

LeoC.II

lesd

lesdruides

Liraso

Lollipop

lordulster

Luio2revenge

lvl 1 crook

magnanimousCynic

Magnusly

ManDude33

mangafreak140

mangaking118

MarioFanaticXV

masteff

Masterzan

Matrix4767

Max Schradin

Maya

McguyverZero

Mechaflood

Merp

Milkopilko

mpeechee

Mr.Celedown

MrGerman

mrothorr

myogin

Mysticman89

MythWiz_

nakota

Namelessname

NateMcCloud

Necrodoom

NecroXD

Neutral Potato

NeutralPotato

Nizidramaniiyt

noonomoon

NTWgreatest

NTWgrinder

oholoko

Okami

okunderground

onianinara

Onoxious

Origin

oswarlan

OvenBakedGod

Paah

pacmanlite

Palamazzi

Parasitez83

Piezza24

pizza_troll

pkal

plaaosert

player2aj

Polibus

Popington

primal cradily

Proxy

pseudobyte

PseudonymousBosh

Pyxl

q1235

raato

Rade

RageBall

RastlinV

RebelKeithy

Redd

Redd

Regulus

Reknot

RetroDerpSquid9

rhaek7

Rustle Crowe

Ryonir

saitenhieb

SamGooBat

Sandworm

Sas Assassin

Sc0rp

Sefa

Seyliz

Shantie

shayner12

Sheer

Sho Phaune

Skulled190

Slakkarn

Slakkarn

slantfer

solidifiedmind

somarilnos

SomeoneLucas

Soulrift

Space Troll

spamtraprus

Spanosa

SRT

StAUG

stmlee

Stoner Claff

Sum Yung Gai

sunk

Suranis

swim

Synthini

Sythen2014

tangyifei

Tanny

Taxiway

tbrown30

Teabagger Vance

Technosaurus

Tenebricosus

Tenyasha

ThatGuy

The Homa

ThePeon

Thorian

toifel131

Tornadobird

torskenn

trevYT

Trewq_

TrostNi

Tskami_ek

Tyler

ukulelejongetje

UndeadAbbys

Uni

Username

uwnim

Valentin

Versine

VilgefortzPL

Vince

waga baba bobo

WaitingIdly

waterfire425

websterguy

Weedheter

Wlerin

Wolf415

wolfsblood

woopemgood

WynneYilmaz

xemima

XenosHg

Xentha

XenTwo

xeperiset

Xikre

Xorious

Xpt14

xXRochforteXx

Yarilo

ydc1017902176

yob

Zange

Zaraza

Zariars

Zeckenschwarm

Zeen

Zelphh1

Zepto

zionhian

Zyllyn

Zylon

Дикий Речной Пёс

visitor counter