示例#1
0
std::string RandomGenerator::generateRandomString(const uint32 len, const std::string charset)
{
	std::string temp;

	for (int i = 0; i < len; ++i)
	{
		int rand = generateRandomInt(0, static_cast<unsigned short>(charset.length() - 1));
		temp += charset[rand];
	}

	return temp;
}
示例#2
0
void GameMain::shuffleCards()
{
    Vector<Card*> cards;
    
    //カードをシャッフル
    while(!_cards.empty()){
        auto count=static_cast<int>(_cards.size()-1);//添字の最大値
        auto index=generateRandomInt(0,count);
        auto card=_cards.at(index);
        cards.pushBack(card);
        _cards.eraseObject(card);
    }
    
    _cards=cards;
}