Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcmicu committed Nov 9, 2023
1 parent 5a66118 commit 64502b6
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions scripts/guess.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ def get_random_sample(table, sample_size):
with open(table, "rb") as f:
total_rows = sum(1 for _ in f) - 1

if total_rows < sample_size:
if total_rows <= sample_size:
sample_size = total_rows

if sample_size == total_rows:
sample_row_numbers = range(1, total_rows + 1)
else:
sample_row_numbers = sorted(random.sample(range(1, total_rows + 1), sample_size))
Expand Down

0 comments on commit 64502b6

Please sign in to comment.