Fakir 0.0.1 released

The initial version of Fakir has been released.

This gem is somewhat small, but contains some functionality that I’ve needed in various projects, such as getting a random element from an array (thus Fakir::Array#rand), and getting non-repeating random numbers, i.e. where [1, 1, 1, 2, 2] is actually random, but doesn’t look random, in the same way that [heads, heads, tails, tails] looks less random than [heads, tails, tails, heads].

Fakir::Random#rand goes even beyond that, with support for a “window” in which a number will not be repeated. Thus with a window of 3, a number will not be repeated within 3 invocations of rand.

This gem was developed for seeding Cabin Notebook, and I hope it’s of beneficial use for others.

Advertisements

Cabin Notebook and Fakir

After postponing for years I’ve been working on a website that I haven’t found the equivalent of, Cabin Notebook, which is currently populated (seeded) only with random data.

I’ve been using the excellent Faker Ruby gem, but found its random data to be … too random. That is, I didn’t want truly repeating random data, such as its wide variety of prefix+first+middle+last+suffix names and phone number formats (“Dr. Millie Beatrice Houndhouse III”, “(812)-555-1213” and “1-312-555-9696”), and having the same random number be used repeatedly (such as subsequent labels of “Photo #2”, annotating different photos). Fakir will also support a more flexible version of Array#rand, so that a random element will not be returned within N invocations of that method.

So I’ve created the fakir gem, which supports data that are not quite so random. It’s in the beginning stages, but I plan to have it soon be fully-featured enough to seed the data at Cabin Notebook.