Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 [4]

Author Topic: Random gripes. Err, that is, random number gripes.  (Read 16337 times)

X

  • Bay Watcher
    • View Profile
Re: Random gripes. Err, that is, random number gripes.
« Reply #45 on: January 07, 2008, 01:42:00 am »

I didn't read any snark, just thought it was an interesting post. Second time through I guess I see it. How about some attempt at practical solution to make this thread happier?

code:
=== modified file 'random.cpp'
--- random.cpp 2007-07-02 10:12:11 +0000
+++ random.cpp 2008-01-07 06:33:18 +0000
@@ -8,9 +8,12 @@

void mt_init()
{
-       int i;
-       for (i = 0; i < MT_LEN; i++)
-               mt_buffer = rand()*GetTickCount();
+       long long l;
+       for (size_t i = 0; i < MT_LEN; i++)
+               {
+               QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER>(&l));
+               mt_buffer = l;
+               }
       mt_index = MT_LEN*sizeof(unsigned long);
}


That should, I believe, cover the fun bikeshedding on the number of possible initial states.

The second issue of the genetic purity of the resumable version is beyond me, perhaps we can save the crucifiction of the Toad for if he tries to get the NSA to adopt it?

X

Logged

Zurai

  • Bay Watcher
    • View Profile
Re: Random gripes. Err, that is, random number gripes.
« Reply #46 on: January 07, 2008, 01:46:00 am »

Wow, reinterpret_cast. That's not something you see every day!
Logged

sphr

  • Bay Watcher
    • View Profile
Re: Random gripes. Err, that is, random number gripes.
« Reply #47 on: January 07, 2008, 01:58:00 am »

I think this thread has outlived its usefulness.  A lot of posts really does nothing to help, and some just confuses things more.

I think it is enough that Toady knows the situation, if he had not known that before.  That is enough.

0x517A5D has highlighted the situation in detail and has made a suggestion.  I'll say that's good. The rest is up to Toady: whether he changes it or not, when he chooses to changes things, or exactly how he does it, that's his own choice.  I believe that whatever is his decisions, there are good reasons.  So that's that.

Can I request forum admin (if any at all) to close this thread.  Doesn't seems like anything more constructive is going to happen.

@Toady: it may be possible if we use a strict tree of forward generators (meaning a tree of random number generators rather than one) but I think let's leave it to a another better day if and when you are interested.

Elvenshae

  • Bay Watcher
    • View Profile
Re: Random gripes. Err, that is, random number gripes.
« Reply #48 on: January 07, 2008, 05:21:00 pm »

quote:
Originally posted by Eagle of Fire:
<STRONG>
My miners does not exhibit weird mining behavior(s). They, just like in 23a, starts from the upper left and go down to the lower right map as preference, then always choose a square next to them to continue mining.</STRONG>


Yeah, uh, do you only highlight a single contiguous area to mine at any given time?

My miners love to start in section A, mine out a couple of squares, and then move 30 squares and three z-levels away to a different section (B) of the fortress to take a couple whacks, before circling all the way around to come at section A from the other side.

Logged
Patryn of Elvenshae

Eagle of Fire

  • Bay Watcher
  • Friendly Fire
    • View Profile
Re: Random gripes. Err, that is, random number gripes.
« Reply #49 on: January 07, 2008, 11:56:00 pm »

quote:
Yeah, uh, do you only highlight a single contiguous area to mine at any given time?

Yup.

The behavior you are describing is exactly the same I was describing, except that in addition to what I was saying the dwarves starts at the highest Z axis available and then go down. Exactly the same way than if you flag several rows one under another to be smoothered, they'll focus on up and down instead of left and right.

That's called learning the game mechanics guys... The dwarves been coded to do that since 23a, and Toady simply used the same code for the Z-axis but with up-down reference...

I call that monitoring and managing your workers. Which is usually the only thing I have left to do in my fortress when I'm ready to go dig deep in the mountain anyways...

[ January 07, 2008: Message edited by: Eagle of Fire ]

Logged
I am on a hot streak... literally.

numerobis

  • Bay Watcher
    • View Profile
Re: Random gripes. Err, that is, random number gripes.
« Reply #50 on: January 08, 2008, 10:33:00 pm »

quote:
Originally posted by Fedor:
<STRONG>If combat die rolls show streaks of good or bad luck, we have a problem.</STRONG>

Actually, other way around.  If we had no streaks, something weird would definitely be up: if you flip a coin 1024 times, you should be surprised not to find a streak of 10 heads, for example.

