eliminated loop from body of qrand and created qrand-bin