201 reputation
211
bio website attilaolah.eu
location Bajmok, Serbia
age 27
visits member for 3 years, 2 months
seen Dec 17 at 20:51

Nerdfighter, full-time dad, part-time web developer.


Mar
8
awarded  Yearling
Mar
7
answered python random with a skew
Mar
7
awarded  Commentator
Mar
7
comment python random with a skew
@MartijnPieters I think the OP simply wants a weighted random integer from randrange of [parentA.trait:parentB.trait], but weighted by the dominance (I assume a linear weight distribution).
Mar
5
comment Is it worth to try write foolproof data structures?
@LorenPechtel you're right — by "first" I meant first by one specific sort key. It has to work with both sort orders though.
Mar
4
comment Is it worth to try write foolproof data structures?
@LorenPechtel we would still save the indexes because most of the time we will just want to load the first n rows, without having to go through the rest.
Mar
3
awarded  Scholar
Mar
3
accepted Is it worth to try write foolproof data structures?
Mar
3
comment Is it worth to try write foolproof data structures?
IDs in my case point to rows in an actual database, they have nothing to do with the in-memory table that I construct, and while they are guaranteed to be unique 63-bit unsigned integers, no ordering is guaranteed. I agree on your point that adding a third index for IDs only moves my original problem to a different level.
Mar
3
comment Is it worth to try write foolproof data structures?
To justify memory constraints: the entire table and both indexes should fit in one entity in the App Engine Datastore, which sets the limit to 1Mb, but the data compresses quite well, so I apply a quick zlib compression. Also, I wish not to decode each row in memory just to find one. But thanks for your answer, you seem to be suggesting to take the simple approach. (And yes, I use two-byte indexes too.)
Mar
3
awarded  Student
Mar
3
awarded  Analytical
Mar
3
awarded  Informed
Mar
3
asked Is it worth to try write foolproof data structures?
Feb
26
awarded  Constituent
Feb
26
awarded  Caucus
Feb
18
awarded  Critic
Dec
15
answered Introducing “20% time” at a workplace
Nov
11
answered Should you abandon an ORM framework when you need to implement a bulk operation?
Nov
11
comment Using Vim when coding a large-scale application
+1 for suggesting exuberant ctags!