Of course, normal people believe the opposite -- this is so common it must be brain-wired.  On forums, I see over and over claims that a long streak of enemy hits (or your own soldiers missing) *proves* that the RNG is crap (of course, the opposite causes fewer complaints).  Perhaps in deference to this tendency, iTunes has a slider for how random you want its song selector.

For a good time, sit a bunch of probability theorists around a Settlers board.  Notice that not one will believe their bad luck with the dice.

Logged

Wooty

  • Bay Watcher
    • View Profile
Re: Random gripes. Err, that is, random number gripes.
« Reply #51 on: January 11, 2008, 07:33:00 pm »

^Yeah, I agree with you there but, at least on my map, the unmined rock looks like this on almost every Z-Level (i'll just use % instead of the different types of characters that show up)

code:
%       %        %  %       %  % %              %       %        %     % 
%          %     %   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %      %
%   %    %    %      %        %        %    %     % %        %          % %

It seems like about a 1 in 10 chance that a % will show up on each tile, yet I consistently see very long strings of %'s - Something that *should* be like a one in a thousand chance per Z-level. I'm fine with 4 or 5 in a row, but thirty? I think I now know how my ultra-legendary adventurer got shot six times by a guard after an elite bowman wasted his entire quiver on me. Not one lucky shot, not two lucky shots, but six - on an adventurer so overpowered he can kill dragons and giant cave spiders.

[ January 11, 2008: Message edited by: Wooty ]

Logged
Quote from: Toady One
It's important to wear lots of face paint while you program. And you can type with your long Gene Simmons tongue.

Capntastic

  • Bay Watcher
  • Greetings, mortals!
    • View Profile
    • A review and literature weblog I never update
Re: Random gripes. Err, that is, random number gripes.
« Reply #52 on: January 11, 2008, 07:55:00 pm »

I think Toady said that the strings of symbols in un-mined tiles is because of something else entirely, but I may've misread.
Logged

Yourself

  • Bay Watcher
    • View Profile
Re: Random gripes. Err, that is, random number gripes.
« Reply #53 on: January 11, 2008, 08:36:00 pm »

quote:
if you flip a coin 1024 times, you should be surprised not to find a streak of 10 heads, for example.

The probability of a streak of at least length 10 (either heads or tails) is approximately 86.25%.  It's likely that you'll see one, but a ~14% chance of not seeing one isn't insignificant.

Here's how I came up with this value:

In a sample of 1024 flips, there are 1015 subsets consisting of 10 consecutive flips (1024 - 10 + 1).  The probability that there is at least one streak whose length is at least 10 is 1 - probability that there are no such streaks.  For each of these subsets, the probability that it is not composed entirely of heads or entirely of tails is 1022/1024.  So the probability that there are no streaks of at least length 10 is (1022/1024)^1015.  Through the magic of Mathematica this value turns out to be about 0.1375, so subtract it from 1 and that gives the probability that there is at least one streak of length at least 10.  I wonder what the average streak length is...

Logged

Draco18s

  • Bay Watcher
    • View Profile
Re: Random gripes. Err, that is, random number gripes.
« Reply #54 on: January 11, 2008, 10:22:00 pm »

TRoll is a great dice-rolling simulator that can even generate bell curves of the probability of each possible output.  It's pretty powerful, though each time I've done something complicated I've found that TRoll can't handle it and have gotten the author to make it even more powerful. XD  I'll see if I can write a script that can do that and get back to you.  :)
Logged

Zonhin

  • Bay Watcher
    • View Profile
Re: Random gripes. Err, that is, random number gripes.
« Reply #55 on: January 12, 2008, 03:18:00 pm »

"Oh yeah theres this really awesome program that you have to wade through 5 hundred google pages to find also I'm not giving you a link. It's totally real I know the guy who made it"

So do you have a link to the TRoll website?

[ January 12, 2008: Message edited by: Zonhin ]

Logged

Draco18s

  • Bay Watcher
    • View Profile
Re: Random gripes. Err, that is, random number gripes.
« Reply #56 on: January 12, 2008, 03:39:00 pm »

quote:
Originally posted by Zonhin:
<STRONG>"Oh yeah theres this really awesome program that you have to wade through 5 hundred google pages to find also I'm not giving you a link. It's totally real I know the guy who made it"

So do you have a link to the TRoll website?

[ January 12, 2008: Message edited by: Zonhin ]</STRONG>


Er.  Somewhere.  I didn't find it by Google, a friend of mine knew about it. http://www.diku.dk/hjemmesider/ansatte/torbenm/Troll/

And having poked at Troll the other day I don't think I can count the number of times something happens in a row.

[edit]

The friend who introduced me to troll guesses that 5 to 6 is the average streak-length.

[ January 12, 2008: Message edited by: Draco18s ]

Logged
Pages: 1 2 3 [4]