Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old April 1, 2010, 17:18   #11
zaimoni
Knight
 
zaimoni's Avatar
 
Join Date: Apr 2007
Posts: 590
zaimoni is on a distinguished road
Quote:
Originally Posted by Tiburon Silverflame View Post
What RNG is being used? Don't feel like digging through the code to find out.
It's a reimplementation of a fairly standard addition-shift RNG; no in-source documentation of where the coefficients are from, but as it's very easy to get these things wrong I assume there is a properly documented source "out there".

My testing suggests it's naked-eye random for events with probability greater than about 1/27. (Below that point, save-scumming enchant __ scrolls starts hitting excessively many long runs of non-occurrence: the empirical chance of a 1 in n event having a run of 3n failures ideally is about 5% for moderately large n. Hardly a major failing.)
__________________
Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011
zaimoni is offline   Reply With Quote
Old April 1, 2010, 23:44   #12
Tiburon Silverflame
Swordsman
 
Join Date: Feb 2010
Posts: 405
Tiburon Silverflame is on a distinguished road
That sounds like it's a simple linear congruential generator. Those are seriously NOT random; they have major sub-cycles in them. Yes, they're god-awful if you pick the parameters wrong...but we're talking TOTAL cycle lengths of, like, 10 when you do that. But even if the coefficients are set up to give properly total cycle length, these generators inherently produce

R(n+k) ~= R(n)

where k is the sub-cycle length.
Tiburon Silverflame is offline   Reply With Quote
Old April 2, 2010, 05:42   #13
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 6,726
Donated: $40
Pete Mack will become famous soon enough
@Tiburon: so what's your point?
Poor pseudo-randomness matters a lot when all you have is an array of random numbers, but composed with some complex state machine (like Angband), cycles aren't likely to be obvious to the end user.
They sure aren't obvious to me; if they were, I'd win every game in very small number of turns...
Pete Mack is offline   Reply With Quote
Old April 2, 2010, 11:38   #14
LostTemplar
Knight
 
Join Date: Aug 2009
Posts: 670
LostTemplar is on a distinguished road
For such a complex thing like andband you do not need random numbers, any uniformly distributed numbers will be OK.
LostTemplar is offline   Reply With Quote
Old April 2, 2010, 15:05   #15
ekolis
Knight
 
ekolis's Avatar
 
Join Date: Apr 2007
Location: Cincinnati, OH, USA
Age: 39
Posts: 918
ekolis is on a distinguished road
Send a message via AIM to ekolis Send a message via MSN to ekolis Send a message via Yahoo to ekolis
So the first time I attack the monster, I hit him for one damage... then I hit him for two... then I hit him for three... :P
__________________
You read the scroll labeled NOBIMUS UPSCOTI...
You are surrounded by a stasis field!
The tengu tries to teleport, but fails!
ekolis is offline   Reply With Quote
Old April 3, 2010, 01:19   #16
buzzkill
Prophet
 
buzzkill's Avatar
 
Join Date: May 2008
Location: Indiana, USA
Posts: 2,939
Donated: $8
buzzkill is on a distinguished road
Quote:
Originally Posted by ekolis View Post
So the first time I attack the monster, I hit him for one damage... then I hit him for two... then I hit him for three... :P
I've a better idea... mechanical hands, real dice, and an optical scanner. No more getting screwed over by the RNG.
__________________
www.mediafire.com/buzzkill - Get your 32x32 tiles here. UT32 now compatible Ironband and Quickband 9/6/2012.
My banding life on Buzzkill's ladder.
buzzkill is offline   Reply With Quote
Old April 3, 2010, 04:43   #17
zaimoni
Knight
 
zaimoni's Avatar
 
Join Date: Apr 2007
Posts: 590
zaimoni is on a distinguished road
Quote:
Originally Posted by Tiburon Silverflame View Post
That sounds like it's a simple linear congruential generator.
It is not: there's way too many slots. There is also a linear congruential generator, but it's used only to initialize the main RNG and compact the town and flavors into a 4-byte seed.
Quote:
Originally Posted by Tiburon Silverflame View Post
Those are seriously NOT random; they have major sub-cycles in them. ... But even if the coefficients are set up to give properly total cycle length, these generators inherently produce

R(n+k) ~= R(n)

where k is the sub-cycle length.
That is...elegant. (I'm not specialized in this literature, but that's not something I've seen in 200+ reasonably technical-looking web pages.)
__________________
Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011
zaimoni is offline   Reply With Quote
Old April 3, 2010, 05:17   #18
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 6,726
Donated: $40
Pete Mack will become famous soon enough
I would be happy to rewrite the random number provider to use an optional secure random number generator, like /dev/random on *NIX or CryptGenRandom on Windows. But I would be shocked, shocked, if you could tell the difference vs even a bad RNG like a linear congruential generator. Angband runs as the composition of the RNG with a really complicated finite state machine. So long as it can't get stuck in a cycle (like the borg), the lack of "randomness"* of the random numbers is not likely to be an issue.

* I put "randomness" in quotes, because even a secure RNG isn't necessarily truly random. It's just very, very hard to second guess. For true randomness, you need an ergodic (physically random) source like rolling dice or shuffling cards. This is surprisingly hard to come across on a purely digital system. The references above are to (mostly) ergodic RNGs. They use things like disk drive latency, mouse movement, keyboard delays, and WIFI signal strength as entropy sources. For the tinfoil hat set, you can buy true hardware RNGs for $100-$200. I suspect this won't fly with the angband crowd...

edited for broken link, /dev/random reference, and completeness

Last edited by Pete Mack; April 3, 2010 at 05:38.
Pete Mack is offline   Reply With Quote
Old April 3, 2010, 17:16   #19
zaimoni
Knight
 
zaimoni's Avatar
 
Join Date: Apr 2007
Posts: 590
zaimoni is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
I would be happy to rewrite the random number provider to use an optional secure random number generator, like /dev/random on *NIX or CryptGenRandom on Windows.
Goodbye, RNG state within savegame. Reintroducing the V2.7.9- (?) behavior of just being able to reload ad-nauseum and get potentially different results every time sounds like a large step backwards.
__________________
Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011
zaimoni is offline   Reply With Quote
Old April 4, 2010, 03:04   #20
nobody
Apprentice
 
Join Date: Jul 2007
Posts: 80
nobody is on a distinguished road
does it?

i guess it might induce people to 'loadscum' but is there any other reason this is bad?
nobody 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
Missing the top line in character file dumps. Kyle Development 2 July 25, 2009 19:57
rephial.org/play missing? Orillian Idle chatter 2 March 11, 2009 05:53
Missing high scores ChodTheWacko Vanilla 1 March 25, 2008 05:39
DaJAngband: new object question will_asher Variants 4 December 13, 2007 03:18
[Un] The mushroom dialogs andrewdoull Variants 9 August 28, 2007 23:30


All times are GMT +1. The time now is 12:06.


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