Skip to content

Latest commit

 

History

History
30 lines (26 loc) · 1.6 KB

README.md

File metadata and controls

30 lines (26 loc) · 1.6 KB

Simple library for gathering results from stochastic functions

size files
py dep version
license downloads
downloads downloads
ko-fi

Usage:

  1. pip install r_repeat
  2. Open up the wiki to see how everything works or check the examples
  3. Enjoy

Example:

from r_repeat import repeat, seed
@repeat(n=1e6)  # run this function 1000000 times
@seed(kwarg=['rng1', 'rng2'])  # insert random numbers into rng1 and rng2
def f(rng1, bias, rng2):
	return (rng1 + bias) >= rng2

g = f(bias=0.078)  # pass remaining arguments
sum = g.collect()  # gather all results
print(f'{sum} wins and {len(g)-sum} losses')

Output:

22%|██▏       | 217913/1000000 [00:21<01:18,  9952.1it/s]    (while working)
574945 wins and 425055 losses    (after finished)