Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved Shuffle to python 3.11 #12

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Benchmark/take5/shallow/dealer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from random import randrange, shuffle, random, seed
from random import randint, shuffle, random, seed
from copy import deepcopy
from player import Player
from typing import List, Tuple
Expand Down Expand Up @@ -60,12 +60,11 @@ def create_deck(self, deck_size, bull_points: float = .5, order: float = .5) ->
:param order: float, order of cards parametrization
:return: [Card ...]
"""
seed(deck_size)
random.seed(deck_size)
cards = []
for i in range(deck_size):
cards.append((i + 1, randrange(min_val, max_val)))
s = (order or random())
shuffle(cards, lambda: s)
cards.append((i + 1, random.randint(min_val, max_val)))
random.shuffle(cards)
return cards

def create_stacks(self) -> (List[List[Tuple[int, int]]]):
Expand Down
10 changes: 5 additions & 5 deletions Benchmark/take5/untyped/dealer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from random import randrange, shuffle, random, seed
from random import randint, shuffle, random, seed
from copy import deepcopy
from player import Player

Expand Down Expand Up @@ -58,14 +58,14 @@ def create_deck(self, deck_size, bull_points, order):
:param order: float, order of cards parametrization
:return: [Card ...]
"""
seed(deck_size)
random.seed(deck_size)
cards = []
for i in range(deck_size):
cards.append((i + 1, randrange(min_val, max_val)))
s = (order or random())
shuffle(cards, lambda: s)
cards.append((i + 1, random.randint(min_val, max_val)))
random.shuffle(cards)
return cards


def create_stacks(self):
"""
create 4 new stacks each having 1 card from the deck
Expand Down