add lockcount support and change to standard rand as crypto rand
becomes unhappy on machines with a higher core count