@@ -55,17 +55,21 @@ public GameLobbyBase(
5555 string iniName ,
5656 MapLoader mapLoader ,
5757 bool isMultiplayer ,
58- DiscordHandler discordHandler
58+ DiscordHandler discordHandler ,
59+ Random random
5960 ) : base ( windowManager )
6061 {
6162 _iniSectionName = iniName ;
6263 MapLoader = mapLoader ;
6364 this . isMultiplayer = isMultiplayer ;
6465 this . discordHandler = discordHandler ;
66+ this . random = random ;
6567 }
6668
6769 private string _iniSectionName ;
6870
71+ private Random random ;
72+
6973 protected XNAPanel PlayerOptionsPanel ;
7074
7175 protected List < MultiplayerColor > MPColors ;
@@ -747,10 +751,10 @@ private void PickRandomMap()
747751 if ( maps . Count < 1 )
748752 return ;
749753
750- int random = new Random ( ) . Next ( 0 , maps . Count ) ;
754+ int randomValue = random . Next ( 0 , maps . Count ) ;
751755 bool isFavoriteMapsSelected = IsFavoriteMapsSelected ( ) ;
752- GameModeMap = GameModeMaps . Find ( gmm => ( gmm . GameMode == GameMode || gmm . IsFavorite && isFavoriteMapsSelected ) && gmm . Map == maps [ random ] ) ;
753- Logger . Log ( "PickRandomMap: Rolled " + random + " out of " + maps . Count + ". Picked map: " + Map . Name ) ;
756+ GameModeMap = GameModeMaps . Find ( gmm => ( gmm . GameMode == GameMode || gmm . IsFavorite && isFavoriteMapsSelected ) && gmm . Map == maps [ randomValue ] ) ;
757+ Logger . Log ( "PickRandomMap: Rolled " + randomValue + " out of " + maps . Count + ". Picked map: " + Map . Name ) ;
754758
755759 ChangeMap ( GameModeMap ) ;
756760 tbMapSearch . Text = string . Empty ;
@@ -1333,7 +1337,7 @@ protected virtual PlayerHouseInfo[] Randomize(List<TeamStartMapping> teamStartMa
13331337
13341338 // Randomize options
13351339
1336- Random random = new Random ( RandomSeed ) ;
1340+ Random pseudoRandom = new Random ( RandomSeed ) ;
13371341
13381342 for ( int i = 0 ; i < totalPlayerCount ; i ++ )
13391343 {
@@ -1352,10 +1356,10 @@ protected virtual PlayerHouseInfo[] Randomize(List<TeamStartMapping> teamStartMa
13521356 disallowedSides = GetDisallowedSidesForGroup ( forHumanPlayers : false ) ;
13531357 }
13541358
1355- pHouseInfo . RandomizeSide ( pInfo , SideCount , random , disallowedSides , RandomSelectors , RandomSelectorCount ) ;
1359+ pHouseInfo . RandomizeSide ( pInfo , SideCount , pseudoRandom , disallowedSides , RandomSelectors , RandomSelectorCount ) ;
13561360
1357- pHouseInfo . RandomizeColor ( pInfo , freeColors , MPColors , random ) ;
1358- pHouseInfo . RandomizeStart ( pInfo , random , freeStartingLocations , takenStartingLocations , teamStartMappings . Any ( ) ) ;
1361+ pHouseInfo . RandomizeColor ( pInfo , freeColors , MPColors , pseudoRandom ) ;
1362+ pHouseInfo . RandomizeStart ( pInfo , pseudoRandom , freeStartingLocations , takenStartingLocations , teamStartMappings . Any ( ) ) ;
13591363 }
13601364
13611365 return houseInfos ;
0 commit comments