I recently wanted to calculate some binomial coefficients in Erlang, and so needed an implementation of the factorial function. No problem. The factorial function is the canonical illustration of how to define a recursive function in Erlang. It goes something like this:
fac(0) -> 1;
fac(N) -> N * fac(N-1).
I have to confess that definition has always [...]
Full story »
I want to consider the simulation of dealing a deck of cards. The deck is simply the list of integers D = [1,2,...,52]. Dealing the cards amounts to generating a random permutation of D.
Here’s how I would do it in java.
public class Shuffle {
private static java.util.Random rand = new java.util.Random();
[...]
Full story »
Russell Beattie is man with a point of view:
At one point I thought I hated programming because I was just so sick it… It turns out I don’t hate programming, I just hate programming in Java.
In fact, I’d say that many of today’s current hot trends in programming are a direct result of a backlash [...]
Full story »