Use PHP7's random_bytes() when possible

Close #4260
2 files changed