Page 1 of 1

Game definitely not random

PostPosted: Friday, 1st February 2013, 13:48
by Pachugo
Hi everyone :D
I've tried to search in the forum, but I just couldn't find anything, maybe because I'm not used to these things, or maybe because I'm not a really good english speaker and I just tried out the wrong words or whatever.
The point is, in the last week the game isn't as random as it was before. Every damn character I try (and I've sacrified a lot of characters, trust me :roll:), i finish up encountering the same uniques every time. Jessica is an overly attached girlfriend, she is always waiting for me on the third floor, always! She's not tough, but.. it's just not funny this way :( For two months, i've never encountered Ijyb, now he's everywhere. The same for Sigmund and Terence. What the hell is wrong?
Furthermore, the last five times I've played I found, on the first floor, a venom dagger. I mean, five times the same venom dagger?
I play the offline 0.11.2 tiles version. I've tryed to download it another time, but nothing changes.
Any ideas?

Re: Game definitely not random

PostPosted: Friday, 1st February 2013, 14:04
by mumra
This is probably what is known as "clustering illusion".

The theory is that someone, somewhere, will get exactly the right RNG rolls for this to happen to them. That person will therefore post here or on the bug tracker because it appears that their RNG is broken.

The fact that exactly one person has posted this proves the theory.

Re: Game definitely not random

PostPosted: Saturday, 2nd February 2013, 02:43
by savageorange
To put it more mathematically: the set of randomly generated games/sequences of games includes strictly all possible 'themed' games/sequences of games .
If this was not true (-> the RNG wouldn't generate themed games/sequences of games), THEN there would be serious grounds for thinking the RNG was not random.

Unless you are getting the same unique on the same DL 50+ times in a row, we should avoid artificially constraining the RNG output.

Personally I'd like to have something like the Brogue seedscummer so we could setup themed runs / be able to compare multiple player's playing of the exact same game.

Re: Game definitely not random

PostPosted: Saturday, 2nd February 2013, 06:21
by XuaXua
I cannot remember the last time I have entered a level containing only one early game unique; they always come in at least pairs, or in the case of the elf twins, triplets.

Re: Game definitely not random

PostPosted: Saturday, 2nd February 2013, 07:01
by byrel
XuaXua wrote:I cannot remember the last time I have entered a level containing only one early game unique; they always come in at least pairs, or in the case of the elf twins, triplets.


Your experience is much gentler than mine. For me they "come not single spies but in battalions." I seem to have a knack for getting Pikel, Sigmund, the Elf twins, and quite likely Jessica as well on a level. I think Crawl is trying to teach me to run away...

Re: Game definitely not random

PostPosted: Sunday, 3rd February 2013, 02:51
by Grimm
We should issue a Crawl Tavern Bingo card to all new forum members.

Re: Game definitely not random

PostPosted: Sunday, 3rd February 2013, 04:00
by XuaXua
byrel wrote:
XuaXua wrote:I cannot remember the last time I have entered a level containing only one early game unique; they always come in at least pairs, or in the case of the elf twins, triplets.


Your experience is much gentler than mine. For me they "come not single spies but in battalions." I seem to have a knack for getting Pikel, Sigmund, the Elf twins, and quite likely Jessica as well on a level. I think Crawl is trying to teach me to run away...


I was trying to be gentle, but yes my experience is similar. That's 3.

Re: Game definitely not random

PostPosted: Sunday, 3rd February 2013, 08:19
by byrel
Grimm wrote:We should issue a Crawl Tavern Bingo card to all new forum members.

I'm assuming I gave someone "Quoting or referencing obscure foreign literature"? I hadn't noticed the Tavern Bingo thread before. Is there actually a canonical form? I think I may have to take this up. :twisted:

Re: Game definitely not random

PostPosted: Saturday, 2nd March 2013, 22:16
by brendan
Hi,

I wrote the current version of the random number generator to replace Mersenne Twister because a player figured out how to predict the state. In general writing a random number generator is a very bad idea. If you doubt me look at java.lang.Random.

The generator is seeded from the system's pseudorandom number generator, combining that output with the current system time and process id.

The generator has a 160-bit internal state. This is a very large state. For those keeping score at home, there are approximately 2^190 atoms in the sun.

The design is based on combining JKISS, a non-cryptographic RNG, with an alternating step generator (ASG).

JKISS works by jamming together three different so-so RNGs: one linear congruential generator (LCG), a multiply-with-carry generator (MWC) and a xorshift generator. I have slightly modified JKISS to make it resistant to the types of cryptanalysis that a crawl player might attempt.

An ASG works by combining the output from two independent generators and alternatively advancing them based on the output of a third 'gate' generator. In this case, I use a 32-bit Galois Linear Feedback Shift Register as the gate and advance a xorshift generator or a MWC generator. The output of these generators is combined is with an LCG.

This generator passes L'Ecuyer's TestU01 Big Crush suite and Marsaglia's Diehard suite. Mersenne Twister fails two of the tests in this suite.

As others have said, crawl is pretty darn random.

Re: Game definitely not random

PostPosted: Monday, 4th March 2013, 15:34
by njvack
brendan wrote:I wrote the current version of the random number generator to replace Mersenne Twister because a player figured out how to predict the state.

Was this a party trick, or was it actually exploitable?

Re: Game definitely not random

PostPosted: Monday, 4th March 2013, 17:33
by twelwe
I'll decide all the numbers from now on. The first number is 60. PM me for the second, etc

Re: Game definitely not random

PostPosted: Monday, 4th March 2013, 20:22
by Stormfox
njvack wrote:
brendan wrote:I wrote the current version of the random number generator to replace Mersenne Twister because a player figured out how to predict the state.

Was this a party trick, or was it actually exploitable?

Different game, but awesome story...

Some many months back, I read a thread on r.g.r.nethack about exploiting that game's RNG. On a Unix box, the seed for dungeon generation is the Unix time when the game is first launched (for generating the dungeon). It doesn't take much imagination to see how this could be abused. Anyhow, on one of the public Nethack servers, one player (call him Alan) who knew how this worked sent a message to a friend of his (Bob) telling him to start a game at a precise server time. Bob did so, and had a minor "oh shit" moment when Alan -- not logged onto the server and thus not observing the game -- started texting him with a description of the room he was in, and telling him things like "the gold pile in the corner is 14, and there's a secret door in the south wall 3 grids from the left". Once Bob had sufficiently freaked out, Alan advised him to quit the game for ethical reasons.

I may have some details wrong, but that's the gist of it.

Re: Game definitely not random

PostPosted: Monday, 4th March 2013, 22:55
by mumra
There's a similar story to Stormfox's but involving online poker and shuffling algorithms: http://www.cigital.com/papers/download/developer_gambling.php

Clearly, such RNG abuse can be a lot more serious when it comes to gambling ;)

Re: Game definitely not random

PostPosted: Tuesday, 5th March 2013, 15:53
by njvack
brendan wrote:I wrote the current version of the random number generator to replace Mersenne Twister because a player figured out how to predict the state. In general writing a random number generator is a very bad idea. If you doubt me look at java.lang.Random.

One other question: why a custom PRNG as opposed to /dev/urandom on unix and CryptGenRandom on Windows? I'm actually curious, not trying to be an ass.

Re: Game definitely not random

PostPosted: Friday, 24th January 2020, 19:17
by b0rsuk
I know that a truly random generator will still occasionally generate streaks of suspicious numbers. Stuff like that happens in nature too.

Today I lost a low-level Ogre abyssal knight. He was very wounded, only around 20 HP left, and cornered by a giant frog or something like that. Melee skill not particularly good yet and only around 13 EV. So I decided to use a wand of Paralysis instead. 41% chance to beat MR. I zapped it five times, and failed five times in a row. My ogre died. Odds of something like this happening are (1.0 - 0.41)^5 = 0.07. Do people frequently get results like that? I also remember a wand of Random Effects that just kept enchanting enemies with Invisibility of all things, something like 4 casts in a row.

I don't know how exactly the random number generator works, but wands I find tend to cluster in my games. I rarely get a good spread of various wands, rather it's typical I get 3-5 types of wands and they keep showing up for the most of the game. Anyone else experiencing this?