A Few Counterintuitive Ideas

UPDATE: 4th January, The way out of burnout The beginning of 2021 marked the point when some of us were bracing with hope for the year that lied ahead. The year that we hoped to be “better” than the one that we were leaving behind. Little did we know we should have braced for impact instead. For me personally, if 2020 was bad enough then 2021 wiped the last shreds of whatever mental resilience or energy I had left in me. [Read More]

Breadth-first search using Go standard library

Just like many Go developers out there, I’m a big fan of Go standard library. Over the past few years I’ve been hacking on Go, I’ve discovered some real gems that not only made my life as a developer easier (no need to maintain unnecessary code), but they also made my code considerably more readable for others to follow. The last time I blogged I talked about how you can leverage Go standard library to generate weighted random draws. [Read More]

Weighted Random Draws in Go

When working on my last project I needed to find a way to draw a random number from a list based on some weight assigned to it i.e. given a list of numbers each of which has a weight assigned to it, I had to find a way to draw a number from the list based on the weight. The numbers which have higher weight assigned to them should be more likely to be drawn than the numbers with lower weights. [Read More]