Skip to content

A simple library for comprehensive result gathering for stochastic functions

License

Notifications You must be signed in to change notification settings

Aonodensetsu/r_repeat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

A simple library for comprehensive result gathering for stochastic functions

Resources

License

Stars

Watchers

Forks

Languages