Guest User

Untitled

a guest
Aug 27th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. error: passing 'const Randomize' as 'this' argument discards qualifiers [-fpermissive]
  2. x = randomize1(index, size);
  3. ^
  4. int randomize1 (int x, int size)
  5. {
  6. int z = qrand() % size;
  7. if (x==z) randomize1(x, size);
  8. return z;
  9. }
  10. QString GetRandomString() const
  11. {
  12. const QString
  13. possibleCharacters("abcdefghijklmnopqrstuvwxyz");
  14. const int randomStringLength = 12; // assuming you want random strings of 12 characters
  15.  
  16. int x = -1;
  17. int size, index;
  18. QString randomString;
  19. for(int i=0; i<randomStringLength; ++i)
  20. {
  21. size = possibleCharacters.size();
  22. index = qrand() % size;
  23. if (x==index)
  24. {
  25. x = randomize1(index, size); // ОШИБКА ЗДЕСЬ
  26. }
  27.  
  28. QChar nextChar = possibleCharacters.at(x);
  29. randomString.append(nextChar);
  30.  
  31. qsrand(QTime::currentTime().msec());
  32. Sleep::msleep(10);
  33. }
  34. return randomString;
  35. }
Add Comment
Please, Sign In to add comment