mardi 26 décembre 2017

generate a random string in C++11?

I need help with generating a random string using C++11.

I don't know how to continue with that, if you can help me please.

#include <random>
char * random_string()
{

        static const char alphabet[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    static const MAX_LEN = 32;  //MAX LENGTH OF THE NEW CHAR RETURNED
    int stringLength = sizeof(alphabet)/sizeof(alphabet[0]);

    for (int i = 0; i<=MAX_LEN;i++)
    {
        //now i don't know what i need to do help!
    }

    static const char test[MAX_LEN];

    return test;

}

Aucun commentaire:

Enregistrer un commentaire