The Inversion Method (Generating Random Sequences IV)

June 28, 2011

In the first post of this series, I discussed how to generate permutations of sequences using the Fisher-Yates method and I explained (although indirectly) how a linear congruential generator works. In a second post, I explained how to generate 2D points uniformly and randomly distributed a triangle, discussing the method of rejection. In a third post, I’ve discussed how to generate points on a sphere.

All these methods have something in common: they are based on the uniform (pseudo)random generator, and they map uniform numbers onto a shape (or move numbers around, in the first case). What if we need another density function than uniform?

Read the rest of this entry »


Log Books

June 21, 2011

The other day, I was discussing with a friend about my log books, and it seems that, while it’s fairly common with scientists of all sorts, it’s not a generalized practice amongst computer scientists and programmers. But it should: the log book is not only for chemists.

First, the log book serves as… a log. A written trace of your activity during the day. While this sounds silly, it may be useful in retrospect when it is needed to assess time spent on a particular (class of) task(s), to get a good idea of were you are spending your time at work.

Read the rest of this entry »


Python References vs C and C++

June 14, 2011

As I’ve mentioned before, my new job will ask me to program more in Python than C++, and that’s some what new for me. Of course, I’ve criticized Python’s dismal performance on two occasions, getting me all kind of comments (from “you can’t compare performance like that!” to “use another language then” passing by “bind to external high-performance libraries”).

But it seems that my mastery of Python is still quite inadequate, and yesterday (at the time of writing, anyway) I discovered how Python’s by-reference parameters work. Unlike C or C++ that use explicit syntax to specify what kind of object we’re dealing with (either by value, pointer, or by reference), Python is a bit sneaky.

Read the rest of this entry »


Simple Color Management with Gnome

June 7, 2011

Some time ago, I complained about laptops having sucky screens, but it seems there is a way to deal with rather bad colors in Gnome.

Read the rest of this entry »