Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old June 27, 2016, 07:47   #1
brbrbr
Adept
 
Join Date: Sep 2015
Posts: 104
brbrbr is on a distinguished road
RNG under fire

Ok, I've put it to the test.

Here is the "scientific" research of Angband RNG.
I've compiled small C program using 4.0.5 code.
The result is:


https://www.dropbox.com/s/b2ylwtzekq...42.37.png?dl=0

It doesn't like 45-47 numbers and likes number 10, but difference between highest and lowest peaks is less than 0.45%.
Seems to be fair....

Next time I will try it for longest sequence of numbers below 5% (common spell failure rate) )

Last edited by brbrbr; June 27, 2016 at 07:54.
brbrbr is offline   Reply With Quote
Old June 27, 2016, 12:44   #2
PowerWyrm
Prophet
 
PowerWyrm's Avatar
 
Join Date: Apr 2008
Posts: 2,732
PowerWyrm is on a distinguished road
Quote:
Originally Posted by brbrbr View Post
Next time I will try it for longest sequence of numbers below 5% (common spell failure rate) )
Yesterday I've beaten my infamous spell failure record: I've failed a 1% fail spell four times in a row (was three times before). Hail the mighty RNG!
__________________
PWMAngband variant maintainer - check http://powerwyrm.monsite-orange.fr (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!
PowerWyrm is offline   Reply With Quote
Old June 27, 2016, 15:08   #3
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,946
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by brbrbr View Post
Ok, I've put it to the test.

Here is the "scientific" research of Angband RNG.
I've compiled small C program using 4.0.5 code.
The result is:


https://www.dropbox.com/s/b2ylwtzekq...42.37.png?dl=0

It doesn't like 45-47 numbers and likes number 10, but difference between highest and lowest peaks is less than 0.45%.
Seems to be fair....

Next time I will try it for longest sequence of numbers below 5% (common spell failure rate) )
What do the different coloured lines all mean?
__________________
takkaria whispers something about options. -more-
takkaria is offline   Reply With Quote
Old June 27, 2016, 21:44   #4
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,667
Donated: $40
Pete Mack is on a distinguished road
mod 100 should be pretty uniform unless the 1 2 or 4 bit is messed up. Each of the bytes in the random number would be more likely to find a bug..but the first 4 bits are the likeliest to be broken. However, statistical streaks of the same value in a row are more interesting. Most RNGs break down here, and have a lower chance of long streaks in the same range. But again, doing it mod 100 will mask any such tendency. For that, you want to do it by division, not mod.
Pete Mack is offline   Reply With Quote
Old June 28, 2016, 00:16   #5
brbrbr
Adept
 
Join Date: Sep 2015
Posts: 104
brbrbr is on a distinguished road
Quote:
What do the different coloured lines all mean?
There were 3 runs with 3 different seeds = different colors.

Quote:
Originally Posted by Pete Mack View Post
For that, you want to do it by division, not mod.
Yeah, andgband code does it by division.
brbrbr is offline   Reply With Quote
Old June 28, 2016, 01:44   #6
brbrbr
Adept
 
Join Date: Sep 2015
Posts: 104
brbrbr is on a distinguished road
RESULTS:
Longest streak of drawing below 5% was 5 in 10000000 tries

Now, we have to account for monter RNG calls too.
The way it works, you try to cast a spell (one call to RNG), then monster hit, breathe, hit (three more calls to RNG), then you try to cast again (another RNG)
So, I modified code to count sequence of every Xth call for RNG.

Here are more results for X=4:
Longest streak of drawing every 4th below 5% was 6 in 10000000 tries

Quote:
Originally Posted by PowerWyrm View Post
Yesterday I've beaten my infamous spell failure record: I've failed a 1% fail spell four times in a row (was three times before). Hail the mighty RNG!
Longest streak of drawing every 4th below 1% was 4 in 10000000 tries
You are absolute winner, PowerWyrm )))))))
brbrbr is offline   Reply With Quote
Old June 28, 2016, 02:15   #7
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,667
Donated: $40
Pete Mack is on a distinguished road
The a priori odds for 5 in a row on a d20 is 3e-7, so in 1e7 tests,
5 in row is roughly the expected max run length. A stronger test is to find the distribution of all 20 buckets, and compare the run lengths to the corresponding poisson distribution. (Note that you need to use the expected run length of 1/(1-0.5).)

Quote:
Originally Posted by brbrbr View Post
RESULTS:
Longest streak of drawing below 5% was 5 in 10000000 tries

Now, we have to account for monter RNG calls too.
The way it works, you try to cast a spell (one call to RNG), then monster hit, breathe, hit (three more calls to RNG), then you try to cast again (another RNG)
So, I modified code to count sequence of every Xth call for RNG.

Here are more results for X=4:
Longest streak of drawing every 4th below 5% was 6 in 10000000 tries


Longest streak of drawing every 4th below 1% was 4 in 10000000 tries
You are absolute winner, PowerWyrm )))))))

Last edited by Pete Mack; June 28, 2016 at 02:22.
Pete Mack is offline   Reply With Quote
Old June 28, 2016, 03:13   #8
brbrbr
Adept
 
Join Date: Sep 2015
Posts: 104
brbrbr is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
The a priori odds for 5 in a row on a d20 is 3e-7, so in 1e7 tests,
5 in row is roughly the expected max run length. A stronger test is to find the distribution of all 20 buckets, and compare the run lengths to the corresponding poisson distribution. (Note that you need to use the expected run length of 1/(1-0.5).)
Huh!
Good to know it fits statistical expectation.
Other buckets are not that interesting, from Angband point of view

So I satisfied myself and do believe in RNG now. If anyone is still in doubt, send them to me ))
brbrbr is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Out of the frying-pan into the fire brbrbr Vanilla 12 August 18, 2016 12:17
Are meteors on fire? Ingwe Ingweron Vanilla 15 October 29, 2015 15:30
Oil and Fire. buzzkill Development 1 April 25, 2011 22:20
The RNG Giveth, the RNG Taketh Away tprice AAR 2 February 21, 2011 14:15
RNG giveth and RNG taketh away Jungle_Boy AAR 0 June 14, 2010 17:59


All times are GMT +1. The time now is 07:26.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.