Author Topic: Regarding the seed value function!  (Read 7535 times)

Offline Greven

  • Bot Destroyer
  • ***
  • Posts: 345
    • View Profile
Regarding the seed value function!
« on: June 28, 2005, 04:15:52 PM »
Thx for adding the seed value function, very nice.

But I have an idea. What about having the seed value function show in bottom for the sim, were bot number etc. is showed?

Also when seed the sim with a timer, why dont we show the timer at the start of sim in this nice tiny place, then we can re-play time-seeded sims?
10010011000001110111110100111011001101100100000110110111000011101011110010110000
011000011000001100010110010111101001110100110010111100101000001000001111001011101
001101001110011011010011100011110100111000011101100100000100110011010011100110110
010110000011100111101001110110111101011101100110000111101001101001110111111011101
01100100000111010011010001100001110111010000010001001000010100001

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Regarding the seed value function!
« Reply #1 on: June 28, 2005, 04:53:04 PM »
Except that timer seeded sims get reseeded on every cycle from the new timer value.

Kind of hard to reproduce that doncha think?
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Regarding the seed value function!
« Reply #2 on: June 28, 2005, 08:40:51 PM »
I think I fixed that bug actually.  (Bug only in that it's not necessary to reseed a sim with a new seed).

Should be possible.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Regarding the seed value function!
« Reply #3 on: June 29, 2005, 08:45:13 AM »
I don't see how you can reproduce a timer randomized sim unless you have removed the "randomize timer" command from the main loop.

This will make the random seed change depending on a bunch of different things such as Processor speed, other programs running, how fast DB is running, number of robots and many others.

You just can't reproduce all those factors and that is why a timer reseed is a lot more random than a manual reseed.

I can see why you would want to remove the timer reseed for running manually seeded models but in a timer reseeded model you want as much (pseudo) randomness as possible so you need to reseed as often as you can. Every cycle works well for me. That is the way it has always been and I see no reason to change that.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Regarding the seed value function!
« Reply #4 on: June 29, 2005, 11:39:28 AM »
See, that's the fallacy.  You only need to seed a random function once, and ever after it will produce a string of random numbers that bear no statistical correlation with each other.  However, these numbers are only guarenteed to be random in the long run.  The smaller sample size you take from each seed, the less statistically random it becomes (that is, it's possible patterns will develop).

Trust me, I've spent alot of time studying random number genrators (about 2 weeks solid back in the day.  So maybe alot of time isn't quite accurate.)

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Regarding the seed value function!
« Reply #5 on: June 29, 2005, 02:50:14 PM »
PY, check this out:

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Regarding the seed value function!
« Reply #6 on: June 29, 2005, 04:18:31 PM »
I have spent a fair old time on it myself.

I started messing with random stuff on a Commodore VIC 20 (back when there were still wooly mathoths wandering about)
1981 I think it was.

The random number generator in that wasn't too bad if you reseeded to the timer. If you didn't reseed it regularly it would generate a sequence of numbers that would repeat after about 64,000 calls on the rnd function. It was pretty easy to see the pattern by making graphics move about.

Using "randomize timer" (yes it was exactly the same syntax even back then) it was impossible to see any visible pattern.

Later I bought an Atari 800 thinking it would be better (more memory. faster processor and all that) It sucked!  <_<  The random sequence repeated every 16,000 calls and there was no "randomize timer" function at all!  :angry:

By the time I had an Atari ST and an Amiga in the very late 80s, the random functions were good enough that I had to work really hard to find the patterns. With randomize timer I couldn't detect any at all, no matter how long I sampled random numbers.

With the PC I haven't done any really large studies but I have yet to see the sequence repeat either with or without "randomize timer" so in that respect it really doesn't need to be called more than once.

However, the fact that putting in the same seed number twice gives an absolutely reproducable simulation kind of proves that the numbers aren't truly random. But then we all knew that anyway didn't we.

Putting "randomize timer" into the program once and storing the value is just the same as manually seeding it except you don't get the choice initially. But the sequence is reproducable so long as you know the seed.

