Specialise random_iterator for random-access iterators.

And make one piece of code use it for test purposes.