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

fix: failure-detector: Choose random timeout from [0,3mu] #333

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

akiradeveloper
Copy link
Owner

To get average distance of 1, we need to get two random numbers from range [0,3]. I proved it with a tiny experiment.

import random

N = 1000000
sum = 0
for i in range(0,N):
  x = random.uniform(0.0, 3.0)
  y = random.uniform(0.0, 3.0)
  sum += abs(x-y)
print(sum/N)
 % python3 rand-width.py
1.0004715053424982

@akiradeveloper akiradeveloper merged commit c7acc65 into master Mar 1, 2024
1 check passed
@akiradeveloper akiradeveloper deleted the fix-timeout-3 branch March 1, 2024 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant