how would i randomize a string

int junbleString (string str)
{
int length = str.length();

for(int i = 0; i < length; i++)
{
str[i] = str[rand() % (sizeof (str) - 1)];
}

}

i have this so far but im still stuck please help
well, you can find the ascii table here:

http://bestofthisweb.com/blogs/wp-content/uploads/2009/11/ascii_table2.jpg

so, for each character in the string, generate a random number in the range according to which characters you want to include (eg: you want to use only lower case letters, generate a random number between 97 and 122 and assign it to str[i])
this question seems to come up on a daily basis - maybe someone should write an Article on this
Topic archived. No new replies allowed.