Two Quick Nim Scripts

Today I Googled something like “julia lang compiled” for the umpteenth time in several months, and then I remembered that Nimrod existed, except it’s Nim these days, and it might make it to version 1.0 any week now. I decided to look around a bit, and I discovered that the documentation seems to have improved, and the language has gotten more fleshed out. I decided to try two small things I’ve been doing a lot of lately, SSH-ing and HTTP-getting and posting, and see what they look like in Nim.

Continue reading

Vietnamese Salad

I’m not sure what this is, but I had this amazing dish in one of the most depressing shopping malls on planet Earth, near Cupertino, CA, and then again at a great pho place in Mountain View. (Correction: it’s called bun, and I’m ignorant.) The basic idea is lettuce, mint, rice noodles, and something savory, like a chopped egg roll, shaved pork, or chicken or something.

Continue reading

Poisson Disk Sampling

I’ve borrowed (stolen) code from this iPython Notebook hosted on GitHub from the PyData NYC 2014 conference. I didn’t like the local call in the original code, so I made it object oriented. (Full disclosure: I’d never seen the local keyword before, so I stuck with the devil I knew.) I also wanted syntax reminiscent of scipy.stats, so I added a .rvs() method from extracting a sample from the Poisson disk object.

Continue reading

Generating Sub-random Numbers

Sub-random numbers sort of look random, but they aren’t and they usually provide better coverage over an interval which is sometimes more important than having truly random data. For example, you wouldn’t use sub-random numbers for encryption, but they’d be great for performing Monte Carlo calculations. You can read more about them on the Wikipedia page for low discrepancy sequences.

Continue reading