Using "randomize timer" on every cycle makes the whole thing utterly unpredictable. It is the closest thing to true random numbers that you will ever get from a PC since it is constantly reseeded by numbers that are beyond anyones control or knowledge, or even ability to calculate. You cannot possibly know what the timer will read in 100 game cycles from now.
For a start it will run at different rates on different computers. Secondly, the slightest fluctuation in any of 100s of different factors can momentarily slow down the PC so that the next seed will be something other than what you predicted.

Windows runs so much crap in the background that one or other of the myriads of processes going on, is going to grab just that little bit more processor power for a nanosecond and screw up the timer by a tiny fraction.

Basically it is just a whole lot more random that way even if you can't really tell the difference.  :)
« Last Edit: June 29, 2005, 04:20:19 PM by PurpleYouko »
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Regarding the seed value function!
« Reply #7 on: June 29, 2005, 04:31:13 PM »
Quote
PY, check this out:
Bots

What exactly is this supposed to prove?  :blink:

I am perfectly capable of making my own program to make pretty colored circular flower thingies.

What is your point?

Is it that randomizing to the timer makes no apparent difference to the way it forms?

So what? I never claimed that you  could see the difference. I just said that there IS a difference.

Incidentally your code won't run as is. You have to make a form with all the appropriately named control buttons first and I can't be bothered to.   :D
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Regarding the seed value function!
« Reply #8 on: June 29, 2005, 04:39:19 PM »
here is a fun little excel spreadsheet that I made a while back to simulate gaussian distributions in a pinball game.

check it out just for the heck of it. (kind of irrelevent really but fun)
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Regarding the seed value function!
« Reply #9 on: June 29, 2005, 07:27:04 PM »
lol what?

All my buttons are there PY , what do you mean there is no buttons?

Second I was showing you that  one makes a flower thingy; and the other one spreads it out nice and even? But gess witch one makes the flower thingy?

Quote
Incidentally your code won't run as is.

Well it better be ran as is , and actualy click my buttons this time that I labeled really childlishly but like hell really appropreatly.

I feel like  :pokey: <--- that guy

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Regarding the seed value function!
« Reply #10 on: June 29, 2005, 07:35:08 PM »
Pinball heh I thought that was a vedio game , I could not figure out how to control anything exsept the start button, and delay.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Regarding the seed value function!
« Reply #11 on: June 29, 2005, 07:36:33 PM »
Quote
Is it that randomizing to the timer makes no apparent difference to the way it forms?

NO!!!!!!!!!!!!!!!!!!! NEVER!!!!!!!!!!!


Randomizing the timer too often is a bad bad idea, need I say more?
« Last Edit: June 29, 2005, 07:37:18 PM by Botsareus »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Regarding the seed value function!
« Reply #12 on: June 29, 2005, 07:38:05 PM »
I won't pretend to know how VB runs random numbers, but if it's anything like modern random number sequence generators, the period is quite large (I think in the billions).

So you just don't need to reseed it more than once. If you can find something to the contrary, I'll of course change my opinions, but I'm fairly certain reseeding the random function continuously actually decreases it's statistical randomness ( a wierd thing, I know).

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Regarding the seed value function!
« Reply #13 on: June 29, 2005, 07:54:09 PM »
AND I GOT PROVE OF WHAT NUM JUST SAYED , AND I POSTED IT TOO.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Regarding the seed value function!
« Reply #14 on: June 29, 2005, 08:50:00 PM »
Well that was freaky. :wacko:

When I clicked the download button earlier while I was at work, it opened up a text file directly into internet explorer. There was no forms, no buttons and no visual basic. Just a bunch of text.

Now when I click the button I get a VB program with forms and buttons just like you said Bots.

I don't see a damn bit of difference in the randomness of the dots whether we are reseeding or not.

The one thing your program does show is that reseeding on each cycle is very expensive in processor time. The program slows to about 1/10 of its speed when reseeding on my PC
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D