Time Nick Message 00:01 MTDiscord alright, just reran my benchmarks, PCGRandom still beats PseudoRandom on my machine. 00:01 BluebirdGrey51 You know what? I just realized I could use the output of a PcgRandom to seed a PsuedoRandom. Unless I misunderstand the theory of random number generation 00:01 MTDiscord BluebirdGrey51: You can indeed do that :) 00:02 MTDiscord Basically at that point you're abusing the PcgRandom to turn a 64-bit seed into a 32-bit hash ;) 00:03 MTDiscord But I am a bit surprised that you're reporting that PseudoRandom is faster. What's your CPU? 00:03 ireallyhateirc BluebirdGrey51, will that hack yield reproducible outputs though? 00:04 BluebirdGrey51 Hold on a sec, I'm slow 00:04 BluebirdGrey51 CPU: 24 of i7-13700K 00:05 BluebirdGrey51 tho the 24 prob doesn't make a diff 00:06 BluebirdGrey51 ireallyhateirc, as I think about it, I can't see any reason why It wouldn't be reproduceable? 00:06 MTDiscord the number you get out of a pseudorandom after seeding it is perfectly deterministic 00:06 ireallyhateirc well then do whatever works, it's all hacks at this point anyway 00:06 MTDiscord pcgrandom* 00:06 MTDiscord (holds for both) 00:07 MTDiscord well imma get back to studying 00:08 BluebirdGrey51 luatic: I assume that benchmark is supposed to be put in an init.lua and run at server load time? 00:09 MTDiscord BluebirdGrey51: yes 00:09 BluebirdGrey51 Here's my results: Lua     0.00171645      µs/call 00:09 BluebirdGrey51 PCG     0.02058436      µs/call 00:09 BluebirdGrey51 K&R     0.02023658      µs/call 00:09 BluebirdGrey51 Secure  0.02944957      µs/call 00:10 MTDiscord according to this PCG and K&R would very much be on par on your machine 00:10 MTDiscord note that math.random seems to be an order of magnitude (> 10x) faster 00:10 MTDiscord (i observe the same on my machine) 00:11 BluebirdGrey51 The specific case where I observed the noticeable slowdown was when trying to replace PsuedoRandom with PcgRandom in an 80*80*80 loop 00:11 MTDiscord it seems very possible that something else might've affected this 00:12 BluebirdGrey51 Granted, not a real "benchmark" but it was a real-world use-case 00:12 MTDiscord seeing a diff would be helpful 00:12 BluebirdGrey51 I flipped it back to PsuedoRandom and the slowdown vanished 00:13 BluebirdGrey51 the code was also generating tables --- possibly that mattered 00:13 BluebirdGrey51 I don't have a diff, my code for the mapgen I'm working on isn't published anywhere yet 00:14 BluebirdGrey51 It was pretty basic though, terrain generation and grass placement, with some trees 00:17 MTDiscord well, i see two possible explanations here. one, there is a confounding factor that wasn't controlled for. two, what you're seeing is real, but not because pcgrandom is slower, but rather because your algorithm's runtime depends on random choices that are made and pcgrandom happens to make them in a way that makes your algorithm run slower. 00:20 BluebirdGrey51 It would be very strange if an algorithm's performance would change depending on which PRNG is used ... very odd, I would have to think about it for awhile 00:22 BluebirdGrey51 I'm so disorganized I don't even have my original code anymore, I got rid of the 80*80*80 PRNG loop just a few hours ago 00:23 BluebirdGrey51 So actually, I COULD just switch to PcgRandom and it'd probably work just fine 00:25 MTDiscord well, some testing (in this case, rudimentary timing) is probably a good idea if you find it's running too slowly. though, then you should probably also start profiling. i can recommend https://content.minetest.net/packages/jwmhjwmh/jitprofiler/. 00:25 MTDiscord BluebirdGrey51: well, to give a very simple example, say you flip a coin and if it's tails you place a giant castle or something. say the old PRNG gave you heads, the new one gives you tails. note also that the distributions of the old and new PRNG will be different. 00:26 MTDiscord this is somewhat of a hypothetical, though. 00:32 BluebirdGrey51 thanks for the profiler link! 00:33 BluebirdGrey51 (does it have support for the mapgen env, tho, or is in main-thread only?) 00:34 BluebirdGrey51 I guess I can easily find out 00:45 BluebirdGrey51 main thread only. If I really need to I'd have to make it work in the mapgen env, but that's a different project. 00:45 BluebirdGrey51 heading out now 01:07 Kepler test 01:07 Kepler cool, it works 01:18 Kepler Well, I don't know why I came here tonight 01:18 Kepler I got the feeling that something ain't right 01:18 Kepler I'm so scared in case I fall off my chair 01:18 Kepler And I'm wondering how I'll get down the stairs 01:18 Kepler Clowns to the left of me, jokers to the right 01:18 Kepler Here I am, stuck in the middle with you 01:18 Kepler Yes, I'm stuck in the middle with you 01:18 Kepler And I'm wondering what it is I should do 01:18 Kepler It's so hard to keep this smile from my face 01:19 Kepler Losing control, yeah, I'm all over the place 01:19 Kepler Clowns to the left of me, jokers to the right 01:19 Kepler Here I am, stuck in the middle with you 01:19 Kepler Well, you started off with nothing 01:19 Kepler And you're proud that you're a self-made man 01:19 Kepler And your friends they all come crawlin' 01:19 Kepler Slap you on the back and say, "Please, please" 01:19 Kepler Trying to make some sense of it all 01:22 ireallyhateirc is this a poem? 02:19 MTDiscord ireallyhateirc: https://www.youtube.com/watch?v=ln7Vn_WKkWU 04:13 MTDiscord hello, fellow irc members, I am an irc member, like yourself, and I am here to say hello, so hi 08:49 ROllerozxa *taps mic* is this thing on 08:50 ROllerozxa hello jordan4ibanez: a fellow irc member. strangely enough your messages appear as coming from the MTDiscord user but I am sure it is nothing to worry about, you are an irc member as anyone else 21:35 MTDiscord typical irc conversation