-
Notifications
You must be signed in to change notification settings - Fork 0
Aleatoryous (Python object)
"Aleatoryous" is also the name of the aleat3 object, used for building the aleatory objects. Let's take a view on it.
Generates an aleatory object. Its methods will return aleatory results, following the syntax defined on mode
. This parameter could be:
-
"aleatory.coin"
: Coin syntax, returns "Head" or "Tails" (Python strings). -
"aleatory.dice"
: Dice results, from 1 to 6. -
"aleatory.roulette"
: Roulette syntax. Selects from a custom sequence defined inextras
. -
"random"
: Default option. Replaced on the__init__
by one of the other options.
The random mode only reacts on the __init__
, but then it only uses the assigned mode. For example:
a = Aleatoryous("random", my_optional_seq)
will set the mode to a random mode (could be "aleatory.dice", "aleatory.coin" or "aleatory.roulette"), and the argument mode
becomes that new mode. The string "random" is deleted.
The Aleatoryous instances have the methods:
Returns only one result, following the actual syntax.
Aleatoryous.first_5()
Aleatoryous.first_10()
Aleatoryous.first_50()
Aleatoryous.first_100()
Aleatoryous.first_given(times, repeat=True)
Return a Python list with aleatory results (according to the defined syntax).
In the case of first_given()
, you must enter the times
you want to append to the destination list. When repeat
is False, the results won't be repeated on the list (only available on modes dice and roulette).
Returns the assigned mode (for example: if you are using the dice syntax, "aleatory.dice"
).
This method calls the object __init__
once again, commonly to change the syntax mode or modify the sequence to loop (in the case of the roulette mode).
Wiki for aleat3 by @DiddiLeija
Use this wiki to find a wide and free description of some terms for this package: aleat3. Hope you'll enjoy it! If you want, sign in and create a wiki page now!
🛠️ with ❤️ by Diego Ramirez.