c++ 随机数 产生不重复的随机数
#include <algorithm> srand( (unsigned)time(NULL) ); //设置随即数生成器的种子 vector<unsigned int> vecRand; if (m_pPlayerArray != NULL) { unsigned int unObjCount = m_pPlayerArray->count(); for (unsigned int num = 0; num < unObjCount; ++num) { vecRand.push_back(num); } } //乱序 random_shuffle(vecRand.begin(), vecRand.end());