Fix mtrand in tests