GTGene getRandomGene() { float time{static_cast<float>(getRnd(0, 60))}; float degrees{static_cast<float>(getRnd(0, 360))}; float magnitude{static_cast<float>(getRnd(-25, 125))}; return GTGene{time, degrees, magnitude}; }
/** * initialises World fully * @return true * @exception none */ bool World::init(void) { //Create Locations in Lattice Lattice=new Location[size*size]; for (int i=0; i<size*size; ++i) { Lattice[i].setWorld(this); Lattice[i].setPosition(std::pair<int,int>(i/size,i%size)); Lattice[i].setMaxSugar(getRnd(InitialSugarMin, InitialSugarMax)); Lattice[i].setSugar(getRnd(InitialSugarMin, Lattice[i].getMaxSugar())); } //create agents and put in lattice std::pair<int,int> pos; for (int i=0; i<initialPopulation; ++i) {//quater fill lattice Agent *anAgent= nullptr; do { pos.first=getRnd(0, size-1); pos.second=getRnd(0,size-1); } while (Lattice[pos.first*size+pos.second].hasAgent()); anAgent=new Agent(this,nullptr,nullptr,pos); Lattice[pos.first*size+pos.second].initAgent(anAgent); //population.push_back(anAgent); NOT USED } return true; }
inline int ProceduralTexture::pointOfPerlinNoise(int x, int y, int cellSize){ int dx = x-(x/cellSize)*cellSize; int dy = y-(y/cellSize)*cellSize; int z1 = getRnd(x-dx, y-dy); // z3 --- z4 int z2 = getRnd(x-dx+cellSize, y-dy); // | | int z3 = getRnd(x-dx, y-dy+cellSize); // + z + int z4 = getRnd(x-dx+cellSize, y-dy+cellSize); // z1 --- z2 int z1z3 = z1*(1.0f-interpolateTable[dy])+z3*interpolateTable[dy]; int z2z4 = z2*(1.0f-interpolateTable[dy])+z4*interpolateTable[dy]; return z1z3*(1.0f-interpolateTable[dx])+z2z4*interpolateTable[dx]; }
TStr CookieCreate(int i) { time_t cookie1; time(&cookie1); TStr Cookie(LongToStrHex((long)cookie1)); while( Cookie.Length() < i ) Cookie = LongToStrHex(getRnd()) + Cookie; return Cookie.CopyBefore(i); }
void HexagonGame::randomSideChange() { if(manager.getComponentPtrsById("wall").size() > 0) { timeline.add(new Wait(10)); timeline.add(new Do([&] { randomSideChange(); })); return; } setSides(getRnd(levelData.getSidesMin(), levelData.getSidesMax() + 1)); }
void TVideopokerSession::OnBet(TRequest *r) { r->User()->CashRollback(); TServerSSI rs; TStr s; TXMLNode* bet = r->xml()->FindNode("bet"); if( bet != NULL ) { fCashBet = bet->VarValue("cash").ToIntDef(0); Coin = bet->VarValue("coin").ToIntDef(0); if( fCashBet > 0 && Coin > 0 ) { if( r->User()->Status() == tGIFT ) fCashBet = 1; BetTable = BetCashToTable(fCashBet); if( !r->User()->CashBetCommit(cGameVideopoker,BetTable,fCashBet *= Coin) ) { fCashBet = 0; return; } unsigned int WinID = 0; bool Hold[5]; unsigned int i; do { getRnd(fCards,5,1,52); // if( WinID == 0 ) // MasLoad(fCards,"cards_videopoker.txt"); TCardsCombination cc(fCards); WinID = VideopokerCardsCombination(cc.Combination()); for( i = 0; i < 5; i++ ) { Hold[i] = cc.Hold(i); if( cc.Combination() == CARD_ACE_KING || cc.Combination() == CARD_NOT ) Hold[i] = false; } fCashWin = 0; if( WinID > 0 ) if( WinID == 1 && Coin == 5 ) { fCashWin = 100000000; } else fCashWin = fCashBet * fWin[WinID-1]; } while( !r->User()->CashWinUpdate(cGameVideopoker,BetTable,fCashWin) ); for( i = 0; i < 5; i++ ) { rs.ssi()->SSIValue("ID",i+1); rs.ssi()->SSIValue("TYPE",fCards[i]); rs.ssi()->SSIBlock("&isHold",Hold[i]); s += rs.ssi()->SSIRes("videopoker_card"); } rs.ssi()->SSIValue("CASHBET",fCashBet); rs.ssi()->SSIValue("ID",WinID); rs.ssi()->SSIValue("STREAM",s); s = rs.ssi()->SSIRes("videopoker_bet"); // r->UserToSSI(rs.ssi()); r->Add(s,"game"); fStatus = tGame; } } }
/** * Constructor Population is 1/4 lattice size * @param dimensionSize :length of lattice side Lattice[dimensionSize,dimensionSize] * @exception none */ World::World(int dimensionSize) :size(DIM),step(0),cultureCount(CultureCount), maxAge(MaxAge),maxVision(MaxVision),maxMetabolism(MaxMetabolism), minAge(MinAge),minMetabolism(MinMetabolism),sugarGrowth(SugarGrowth), duration(Duration),rate(Rate),initialPopulationSize(InitialPopulationSize), initialSugarMax(InitialSugarMax),initialSugarMin(InitialSugarMin),winterRate(WinterRate), initialSpiceMax(InitialSpiceMax),initialSpiceMin(InitialSpiceMin),spiceGrowth(SpiceGrowth), seasonLength(SeasonLength),production(Production),consumption(Consumption), combatLimit(CombatLimit),immunityLength(ImmunityLength),pollutionRate(PollutionRate), childAmount(ChildAmount),diseaseLength(DiseaseLength),initialPopulation(AGENTCOUNT) { if (dimensionSize>0) { size=dimensionSize; initialPopulation=size*size/4; } rng.seed(); femaleFertilityStart=getRnd(MinFemaleFertilityStart, MaxFemaleFertilityStart+1);//range is inclusive! maleFertilityStart=getRnd(MinMaleFertilityStart, MaxMaleFertilityStart+1);//range is inclusive! femaleFertilityEnd=getRnd(MinFemaleFertilityEnd, MaxFemaleFertilityEnd+1);//range is inclusive! maleFertilityEnd=femaleFertilityEnd+10;//as per specification }
void GTPopulation::reproduction() { vector<GTOrganism*> newOrganisms; for(unsigned int i{0}; i < organisms.size(); ++i) { int m{getRnd(0, matingPool.size() - 1)}; int d{getRnd(0, matingPool.size() - 1)}; GTOrganism& mother(*matingPool[m]); GTOrganism& father(*matingPool[d]); GTDna childDna{mother.dna.crossover(father.dna)}; childDna.mutate(mutationRate); newOrganisms.push_back(new GTOrganism{childDna}); } for(const auto& o : organisms) delete o; organisms = newOrganisms; ++generation; }
void TVideopokerSession::OnChance(TRequest *r) { if( fStatus != tChance ) return; TServerSSI rs; unsigned int ID = r->xml()->TXMLNodes::VarValue("action/id").ToIntDef(1); if( ID == 0 || ID > 6 ) return; if( r->xml()->TXMLNodes::VarValue("action/stat") == "save" ) { r->User()->CashBetAdd(BetTable, - fCashWin / 2); if( fCashWin == 0 ) fCashWin = 1; fCashWin -= fCashWin / 2; } else if( r->xml()->TXMLNodes::VarValue("action/stat") == "bet" ) { if( r->User()->CashBetAdd(BetTable,fCashWin) ) fCashWin += fCashWin; } r->User()->CashBetCommit(cGameVideopokerChance); rs.ssi()->SSIValue("CASHBET",fCashWin); unsigned int CardChance = 0; int CashBet = fCashWin; int i = 0; do { getRnd(&CardChance,1,1,52,fCardsChance,fCardsChanceCount); if( CardColor(CardChance) == ID ) fCashWin = CashBet * 4; else { bool f = CardColor(CardChance) == 3 || CardColor(CardChance) == 4; if( f && ID == 5 || !f && ID == 6 ) fCashWin = CashBet * 2; else fCashWin = 0; } } while( !r->User()->CashWinUpdate(cGameVideopokerChance,BetTable,fCashWin,i++ > 100) ); fCardsChance[fCardsChanceCount++] = CardChance; rs.ssi()->SSIValue("CHANCETYPE",CardChance); r->User()->CashWinCommit(TStr("<chance type=\"")+CardChance+"\" id=\""+ID+"\" />"); r->User()->CashCommit(); if( fCashWin == 0 ) r->AddStatus("ok"); else r->AddStatus("chance"); rs.ssi()->SSIValue("CASHWIN",fCashWin); r->AddReturn(rs.ssi()->SSIRes("videopoker_chance")); r->User()->CashBetAdd(BetTable,fCashWin); }
void HexagonGame::update(float mFT) { if(!assets.pIsLocal() && Config::isEligibleForScore()) { assets.playedSeconds += mFT / 60.f; if(assets.playedSeconds >= 60.f) { assets.playedSeconds = 0; Online::trySendMinutePlayed(); } } updateFlash(mFT); effectTimelineManager.update(mFT); if(!status.hasDied) { manager.update(mFT); updateEvents(mFT); updateTimeStop(mFT); updateIncrement(); if(mustChangeSides && !manager.hasEntity(HGGroup::Wall)) sideChange(getRnd(levelStatus.sidesMin, levelStatus.sidesMax + 1)); updateLevel(mFT); if(Config::getBeatPulse()) updateBeatPulse(mFT); if(Config::getPulse()) updatePulse(mFT); if(!Config::getBlackAndWhite()) styleData.update(mFT, pow(difficultyMult, 0.8f)); } else levelStatus.rotationSpeed *= 0.99f; if(Config::get3D()) update3D(mFT); if(!Config::getNoRotation()) updateRotation(mFT); overlayCamera.update(mFT); backgroundCamera.update(mFT); for(auto& c : depthCameras) c.update(mFT); if(status.mustRestart) { changeLevel(restartId, restartFirstTime); if(!assets.pIsLocal() && Config::isEligibleForScore()) { Online::trySendRestart(); } } if(!status.scoreInvalid && Config::getOfficial() && fpsWatcher.isLimitReached()) invalidateScore(); fpsWatcher.update(); }
int main() { uchar i; uint16_t b; DDRB = 1; // PB0 as output wdt_enable(WDTO_1S); // enable 1s watchdog timer usbInit(); initRnd(); usbDeviceDisconnect(); // enforce re-enumeration for(i=0; i < 250; i++) { // wait 500 ms wdt_reset(); // keep the watchdog happy _delay_ms(2); } usbDeviceConnect(); sei(); // Enable interrupts after re-enumeration while(1) { wdt_reset(); // keep the watchdog happy usbPoll(); // PORTB = PINC & 1; if(clear) { replyBuf[0] = 0; clear = 0; PORTB = PINB ^ 1; } b = getRnd(); if(b != 0x100) { uint8_t len = replyBuf[0]; if(len < sizeof(replyBuf)-1) { replyBuf[len+1] = b; replyBuf[0]++; } } } return 0; }
void HexagonGame::newGame(string mId, bool mFirstPlay) { clearMessages(); setLevelData(getLevelData(mId), mFirstPlay); stopAllSounds(); playSound("play"); pm->resetAdj(); stopLevelMusic(); playLevelMusic(); rotationDirection = getRnd(0, 100) > 50 ? true : false; scripts.clear(); timeStop = 0; randomSideChangesEnabled = true; incrementEnabled = true; maxPulse = 85; minPulse = 75; pulseSpeedBackwards = 1; pulseSpeed = 1; hasDied = false; mustRestart = false; currentTime = 0; incrementTime = 0; setSides(levelData.getSides()); radius = minPulse; manager.clear(); createPlayer(manager, this, centerPos); scriptsTimeline = Timeline{}; messagesTimeline = Timeline{}; timeline = Timeline{}; }
void HexagonGame::newGame(const string& mId, bool mFirstPlay, float mDifficultyMult) { firstPlay = mFirstPlay; setLevelData(getLevelData(mId), mFirstPlay); difficultyMult = mDifficultyMult; // Audio cleanup stopAllSounds(); playSound("go.ogg"); stopLevelMusic(); playLevelMusic(); // Events cleanup clearMessage(); for(auto eventPtr : eventPtrs) delete eventPtr; eventPtrs.clear(); while(!eventPtrQueue.empty()) { delete eventPtrQueue.front(); eventPtrQueue.pop(); } eventPtrQueue = queue<EventData*>{}; // Game status cleanup status = HexagonGameStatus{}; restartId = mId; restartFirstTime = false; setSides(levelData.getSides()); // Manager cleanup manager.clear(); factory.createPlayer(); // Timeline cleanup timeline.clear(); timeline.reset(); messageTimeline.clear(); messageTimeline.reset(); effectTimelineManager.clear(); // FPSWatcher reset fpsWatcher.reset(); if(getOfficial()) fpsWatcher.enable(); // LUA context cleanup if(!mFirstPlay) runLuaFunction<void>("onUnload"); lua = Lua::LuaContext{}; initLua(); runLuaFile(levelData.getValueString("lua_file")); runLuaFunction<void>("onLoad"); // Random rotation direction if(getRnd(0, 100) > 50) setRotationSpeed(getRotationSpeed() * -1); // Reset zoom overlayCamera.setView({{getWidth() / 2.f, getHeight() / 2.f}, sf::Vector2f(getWidth(), getHeight())}); backgroundCamera.setView({{0, 0}, {getWidth() * getZoomFactor(), getHeight() * getZoomFactor()}}); backgroundCamera.setRotation(0); // 3D Cameras cleanup depthCameras.clear(); unsigned int depth{styleData.get3DDepth()}; if(depth > get3DMaxDepth()) depth = get3DMaxDepth(); for(unsigned int i{0}; i < depth; ++i) depthCameras.push_back({window, {}}); }
void KPboardView::CreateCuboid(float dx, float dy, float dz, float x0, float y0, float z0, bool WithTexture /* = true */) const { GLfloat nv[] = {0, 0, 0}; glBegin(GL_QUADS); // Top Face auto tx0 = getRnd(); auto ty0 = getRnd(); auto tdx = tx0 + dx / DT; auto tdy = ty0 + dy / DT; nv[0] = 0; nv[1] = 0; nv[2] = 1; glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tx0, ty0); } glVertex3f(x0, y0, z0 + dz); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tdx, ty0); } glVertex3f(x0 + dx, y0, z0 + dz); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tdx, tdy); } glVertex3f(x0 + dx, y0 + dy, z0 + dz); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tx0, tdy); } glVertex3f(x0, y0 + dy, z0 + dz); // Back Face tx0 = getRnd(); ty0 = getRnd(); tdx = tx0 + dx / DT; tdy = ty0 + dz / DT; nv[0] = 0; nv[1] = -1; nv[2] = 0; glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tx0, ty0); } glVertex3f(x0, y0, z0); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tdx, ty0); } glVertex3f(x0 + dx, y0, z0); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tdx, tdy); } glVertex3f(x0 + dx, y0, z0 + dz); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tx0, tdy); } glVertex3f(x0, y0, z0 + dz); // Front Face tx0 = getRnd(); ty0 = getRnd(); tdx = tx0 + dz / DT; tdy = ty0 + dx / DT; nv[0] = 0; nv[1] = 1; nv[2] = 0; glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tx0, ty0); } glVertex3f(x0, y0 + dy, z0); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tdx, ty0); } glVertex3f(x0, y0 + dy, z0 + dz); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tdx, tdy); } glVertex3f(x0 + dx, y0 + dy, z0 + dz); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tx0, tdy); } glVertex3f(x0 + dx, y0 + dy, z0); // Left Face tx0 = getRnd(); ty0 = getRnd(); tdx = tx0 + dz / DT; tdy = ty0 + dy / DT; nv[0] = -1; nv[1] = 0; nv[2] = 0; glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tx0, ty0); } glVertex3f(x0, y0, z0); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tdx, ty0); } glVertex3f(x0, y0, z0 + dz); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tdx, tdy); } glVertex3f(x0, y0 + dy, z0 + dz); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tx0, tdy); } glVertex3f(x0, y0 + dy, z0); // Right Face tx0 = getRnd(); ty0 = getRnd(); tdx = tx0 + dy / DT; tdy = ty0 + dz / DT; nv[0] = 1; nv[1] = 0; nv[2] = 0; glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tx0, ty0); } glVertex3f(x0 + dx, y0, z0); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tdx, ty0); } glVertex3f(x0 + dx, y0 + dy, z0); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tdx, tdy); } glVertex3f(x0 + dx, y0 + dy, z0 + dz); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tx0, tdy); } glVertex3f(x0 + dx, y0, z0 + dz); /* // The bottom face is never displayed. It increases performance not to draw // it. // Bottom Face tx0 = getRnd(); ty0 = getRnd(); tdx = tx0 + dy / DT; tdy = ty0 + dx / DT; nv[0] = 0; nv[1] = 0; nv[2] = -1; glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tx0, ty0); } glVertex3f(x0, y0, z0); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tdx, ty0); } glVertex3f(x0, y0 + dy, z0); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tdx, tdy); } glVertex3f(x0 + dx, y0 + dy, z0); glNormal3fv(nv); if (WithTexture) { glTexCoord2f(tx0, tdy); } glVertex3f(x0 + dx, y0, z0); */ glEnd(); }
ERR_ENUM cAlgorithmDFS::generate() { if (height<=1 || width<=1 || maze==0) return FAILURE; size_t totalCells = (width-1)*(height-1); size_t visitedCells = 1; curCell.x = 1 + (int)(getRnd() * (width-1)); curCell.y = 1 + (int)(getRnd() * (height-1)); while (visitedCells < totalCells) { bool neighbours[4]; if (curCell.x < width-1) { if ((*maze)[curCell.x+1][curCell.y].getWall(ALL_SIDES)) { neighbours[0]=true; } else { neighbours[0]=false; } } else neighbours[0]=false; if (curCell.y < height-1) { if ((*maze)[curCell.x][curCell.y+1].getWall(ALL_SIDES)) { neighbours[1]=true; } else { neighbours[1]=false; } } else neighbours[1]=false; if (curCell.x > 1) { if ((*maze)[curCell.x-1][curCell.y].getWall(ALL_SIDES)) { neighbours[2]=true; } else { neighbours[2]=false; } } else neighbours[2]=false; if (curCell.y > 1) { if ((*maze)[curCell.x][curCell.y-1].getWall(ALL_SIDES)) { neighbours[3]=true; } else { neighbours[3]=false; } } else neighbours[3]=false; if (neighbours[0] || neighbours[1] || neighbours[2] || neighbours[3]) { int rand = (int)(getRnd() * 4); if (!neighbours[rand]) { if (neighbours[(rand + 1) % 4]) { rand = (rand + 1) % 4; } else if (neighbours[(rand + 2) % 4]) { rand = (rand + 2) % 4; } else if (neighbours[(rand + 3) % 4]) { rand = (rand + 3) % 4; } } if (rand==0) { (*maze)[curCell.x][curCell.y].crushWall(EAST); (*maze)[curCell.x+1][curCell.y].crushWall(WEST); cellStack.push(curCell); curCell.x++; } else if (rand==1) { (*maze)[curCell.x][curCell.y].crushWall(SOUTH); (*maze)[curCell.x][curCell.y+1].crushWall(NORTH); cellStack.push(curCell); curCell.y++; } else if (rand==2) { (*maze)[curCell.x][curCell.y].crushWall(WEST); (*maze)[curCell.x-1][curCell.y].crushWall(EAST); cellStack.push(curCell); curCell.x--; } else if (rand==3) { (*maze)[curCell.x][curCell.y].crushWall(NORTH); (*maze)[curCell.x][curCell.y-1].crushWall(SOUTH); cellStack.push(curCell); curCell.y--; } visitedCells++; } else { curCell = cellStack.top(); cellStack.pop(); } } return SUCCESS; }
void shakeCamera(TimelineManager& mTimelineManager, Camera& mCamera) { int s{7}; Vector2f oldCenter{mCamera.getCenter()}; Timeline& timeline(mTimelineManager.create()); for(int i{s}; i > 0; --i) { timeline.append<Do>([&mCamera, oldCenter, i]{ mCamera.centerOn(oldCenter + Vector2f(getRnd(-i, i), getRnd(-i, i))); }); timeline.append<Wait>(1); timeline.append<Go>(0, 3); } timeline.append<Do>([&mCamera, oldCenter]{ mCamera.centerOn(oldCenter); }); }
void TVideopokerSession::OnGame(TRequest *r) { if( fStatus != tGame ) return; if( fCashBet == 0 ) return; TServerSSI rs; fStatus = tBet; TStr s; bool fCardsR[5]; unsigned int i; for( i = 0; i < 5; i++ ) fCardsR[i] = false; for( i = 0; i < r->xml()->NodesCount(); i++ ) { TXMLNode* p = r->xml()->GetNode(i); if( p->GetName() == "card" ) { int id = p->VarValue("id").ToInt(); if( id > 0 && id < 6 ) fCardsR[id-1] = true; } } unsigned int WinID = 0; unsigned int fCardsNew[5]; // int Jackpot = 0; bool Hold[5]; do { getRnd(fCardsNew,5,1,52,fCards,5); for( i = 0; i < 5; i++ ) if( !fCardsR[i] ) fCardsNew[i] = fCards[i]; TCardsCombination cc(fCardsNew); WinID = VideopokerCardsCombination(cc.Combination()); fCashWin = 0; if( WinID > 0 ) { if( WinID == 1 && Coin == 5 ) fCashWin = (int)(r->User()->JackpotID(cJackpotVideopoker) * (fCashBet / 5.0 / 500.0)); else fCashWin = fCashBet * fWin[WinID-1]; /* Защита от джекпота if( WinID == 1 && Coin == 5 ) { fCashWin = Jackpot = r->User()->Jackpot(cGameVideopoker) * (fCashBet / 5.0 / 500.0); r->User()->JackpotUpdate(cGameVideopoker,-Jackpot); break; } else fCashWin = fCashBet * fWin[WinID-1]; */ for( i = 0; i < 5; i++ ) Hold[i] = cc.Hold(i); } } while( !r->User()->CashWinUpdate(cGameVideopoker,BetTable,fCashWin) ); TStr Log; fCardsChanceCount = 0; for( i = 0; i < 5; i++ ) { unsigned int c = fCards[i]; Log += TStr("<card id=\"")+i+"\" type=\""+c+"\" />"; if( fCardsR[i] ) { rs.ssi()->SSIValue("ID",i+1); fCardsChance[fCardsChanceCount++] = c; rs.ssi()->SSIValue("TYPE",c = fCardsNew[i]); s += rs.ssi()->SSIRes("videopoker_card"); Log += TStr("<hold id=\"")+i+"\" type=\""+c+"\" />"; } // !!! WinComb if( WinID > 0 && Hold[i] ) s += "<win id=\""+TStr(i+1)+"\" />"; // !!! fCardsChance[fCardsChanceCount++] = c; } /* if( Jackpot > 0 ) r->User()->CashJackpotCommit(Log,cGameVideopoker,Jackpot); else */ r->User()->CashWinCommit(Log); r->User()->CashCommit(); if( fCashWin > 0 ) { fStatus = tChance; r->AddStatus("chance"); } else { fStatus = tBet; r->AddStatus("ok"); } rs.ssi()->SSIValue("CASHWIN",fCashWin); rs.ssi()->SSIValue("ID",WinID); rs.ssi()->SSIValue("STREAM",s); getRnd(fCardsChance+fCardsChanceCount,1,1,52,fCardsChance,fCardsChanceCount); rs.ssi()->SSIValue("CHANCETYPE",fCardsChance[fCardsChanceCount++]/*=getRnd(52)+1*/); r->AddReturn(rs.ssi()->SSIRes("videopoker_game")); r->User()->CashBetAdd(BetTable,fCashWin); }
int MusicData::getRandomSegment() { return segments[getRnd(0, segments.size())]; }
void GTDna::mutate(float mMutationRate) { for(unsigned int i{0}; i < genes.size(); ++i) if(getRnd(0, 100) < mMutationRate) genes[i] = getRandomGene(); }