Random function working, but slow.