Hopefully optimized arand.c a bit, and made the code generally more readable at the same time