z relaxation, fixed bug in random.c