Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequiredSampleSize ¶
RequiredSampleSize calculates the number of samples needed to achieve a desired confidence level for a given probability and error threshold. Arguments:
- probability: the estimated proportion of the population (e.g., 0.5 for 50%).
- errThreshold: the desired margin of error, which is the maximum acceptable difference between the sample estimate and the true population proportion (e.g., 0.05 for ±5%). A smaller threshold means higher precision, but it requires a larger sample size.
- confidence: the desired confidence level, which represents the likelihood that the true population proportion falls within the margin of error around the sample estimate (e.g., 0.95 for 95% confidence). A higher confidence level means more certainty, but it also requires a larger sample size.
The function uses the standard formula for sample size determination for estimating a proportion. For more details, see: https://en.wikipedia.org/wiki/Sample_size_determination#Estimation_of_a_proportion
func SeededFloat32 ¶
SeededFloat32 generates a deterministic float32 between 0 and 1 given a seed.
TODO_MAINNET: To support other language implementations of the protocol, the pseudo-random number generator used here should be language-agnostic (i.e. not golang specific).
func SeededInt63 ¶
SeededInt63 generates a deterministic non-negative int64 by seeding a random source with the hash of seedParts.
TODO_MAINNET: To support other language implementations of the protocol, the pseudo-random number generator used here should be language-agnostic (i.e. not golang specific).
Types ¶
This section is empty.