Use g_random_int instead of ::random for portability