<h2>dirichlet.c</h2>

	#include <fcntl.h>
	#include <stdint.h>
	#include <stdio.h>

	main(int argc, char* argv[])
	{
		int handle;
		char *str;
		int32_t bits, val, n = 0;

		if (argc) {
			for (str = argv[1]; *str; str++)
				if (*str == 10) n++;
		}

		n /= 2;
		if (n > 99) n = 99;

		handle = open("/dev/urandom", O_RDONLY);
		do {
			read(handle, &bits, sizeof bits);
			bits &= 0x7fffffff;
			val = bits % n;
		} while (bits - val + (n-1) < 0);
		close(handle);

		printf("%d", 2 + val);
	}

I think this goes through random bits too fast to use `/dev/random`, however much I'd prefer to. If anyone wants to test it on Windows you'll have to port it yourself, because I don't have access to a Windows box with a C compiler.