Advertisement
OriHackingTutorials

PUBG team randomizer

Jul 9th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. from random import randint
  2.  
  3. def divideToRandomTeams(PlayersArray)
  4.     if type(PlayersArray) != list:
  5.         print("Argument must be a list")
  6.         return False
  7.    
  8.     playersOrginizedByRandom = []
  9.     i=0
  10.     numToDo = len(PlayersArray)
  11.     while i < numToDo:
  12.         yy = PlayersArray.pop(PlayersArray.index(PlayersArray[randint(0,len(PlayersArray)-1)]))
  13.         playersOrginizedByRandom.append(yy)
  14.         i+=1
  15.     team1 = []
  16.     team2 = []
  17.     for player in playersOrginizedByRandom:
  18.         if(len(team1) < len(playersOrginizedByRandom)/2):
  19.             team1.append(player)
  20.         else:
  21.             team2.append(player)           
  22.     return team1,team2
  23.  
  24. # to access the function, simply call it with a LIST variable.
  25.  
  26. players = ["fishibrilant","ori6151","n0rel","pudim","Karmiking","johneclips","Magnum","phantomderp"]
  27. team1,team2 = divideToRandomTeams(players)
  28.  
  29. print(*team1)
  30. print(*team2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement