mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
Approve functions used as default arguments (#4699)
* Approve functions used as default argumenets * The default value for **seed** is the result of a function call The default value for **seed** is the result of a function call which is not normally recommended and causes flake8-bugbear to raise a B008 error. However, in this case, it is accptable because `LinearCongruentialGenerator.__init__()` will only be called once per instance and it ensures that each instance will generate a unique sequence of numbers. * The default value for **backend** is the result of a function call The default value for **backend** is the result of a function call which is not normally recommended and causes flake8-bugbear to raise a B008 error. However, in this case, it is accptable because `Aer.get_backend()` is called when the function is definition and that same backend is then reused for function calls. * Update linear_congruential_generator.py * Update ripple_adder_classic.py * Update ripple_adder_classic.py * Update ripple_adder_classic.py * Update ripple_adder_classic.py * Update ripple_adder_classic.py
This commit is contained in:
@ -8,7 +8,13 @@ class LinearCongruentialGenerator:
|
||||
A pseudorandom number generator.
|
||||
"""
|
||||
|
||||
def __init__(self, multiplier, increment, modulo, seed=int(time())):
|
||||
# The default value for **seed** is the result of a function call which is not
|
||||
# normally recommended and causes flake8-bugbear to raise a B008 error. However,
|
||||
# in this case, it is accptable because `LinearCongruentialGenerator.__init__()`
|
||||
# will only be called once per instance and it ensures that each instance will
|
||||
# generate a unique sequence of numbers.
|
||||
|
||||
def __init__(self, multiplier, increment, modulo, seed=int(time())): # noqa: B008
|
||||
"""
|
||||
These parameters are saved and used when nextNumber() is called.
|
||||
|
||||
|
Reference in New Issue
Block a user