Synchronize rapid7#2536

Hi @ddouhine,

This pull request tries to sync your ddouhine:pr2529-randstring-and-more branch with rapid7 master because look like you started the working branch from an old rapid7 master commit.

This pull request tries to sync your branch so hopefully will make handling of https://github.com/rapid7/metasploit-framework/pull/2536 easier :)  Please check carefully before landing, don't want to waste your time in case there is something wrong with my pull request :)