code logs -> 2010 -> Mon, 25 Jan 2010< code.20100124.log - code.20100126.log >
--- Log opened Mon Jan 25 00:00:28 2010
00:36 You're now known as TheWatcher[T-2]
00:39 You're now known as TheWatcher[zZzZ]
01:11 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
01:25
<@McMartin>
Sigh. I've got my solution for #148, but I can't seem to stop leaking 20 times my RAM.
02:02
< gnolam>
McMartin: http://imgur.com/quoWk.gif
02:03
<@McMartin>
gnolam: This is a "I'm maintaining a pointer to something secretly and I can't figure out where" thing
02:04
<@McMartin>
I'm going to have to wait for MCV and consult with his wisdom
02:07 * gnolam should get into Project Euler some day.
02:08
<@McMartin>
I suspect I could re-do everything to make my solution more contained and rely less on infinite lists
02:08
<@McMartin>
But the solution is so elegant, I want to keep it =(
02:24
<@Derakon>
McM: language?
02:29
<@McMartin>
Haskell
02:29
<@McMartin>
Hence why I need to wait for MCV~
02:29
<@Derakon>
Right, right.
02:30 Attilla [Attilla@FBC920.0EA685.99523D.9E28A9] has quit [Connection reset by peer]
03:01
<@McMartin>
Hup, there's the circular reference, I think
03:08 Vornicus-Latens is now known as Vornicus
03:23 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
04:34 * Vornicus fiddles with a random ridiculous puzzle: longest two-word heterogram.
04:39
<@Vornicus>
(a heterogram is a word/phrase with no repeated letters; "uncopyrightables" is the longest one-word heterogram
05:04
<@McMartin>
Memory usage has gone from approx 60GB to approx 10MB.
05:04
<@Derakon>
...60GB memory usage?
05:05
<@McMartin>
Yeah, uh, I had ten lazily evaluated infinite lists that was supposed to get garbage collected as it was processed?
05:05
<@McMartin>
They weren't because I had some stale pointers to the heads of them.
05:05
<@McMartin>
I'd shut it off after three seconds as the 1-GB machine doing the computation started thrashing (it took a few seconds to build up, so if I was fast with top I could see it carreeening towards the brick wall), but that's my estimate of the required RAM as-was.
05:06
<@McMartin>
Memory usage is now at 0.3% and stable, and I'm estimating the basic runtime as being about 20MB.
05:07
<@McMartin>
I don't see any way to solve this though that doesn't in some way involve a loop from one to a billion.
05:09
<@McMartin>
Granted, the brute force one is a loop more like 10^20.
05:52 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: *hums* Can't stay now!]
06:06 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
06:16
<@McMartin>
woot, level 4 \o/
06:20
<@Vornicus>
woot
06:21
< Serah>
Wheee.
06:28
<@McMartin>
It's even continguous
06:28
<@Derakon>
How many level-4s are there?
06:30
<@Derakon>
Ahh. 470.
06:31 Derakon is now known as Derakon[AFK]
06:31
<@Vornicus>
(and another 358 level 5s and 6s, for a total of 828 who have achieved that goal.)
06:35 SmithKurosaki [Smith@Nightstar-a68aafef.dsl.teksavvy.com] has quit [Ping timeout: 121 seconds]
06:40
<@McMartin>
http://projecteuler.net/index.php?section=profile&profile=McMartin
06:41
<@Vornicus>
DODECAHEDRON~
06:41
<@Vornicus>
_
06:41
<@Vornicus>
rather.
06:42 SmithKurosaki [Smith@Nightstar-a68aafef.dsl.teksavvy.com] has joined #code
06:50 Rhamphoryncus [rhamph@Nightstar-a62bd960.abhsia.telus.net] has joined #code
06:50 SmithKurosaki [Smith@Nightstar-a68aafef.dsl.teksavvy.com] has quit [Ping timeout: 121 seconds]
06:52 ErikMesoy|sleep is now known as ErikMesoy
06:53 SmithKurosaki [Smith@Nightstar-a68aafef.dsl.teksavvy.com] has joined #code
07:16 AnnoDomini [annodomini@Nightstar-dc440d6f.adsl.tpnet.pl] has joined #code
07:16 mode/#code [+o AnnoDomini] by Reiver
07:41 AbuDhabi [annodomini@Nightstar-d22d7158.adsl.tpnet.pl] has joined #code
07:43 AnnoDomini [annodomini@Nightstar-dc440d6f.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
08:09 ErikM [erikm@Nightstar-9e58ffe9.opera.com] has joined #code
08:23 Vornicus is now known as Vornicus-Latens
08:28 Rhamphoryncus [rhamph@Nightstar-a62bd960.abhsia.telus.net] has quit [Client exited]
08:36 You're now known as TheWatcher
09:07 Tarinaky [Tarinaky@Nightstar-a055766b.adsl.virginmedia.net] has quit [Ping timeout: 121 seconds]
09:22 Tarinaky [Tarinaky@Nightstar-4bcfa341.adsl.virginmedia.net] has joined #code
10:37 Attilla [Attilla@FBC920.0EA685.99523D.9E28A9] has joined #code
10:37 mode/#code [+o Attilla] by Reiver
11:22 ErikM [erikm@Nightstar-9e58ffe9.opera.com] has left #code []
11:56 ErikM [erikm@Nightstar-9e58ffe9.opera.com] has joined #code
12:05 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
12:26 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed]
12:42 Zedidiah [zag@Nightstar-d0088b95.or.comcast.net] has quit [Ping timeout: 121 seconds]
13:15 Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has joined #code
13:37 Attilla [Attilla@FBC920.0EA685.99523D.9E28A9] has quit [Ping timeout: 121 seconds]
13:39
< Tarinaky>
I'm looking for suggestions on PRNGs.
13:39
< Tarinaky>
I could just use an off the shelf Mersenne Twister but I'm kindof put off by the fact that I don't understand it.
13:40 * TheWatcher tends to use knuth's subtractive method
13:42 * TheWatcher digs out his code
13:44
< Tarinaky>
I should specify it's for a game. Which I'm informed simplifies things.
13:45
<@TheWatcher>
Tarinaky: http://pastebin.starforge.co.uk/105 - the .cpp http://pastebin.starforge.co.uk/106 - the .h
13:45
< Tarinaky>
Cheers.
13:45
<@TheWatcher>
http://alexandria.starforge.co.uk/wiki/Random_Number_Generator - the discussion
13:51
< Tarinaky>
What's abs?
13:52
<@TheWatcher>
absolute.
13:52
< Tarinaky>
Oh. Sorry. Brain fart.
13:53
<@TheWatcher>
(it's in cstdlib, or it bloody should be)
13:54
< Tarinaky>
"for(i = 1; i < 56; ++i) {" shouldn't this be i < 55?
13:54
< Tarinaky>
Or am I missing something?
13:55
< Tarinaky>
Line 20 in the discussion ;x
13:57
<@TheWatcher>
Nope, 56 is right. The primer loop wants to cover the whole array, rather than the whole thing except the last element like the initialiser
13:59
< Tarinaky>
But ma only has 55 elements.
14:00
< Tarinaky>
For 1...56 ignores the first and goes out of bounds at the end.
14:00
<@TheWatcher>
int ma[56];
14:00
<@TheWatcher>
so < 56 is fine
14:00
< Tarinaky>
Oh!
14:00
< Tarinaky>
6 ma[55] = mj; confused me.
14:01
< Tarinaky>
Why're you ignoring ma[0] though?
14:02
<@TheWatcher>
Makes the initialise maths less messy, basically.
14:06
< Tarinaky>
I see.
14:06
< Tarinaky>
Part of my requirement is I need to be able to save the PRNG's state to a file.
14:07
<@TheWatcher>
So, save ma[], inext, and inextp - you can trivially add functions to get them
14:08
< Tarinaky>
If I save the values of ma then read them back in that'll work?
14:08
<@TheWatcher>
and then, you can just.. yep
14:08
< Tarinaky>
Heh, that's what I was going to ask >.>
14:08
< Tarinaky>
As for initial seed - I assume time() would be satisfactory?
14:09
<@TheWatcher>
you'll need inext and inextp as well as ma, otherwise you'll break the seqeuence, but yes. And yes, time'll be fine.
14:09
< Tarinaky>
Alright.
14:09 * Tarinaky goes off and attempts to reimplement it.
14:09
<@TheWatcher>
(hell, you could add load() and save() which take file streams to read/write to *shrug*)
14:11 Attilla [Attilla@FBC920.DDABA2.B6DD6A.6DBD7E] has joined #code
14:11 mode/#code [+o Attilla] by Reiver
14:11
< Tarinaky>
That was the notion.
14:12
<@TheWatcher>
Have fun :)
14:15
< Tarinaky>
What's the significance of 56 btw?
14:16
<@TheWatcher>
In complete honesty, I'm not sure. That's something knuth's discussion of the algorithm kinda glosses over a bit.
14:16
< Tarinaky>
And the internal seed?
14:17 * TheWatcher digs out his copy of the text, one moment
14:17
< Tarinaky>
Heh.
14:19
<@TheWatcher>
That number is a side effect of allowing the algorithm to work nicely with floats on systems with <32bit ints. You can use any number provided that it is less than MBIG there.
14:20
<@TheWatcher>
I left it because *shrug* whynot.
14:21
< Tarinaky>
It just has to be 0<internal seed < MBIG, aye?
14:21
<@TheWatcher>
Aye
14:24
<@TheWatcher>
You could set it to something like 1723 or something similarly appropriate.
14:29 ErikM [erikm@Nightstar-9e58ffe9.opera.com] has left #code []
14:35
< Tarinaky>
I don't really understand what would be appropriate :/
14:35
< Tarinaky>
ma[i] -= ma[i + (i + 30) % 55]; << Won't this run out of bounds?
14:36
< Tarinaky>
When i is 55 for example... 55+30 :/
14:37
<@TheWatcher>
Precedence, old bean
14:37 Reiver [reaverta@ServerAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
14:38 * Tarinaky looks up the precedence.
14:38
< Tarinaky>
If it doesn't run out of bound why're there brackets around i+30?
14:38
<@TheWatcher>
Wate
14:38
<@TheWatcher>
that should be 1 + (i + 30) % 55
14:39
< Tarinaky>
Ah. That makes much more sense.
14:39 * TheWatcher fixes
14:41 * TheWatcher does vaguely wonder when he messed that one up though, hohums
14:50 Reiver [reaverta@ServerAdministrator.Nightstar.Net] has joined #code
14:50 mode/#code [+qo Reiver Reiver] by ChanServ
15:00
< Tarinaky>
TheWatcher: I have no idea how you got the stats you did.
15:00
< Tarinaky>
http://tarinaky.pastebin.com/m23040a9a
15:00
< Tarinaky>
I'm getting considerably less random output than you did.
15:02
<@TheWatcher>
huh. Did you change anything other than that s/i+/1+/ ?
15:02
< Tarinaky>
Not that I'm aware of.
15:02
< Tarinaky>
I used slightly more verbose variable names.
15:02 * Tarinaky pastebins full source.
15:03
<@TheWatcher>
How many numbers are you generating, too?#
15:03
< Tarinaky>
http://tarinaky.pastebin.com/m39727f00
15:03
< Tarinaky>
1E3.
15:03
< Tarinaky>
My test program is: for(int i=0;i<1E3;i++) {
15:03
< Tarinaky>
cout << PRNG() << " ";
15:03
< Tarinaky>
}
15:04
< Tarinaky>
Well, prng PRNG then the for-loop.
15:07
<@TheWatcher>
Well, there's one mistale note - 49 should be miArray[55]= iCurrent;
15:09
<@TheWatcher>
*mistake I
15:10
< Tarinaky>
That change hasn't had any appreciable effect on the statistics.
15:12 Reiver [reaverta@ServerAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
15:14
<@TheWatcher>
hm
15:15 * TheWatcher cinfuseds
15:15
<@TheWatcher>
*o
15:16
< Tarinaky>
Would it help to try compiling it on your box to see if it's something hardware?
15:16
< Tarinaky>
:/
15:17 Reiver [reaverta@ServerAdministrator.Nightstar.Net] has joined #code
15:17 mode/#code [+qo Reiver Reiver] by ChanServ
15:18
<@TheWatcher>
give me a few, I'm fighting phpbb3 updates that don't want to stick
15:18
< Tarinaky>
Sure. I need to think about food anyway.
15:19
< Tarinaky>
I may just pull MT19973 off the shelf and use that :/
15:19
< Tarinaky>
I'm just put off by the fact that I don't really understand it.
15:19
< Tarinaky>
But then I don't really understand this one either >.>
15:20
< Tarinaky>
At least, not in terms of the statistics.
15:31
<@TheWatcher>
Tarinaky: hm. This /is/ odd - I'm getting different stats than either yours or my old ones from the wiki. Bizarre
15:32
<@TheWatcher>
I must've changes something at some point, hm
15:32
<@TheWatcher>
*d
15:32 * Tarinaky changes the 1 back to an i.
15:33
< Tarinaky>
Nope. Didn't help.
15:37
< Tarinaky>
Hunh. The off-the-shelf Mersenne Twister I have doesn't give me better stats.
15:40 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
15:40
<@TheWatcher>
Bloody frustrating though
15:41
<@TheWatcher>
Ooooh
15:41
<@TheWatcher>
That's how I did it I think
15:41 * TheWatcher fiddles
15:45
< Tarinaky>
A friend of mine told me they had a PRNG where they iterated over a list of pi's digits.
15:45
< Tarinaky>
Which amused me slightly.
15:45
< Tarinaky>
Well, a subset of the digits of pi anyway.
15:48
<@TheWatcher>
Okay
15:48
<@TheWatcher>
I worked out the problem
15:49
< Tarinaky>
You were secretly feeding ent the results of casino dice?
15:50
<@TheWatcher>
nope, we were both feeding ascii data to ent
15:50
<@TheWatcher>
http://pastebin.starforge.co.uk/108
15:50
<@TheWatcher>
Try code similar to that for yours
15:55
< Tarinaky>
Yeah. -much- better.
15:55
< Tarinaky>
Cheers for that.
16:32
< gnolam>
Dammit. Now you've gotten me hooked on Project Euler. :(
16:35 * TheWatcher patpats gnolam
16:39
< gnolam>
Of course, I'm mostly using it as an excuse to learn Python beyond the "handy shell script" level.
16:45 * TheWatcher updates the number generator page on his wiki so the issue does not arise again
17:01
< Tarinaky>
:/ Why am I having difficulty erasing a stringstream :/
17:02
< Tarinaky>
stringstream_foo.str().clear() doesn't work. Neither does str() = string()
17:07
<@TheWatcher>
clear just clears the error state flags. Tried foo << ""; ?
17:07 Searh [Z@26ECB6.A4B64C.298B52.D80DA0] has joined #code
17:07
< Tarinaky>
I wasn't trying stringstream::clear()
17:08
< Tarinaky>
I mean stringstream::str().clear()
17:08
<@TheWatcher>
oh, right, I'm paying attention
17:09 Serah [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Ping timeout: 121 seconds]
17:09
<@TheWatcher>
I'd still say try foo.str("") or foo << "";
17:11
< Tarinaky>
foo.str("") works.
17:11
< Tarinaky>
Thanks.
17:13 * Tarinaky wonders if there's a way of counting the number of line-break characters there are in a given string.
17:16
<@TheWatcher>
What's wrong with `int count = 0; for(int i =0; i < str.length(); ++i) { if(str[i] = '\n') ++count; }` ?
17:16
<@TheWatcher>
*==
17:17
< Tarinaky>
Oooo.
17:17
< Tarinaky>
Cheers. I was seriously struggling to come up with that :/
17:23 You're now known as TheWatcher[afk]
17:29 Zedidiah [zag@Nightstar-d0088b95.or.comcast.net] has joined #code
17:50 * Tarinaky wibbles - my code is such a mess.
17:56 MyCatVerbs [mycatverbs@Nightstar-3b2c2db2.bethere.co.uk] has joined #code
17:56 mode/#code [+o MyCatVerbs] by Reiver
18:01 Rhamphoryncus [rhamph@Nightstar-a62bd960.abhsia.telus.net] has joined #code
18:02
<@Vornicus-Latens>
Tarinaky: then refactor it!
18:03
< Tarinaky>
I'm not sure I really can tbh.
18:11 * AbuDhabi tries to understand how this piece of code happened.
18:11
< AbuDhabi>
Basically, it checks whether an uninitialized variable is not equal 1/true.
18:12
< AbuDhabi>
Was I too lazy to get rid of the if statement from some earlier code?
18:13
< Tarinaky>
Git has a blame file.
18:13
< Tarinaky>
That would likely answer your question.
--- Log closed Mon Jan 25 18:24:35 2010
--- Log opened Mon Jan 25 18:25:01 2010
18:25 TheWatcher[afk] [chris@Nightstar-b4529b0c.zen.co.uk] has joined #code
18:25 Irssi: #code: Total of 23 nicks [8 ops, 0 halfops, 0 voices, 15 normal]
18:25 Irssi: Join to #code was synced in 53 secs
18:48 You're now known as TheWatcher
18:55 MyCatVerbs [mycatverbs@Nightstar-3b2c2db2.bethere.co.uk] has quit [Client closed the connection]
19:01 Kazriko [kaz@Nightstar-e09690fa.client.bresnan.net] has quit [Ping timeout: 121 seconds]
19:16 Kazriko [kaz@Nightstar-e09690fa.client.bresnan.net] has joined #code
19:16 mode/#code [+o Kazriko] by Reiver
20:40 Vornicus-Latens is now known as Vornicus
21:13 MyCatVerbs [mycatverbs@Nightstar-58acb782.cable.virginmedia.com] has joined #code
21:13 mode/#code [+o MyCatVerbs] by Reiver
21:23 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
22:01 ErikMesoy is now known as ErikMesoy|sleep
23:13 Searh [Z@26ECB6.A4B64C.298B52.D80DA0] has quit [Ping timeout: 121 seconds]
23:14 AbuDhabi [annodomini@Nightstar-d22d7158.adsl.tpnet.pl] has quit [[NS] Quit: Gnarg.]
23:40 McMartin [mcmartin@Nightstar-592271c1.pltn13.sbcglobal.net] has quit [[NS] Quit: Kernel upgrade]
23:43 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
23:49 McMartin [mcmartin@Nightstar-592271c1.pltn13.sbcglobal.net] has joined #code
23:49 mode/#code [+o McMartin] by Reiver
23:55 You're now known as TheWatcher[T-2]
23:57 You're now known as TheWatcher[zZzZ]
--- Log closed Tue Jan 26 00:00:29 2010
code logs -> 2010 -> Mon, 25 Jan 2010< code.20100124.log - code.20100126.log >