lib/helpers improve randomID and uniqueIndex