大神们!求能把txt里的稿件以字为单位打乱的程序

大神们!!求能把txt里的文章以字为单位打乱的程序大神们!!求能把txt里的文章以字为单位打乱的程序!编好了,

大神们!!求能把txt里的文章以字为单位打乱的程序
大神们!!求能把txt里的文章以字为单位打乱的程序!编好了,发到我的邮箱:983201998@qq.com 谢谢!

[解决办法]
以字节为单位乱序,稍加修改则可以以字单位乱序。

C/C++ code
#include <fstream>#include <vector>#include <iterator>#include <algorithm>#include <ctime>#include <cstdlib>int main(int argc, char** args){    srand((unsigned int)time(NULL));    for(int i = 1; i < argc; ++i)    {        std::vector<char> buffer;        //reading        {            std::ifstream ifs(args[i]);            std::istreambuf_iterator<char> eos;               // end-of-range or            std::istreambuf_iterator<char> iit (ifs); // stdin iterator            std::copy(iit, eos, std::back_inserter(buffer));        }        //shuffering        std::random_shuffle(buffer.begin(), buffer.end());                //output        {            std::ofstream ofs(args[i]);            ofs.write(&buffer[0], buffer.size());        }    }    return 0;}