Revert "Revert "Revert "modify mutex and randchar"""

This reverts commit 58440fba487c0cf800f4d28d3ddce25fa8e87e69.