Replace rand() implementation - fixes threading lockups

UCC git Repository :: git.ucc.asn.au