Final code to RandomizedQueue.