code logs -> 2018 -> Wed, 21 Nov 2018< code.20181120.log - code.20181122.log >
--- Log opened Wed Nov 21 00:00:24 2018
00:52 celmin|sleep is now known as celticminstrel
02:03 Reiver [quassel@Nightstar-ksqup0.co.uk] has quit [Ping timeout: 121 seconds]
02:05 Reiver [quassel@Nightstar-ksqup0.co.uk] has joined #code
02:05 mode/#code [+ao Reiver Reiver] by ChanServ
02:08 Derakon is now known as Derakon[AFK]
02:23 Reiver [quassel@Nightstar-ksqup0.co.uk] has quit [[NS] Quit: No Ping reply in 180 seconds.]
02:23 Reiver [quassel@Nightstar-ksqup0.co.uk] has joined #code
02:23 mode/#code [+ao Reiver Reiver] by ChanServ
04:06 Derakon[AFK] is now known as Derakon
04:37 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
04:37 mode/#code [+qo Vornicus Vornicus] by ChanServ
04:59 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
05:16 Derakon is now known as Derakon[AFK]
05:16 celticminstrel is now known as celmin|sleep
06:18 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
06:18 mode/#code [+qo Vornicus Vornicus] by ChanServ
06:21
<&McMartin>
Wow. 24 hours of silence in this channel.
06:21 * McMartin is wrapping up a very long bumbershoot post that will be a Feat Of Literate Programming and possibly also a reason to not do that
06:52
<&McMartin>
This post is almost 64K long -_-
06:52
<&McMartin>
Maybe I should split it in two.
06:55 Vorntastic [uid293981@Nightstar-6br85t.irccloud.com] has joined #code
06:55 mode/#code [+qo Vorntastic Vorntastic] by ChanServ
07:03
<&McMartin>
Oh that splits quite neatly
07:03
<&McMartin>
Okay then
07:09
<&McMartin>
https://bumbershootsoft.files.wordpress.com/2018/11/mac_cca.png
07:24 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
07:38
<&McMartin>
https://bumbershootsoft.wordpress.com/2018/11/21/unfiltered-cocoa-powering-a-custom-widget/
07:41
<&McMartin>
This is also my first attempt at explaining my way through Objective-C code in sufficient detail that someone used to C, C++, or Java can actually read it
08:23 JustBob [justbob@Nightstar.Customer.Dissatisfaction.Administrator] has quit [Ping timeout: 121 seconds]
08:24
< simon_>
what's the best way to generate random sequences without repeats? Stackoverflow recommends generating a list and shuffling it. but what if my sequence is very long?
08:25
<~Vorntastic>
How long is the sequence you wish to generate
08:25
< simon_>
I remember this thing from years ago where if you pick a number that is coprime to the number of combinations and perform modular arithmetic, you'll go through the list one at a time in a non-sequential order. but you can still derive the order somehow. that doesn't matter strongly here, but it still feels a little silly.
08:25
< simon_>
it is 26*26*10*10*10 = 676000
08:26
< simon_>
so not terrible. but still a lot considering a smart program would only be a few bytes.
08:27
<~Vorntastic>
Linear congruential generators are tried and true
08:27
< simon_>
so if you pick the coprime at random and pick one that is a little greater than the number of combinations, you'll go through the list backwards with a fixed distance. I wonder if there's a way to pick the coprime so that the order seems more "all around the place".
08:27
< simon_>
ah that's their name.
08:28
<~Vorntastic>
You multiply *and* add
08:28
< simon_>
ah!
08:29
<~Vorntastic>
You can even skip the add step if you're fine with not including the zero value
08:32
<~Vorntastic>
Well, the zero value and any non coprimes, which for that number is... Most numbers.
08:39
<&McMartin>
I'm also a fan of the xorshift family of PRNGs
08:40
<&McMartin>
https://en.wikipedia.org/wiki/Xorshift
08:40
<~Vorntastic>
Xorshift has a disadvantage in this case though
08:40
<&McMartin>
Oh wait
08:40
<&McMartin>
Random *sequence*
08:40
<~Vorntastic>
The modulus is always a power of 2
08:40
<&McMartin>
Right, a random permutation is what they want here
08:41
<~Vorntastic>
Lcg with the right modulus is equivalent to an apparently random permutation
08:44 * McMartin nods
08:44
<&McMartin>
I have had Bad Experiences with needing to use All The Bits on LCG
08:45
<~Vorntastic>
You can do Fisher Yates with... A lazy dictionary, which will grow for a while and then shrink
08:46
<~Vorntastic>
Gimme a minute I'll see what I get
09:02
< simon_>
hmm, a lazy dictionary.
09:03
<~Vorntastic>
Like, only store the swapped stuff; anything that hasn't moved is going to be completely predictable by program
09:04
< simon_>
so I realize that Python's 'random' is just a fancy combination of linear congruential generators. so https://docs.python.org/2.2/lib/module-random.html suggests (I know, 2.2, but the 3.x docs don't have this page) that I could use the internals of the 'Random' to generate a random permutation of a list in-place.
09:05
<~Vorntastic>
It is no longer
09:05
< simon_>
oh.
09:05
< simon_>
since this is Python, I figure that the interface I'm looking for is an iterable over a list. whether this is lazy via an LCG or a lazy dict could be an implementation detail.
09:05
<~Vorntastic>
Random.shuffle is a thing
09:06
< simon_>
but it returns a materialized, shuffled list, doesn't it?
09:06
< simon_>
wait, maybe it doesn't.
09:06
<~Vorntastic>
It does it in place
09:07
< simon_>
but I'd need the entire list that it does this over. since I'm doing it over an integer range, I should be able to do it without the whole list of integers in the range.
09:07
<~Vorntastic>
If you insist on an iteravle that isn't a reified list then you're doing something else and this lazy dictionary is a thing give me a minute
09:10
< simon_>
OK. :-)
09:17
<~Vorntastic>
https://docs.python.org/3/library/random.html
09:18
<~Vorntastic>
(btw)
09:29
<~Vorntastic>
Fuck me it got deleted
09:30
<~Vorntastic>
(doing this on my phone, so it's a little harder)
09:40
<~Vorntastic>
https://ideone.com/sqU2zb
09:41
<~Vorntastic>
Inner functions working the first time who accepted my black goat offering today
09:42
<~Vorntastic>
I am not certain of the size heuristics on swaps but a guess is like n/3
09:42
<~Vorntastic>
Is the maximum size
09:43
<~Vorntastic>
Or because combinatorics is perverse like that, 1/e
10:58
<~Vorntastic>
Yeah okay I'll believe n/e
--- Log closed Wed Nov 21 11:45:21 2018
--- Log opened Wed Nov 21 12:00:28 2018
12:00 TheWatcher [chris@GlobalOperator.Nightstar.Net] has joined #code
12:00 Irssi: #code: Total of 31 nicks [24 ops, 0 halfops, 0 voices, 7 normal]
12:00 mode/#code [+o TheWatcher] by ChanServ
12:00 Irssi: Join to #code was synced in 16 secs
12:03 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
12:03 mode/#code [+qo Vornicus Vornicus] by ChanServ
12:22
<@TheWatcher>
Oh, for fucks sakes
12:22
<@TheWatcher>
python manage.py runserver
12:22
<@TheWatcher>
Performing system checks...
12:22
<@TheWatcher>
Segmentation fault
12:22
<~Vorntastic>
Neat
12:22
<@TheWatcher>
Just what I fucking need
12:23
<@TheWatcher>
On top of my fucking phone line going flakey
12:29 * TheWatcher learns of faulthandler
12:32
<@TheWatcher>
File "....blabla../env/lib/python3.6/site-packages/MySQLdb/connections.py", line 359 in set_character_set
12:32
<@TheWatcher>
sigh
12:41
<@TheWatcher>
FFS
12:47 Reiver [quassel@Nightstar-ksqup0.co.uk] has quit [Operation timed out]
12:47 Reiver [quassel@Nightstar-ksqup0.co.uk] has joined #code
12:47 mode/#code [+ao Reiver Reiver] by ChanServ
13:39 celmin|sleep is now known as celmin|away
13:45 gnolam [lenin@Nightstar-ego6cb.cust.bahnhof.se] has quit [Connection closed]
13:45 gnolam [lenin@Nightstar-4de.ala.4.155.IP] has joined #code
13:46 mode/#code [+o gnolam] by ChanServ
--- Log closed Wed Nov 21 15:55:47 2018
--- Log opened Wed Nov 21 15:55:53 2018
15:55 TheWatcher [chris@GlobalOperator.Nightstar.Net] has joined #code
15:55 Irssi: #code: Total of 32 nicks [25 ops, 0 halfops, 0 voices, 7 normal]
15:55 mode/#code [+o TheWatcher] by ChanServ
15:56 Irssi: Join to #code was synced in 21 secs
16:21
<~Vornicus>
Huh. 254ish for piles of size 1000.
16:33
<~Vornicus>
simon_: so I did some checking, check this out: for size 1000 shuffles, the list would weigh in at like 4.5 kB; the dictionary used in my thing at like 10kb at its largest.
16:43
<~Vornicus>
for 6760000, I get... 30MB for list type and 100MB for lazy dictionary. I think we're looking at "not worth it" land, except that we're frontloading the processing on the first. Not that it's *that* hard to do shuffle anyway
16:45 Vorntastic [uid293981@Nightstar-6br85t.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity]
16:58 Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has joined #code
17:46
<~Vornicus>
suppose you could rejigger so that it actually uses the list and just yields on each iteration
17:59
<~Vornicus>
https://ideone.com/HgP1Pk which is way shorter
20:40 Reiv [NSkiwiirc@Nightstar-ih0uis.global-gateway.net.nz] has joined #code
20:40 mode/#code [+o Reiv] by ChanServ
20:44 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Operation timed out]
21:52 Degi- [Degi@Nightstar-350dt7.dyn.telefonica.de] has joined #code
23:10 Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has quit [Ping timeout: 121 seconds]
23:20 Degi- [Degi@Nightstar-350dt7.dyn.telefonica.de] has quit [Ping timeout: 121 seconds]
23:23 Degi [Degi@Nightstar-350dt7.dyn.telefonica.de] has joined #code
23:40 gnolam_ [lenin@Nightstar-ego6cb.cust.bahnhof.se] has joined #code
23:40 gnolam [lenin@Nightstar-4de.ala.4.155.IP] has quit [NickServ (RECOVER command used by gnolam_)]
23:40 gnolam_ is now known as gnolam
23:40 mode/#code [+o gnolam] by ChanServ
23:57 Degi [Degi@Nightstar-350dt7.dyn.telefonica.de] has quit [Ping timeout: 121 seconds]
23:59 Degi [Degi@Nightstar-350dt7.dyn.telefonica.de] has joined #code
--- Log closed Thu Nov 22 00:00:26 2018
code logs -> 2018 -> Wed, 21 Nov 2018< code.20181120.log - code.20181122.log >

[ Latest log file ]