From 31eb7e9a052c9e9b79c5a7300bfbf78a41054c0c Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Thu, 11 Oct 2018 02:47:40 +0800 Subject: [PATCH] Rename rand_max to sample_max --- specs/beacon-chain.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/specs/beacon-chain.md b/specs/beacon-chain.md index e75925219..ab397fb06 100644 --- a/specs/beacon-chain.md +++ b/specs/beacon-chain.md @@ -325,9 +325,9 @@ def shuffle(values: List[Any], values_count = len(values) # entropy is consumed in 3 byte chunks - # rand_max is defined to remove the modulo bias from this entropy source - rand_max = 2 ** 24 - assert values_count <= rand_max: + # sample_max is defined to remove the modulo bias from this entropy source + sample_max = 2 ** 24 + assert values_count <= sample_max output = [x for x in values] source = seed @@ -344,10 +344,10 @@ def shuffle(values: List[Any], break # Set a random maximum bound of sample_from_source - rand_max = rand_max - rand_max % remaining + sample_max = sample_max - sample_max % remaining # Select `replacement_position` with the given `sample_from_source` and `remaining` - if sample_from_source < rand_max: + if sample_from_source < sample_max: # Use random number to get `replacement_position`, where it's not `index` replacement_position = (sample_from_source % remaining) + index # Swap the index-th and replacement_position-th elements