t.p.r.RandomFactory(object) : class documentation

Part of twisted.python.randbytes View Source View In Hierarchy

Factory providing secureRandom and insecureRandom methods.

You shouldn't have to instantiate this class, use the module level functions instead: it is an implementation detail and could be removed or changed arbitrarily.

Method secureRandom Return a number of secure random bytes.
Method insecureRandom Return a number of non secure random bytes.
Method _osUrandom Wrapper around os.urandom that cleanly manage its absence.
Method _randBits Wrapper around os.getrandbits.
Method _randRange Wrapper around random.randrange.
def _osUrandom(self, nbytes): (source)
Wrapper around os.urandom that cleanly manage its absence.
def secureRandom(self, nbytes, fallback=False): (source)
Return a number of secure random bytes.
Parametersnbytesnumber of bytes to generate. (type: int)
fallbackWhether the function should fallback on non-secure random or not. Default to False. (type: bool)
Returnsa string of random bytes. (type: str)
def _randBits(self, nbytes): (source)
Wrapper around os.getrandbits.
def _randRange(self, nbytes): (source)
Wrapper around random.randrange.
def insecureRandom(self, nbytes): (source)
Return a number of non secure random bytes.
Parametersnbytesnumber of bytes to generate. (type: int)
Returnsa string of random bytes. (type: str)
API Documentation for Twisted, generated by pydoctor at 2012-09-01 11:44:56.