Python random.WichmannHill() Examples
The following are 20
code examples of random.WichmannHill().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
random
, or try the search function
.
Example #1
Source File: common.py From POC-EXP with GNU General Public License v3.0 | 6 votes |
def randomStr(length=4, lowercase=False, alphabet=None, seed=None): """ Returns random string value with provided number of characters >>> random.seed(0) >>> randomStr(6) 'RNvnAv' """ choice = random.WichmannHill(seed).choice if seed is not None else random.choice if alphabet: retVal = "".join(choice(alphabet) for _ in xrange(0, length)) elif lowercase: retVal = "".join(choice(string.ascii_lowercase) for _ in xrange(0, length)) else: retVal = "".join(choice(string.ascii_letters) for _ in xrange(0, length)) return retVal
Example #2
Source File: common.py From NoobSec-Toolkit with GNU General Public License v2.0 | 6 votes |
def randomStr(length=4, lowercase=False, alphabet=None, seed=None): """ Returns random string value with provided number of characters >>> random.seed(0) >>> randomStr(6) 'RNvnAv' """ choice = random.WichmannHill(seed).choice if seed is not None else random.choice if alphabet: retVal = "".join(choice(alphabet) for _ in xrange(0, length)) elif lowercase: retVal = "".join(choice(string.ascii_lowercase) for _ in xrange(0, length)) else: retVal = "".join(choice(string.ascii_letters) for _ in xrange(0, length)) return retVal
Example #3
Source File: test_zlib.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_odd_flush(self): # Test for odd flushing bugs noted in 2.0, and hopefully fixed in 2.1 import random # Testing on 17K of "random" data # Create compressor and decompressor objects co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) dco = zlib.decompressobj() # Try 17K of data # generate random data stream try: # In 2.3 and later, WichmannHill is the RNG of the bug report gen = random.WichmannHill() except AttributeError: try: # 2.2 called it Random gen = random.Random() except AttributeError: # others might simply have a single RNG gen = random gen.seed(1) data = genblock(1, 17 * 1024, generator=gen) # compress, sync-flush, and decompress first = co.compress(data) second = co.flush(zlib.Z_SYNC_FLUSH) expanded = dco.decompress(first + second) # if decompressed data is different from the input data, choke. self.assertEqual(expanded, data, "17K random source doesn't match")
Example #4
Source File: test_zlib.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_odd_flush(self): # Test for odd flushing bugs noted in 2.0, and hopefully fixed in 2.1 import random # Testing on 17K of "random" data # Create compressor and decompressor objects co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) dco = zlib.decompressobj() # Try 17K of data # generate random data stream try: # In 2.3 and later, WichmannHill is the RNG of the bug report gen = random.WichmannHill() except AttributeError: try: # 2.2 called it Random gen = random.Random() except AttributeError: # others might simply have a single RNG gen = random gen.seed(1) data = genblock(1, 17 * 1024, generator=gen) # compress, sync-flush, and decompress first = co.compress(data) second = co.flush(zlib.Z_SYNC_FLUSH) expanded = dco.decompress(first + second) # if decompressed data is different from the input data, choke. self.assertEqual(expanded, data, "17K random source doesn't match")
Example #5
Source File: test_zlib.py From android_universal with MIT License | 5 votes |
def test_odd_flush(self): # Test for odd flushing bugs noted in 2.0, and hopefully fixed in 2.1 import random # Testing on 17K of "random" data # Create compressor and decompressor objects co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) dco = zlib.decompressobj() # Try 17K of data # generate random data stream try: # In 2.3 and later, WichmannHill is the RNG of the bug report gen = random.WichmannHill() except AttributeError: try: # 2.2 called it Random gen = random.Random() except AttributeError: # others might simply have a single RNG gen = random gen.seed(1) data = genblock(1, 17 * 1024, generator=gen) # compress, sync-flush, and decompress first = co.compress(data) second = co.flush(zlib.Z_SYNC_FLUSH) expanded = dco.decompress(first + second) # if decompressed data is different from the input data, choke. self.assertEqual(expanded, data, "17K random source doesn't match")
Example #6
Source File: threads.py From EasY_HaCk with Apache License 2.0 | 5 votes |
def reset(self): """ Resets thread data model """ self.disableStdOut = False self.hashDBCursor = None self.inTransaction = False self.lastCode = None self.lastComparisonPage = None self.lastComparisonHeaders = None self.lastComparisonCode = None self.lastComparisonRatio = None self.lastErrorPage = None self.lastHTTPError = None self.lastRedirectMsg = None self.lastQueryDuration = 0 self.lastPage = None self.lastRequestMsg = None self.lastRequestUID = 0 self.lastRedirectURL = None self.random = random.WichmannHill() self.resumed = False self.retriesCount = 0 self.seqMatcher = difflib.SequenceMatcher(None) self.shared = shared self.validationRun = 0 self.valueStack = []
Example #7
Source File: test_zlib.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_odd_flush(self): # Test for odd flushing bugs noted in 2.0, and hopefully fixed in 2.1 import random # Testing on 17K of "random" data # Create compressor and decompressor objects co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) dco = zlib.decompressobj() # Try 17K of data # generate random data stream try: # In 2.3 and later, WichmannHill is the RNG of the bug report gen = random.WichmannHill() except AttributeError: try: # 2.2 called it Random gen = random.Random() except AttributeError: # others might simply have a single RNG gen = random gen.seed(1) data = genblock(1, 17 * 1024, generator=gen) # compress, sync-flush, and decompress first = co.compress(data) second = co.flush(zlib.Z_SYNC_FLUSH) expanded = dco.decompress(first + second) # if decompressed data is different from the input data, choke. self.assertEqual(expanded, data, "17K random source doesn't match")
Example #8
Source File: common.py From POC-EXP with GNU General Public License v3.0 | 5 votes |
def randomInt(length=4, seed=None): """ Returns random integer value with provided number of digits >>> random.seed(0) >>> randomInt(6) 874254 """ choice = random.WichmannHill(seed).choice if seed is not None else random.choice return int("".join(choice(string.digits if _ != 0 else string.digits.replace('0', '')) for _ in xrange(0, length)))
Example #9
Source File: common.py From POC-EXP with GNU General Public License v3.0 | 5 votes |
def randomRange(start=0, stop=1000, seed=None): """ Returns random integer value in given range >>> random.seed(0) >>> randomRange(1, 500) 423 """ randint = random.WichmannHill(seed).randint if seed is not None else random.randint return int(randint(start, stop))
Example #10
Source File: test_zlib.py From medicare-demo with Apache License 2.0 | 5 votes |
def test_odd_flush(self): # Test for odd flushing bugs noted in 2.0, and hopefully fixed in 2.1 import random if hasattr(zlib, 'Z_SYNC_FLUSH'): # Testing on 17K of "random" data # Create compressor and decompressor objects co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) dco = zlib.decompressobj() # Try 17K of data # generate random data stream try: # In 2.3 and later, WichmannHill is the RNG of the bug report gen = random.WichmannHill() except AttributeError: try: # 2.2 called it Random gen = random.Random() except AttributeError: # others might simply have a single RNG gen = random gen.seed(1) data = genblock(1, 17 * 1024, generator=gen) # compress, sync-flush, and decompress first = co.compress(data) second = co.flush(zlib.Z_SYNC_FLUSH) expanded = dco.decompress(first + second) # if decompressed data is different from the input data, choke. self.assertEqual(expanded, data, "17K random source doesn't match")
Example #11
Source File: test_zlib.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_odd_flush(self): # Test for odd flushing bugs noted in 2.0, and hopefully fixed in 2.1 import random # Testing on 17K of "random" data # Create compressor and decompressor objects co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) dco = zlib.decompressobj() # Try 17K of data # generate random data stream try: # In 2.3 and later, WichmannHill is the RNG of the bug report gen = random.WichmannHill() except AttributeError: try: # 2.2 called it Random gen = random.Random() except AttributeError: # others might simply have a single RNG gen = random gen.seed(1) data = genblock(1, 17 * 1024, generator=gen) # compress, sync-flush, and decompress first = co.compress(data) second = co.flush(zlib.Z_SYNC_FLUSH) expanded = dco.decompress(first + second) # if decompressed data is different from the input data, choke. self.assertEqual(expanded, data, "17K random source doesn't match")
Example #12
Source File: test_zlib.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_odd_flush(self): # Test for odd flushing bugs noted in 2.0, and hopefully fixed in 2.1 import random # Testing on 17K of "random" data # Create compressor and decompressor objects co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) dco = zlib.decompressobj() # Try 17K of data # generate random data stream try: # In 2.3 and later, WichmannHill is the RNG of the bug report gen = random.WichmannHill() except AttributeError: try: # 2.2 called it Random gen = random.Random() except AttributeError: # others might simply have a single RNG gen = random gen.seed(1) data = genblock(1, 17 * 1024, generator=gen) # compress, sync-flush, and decompress first = co.compress(data) second = co.flush(zlib.Z_SYNC_FLUSH) expanded = dco.decompress(first + second) # if decompressed data is different from the input data, choke. self.assertEqual(expanded, data, "17K random source doesn't match")
Example #13
Source File: test_zlib.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_odd_flush(self): # Test for odd flushing bugs noted in 2.0, and hopefully fixed in 2.1 import random # Testing on 17K of "random" data # Create compressor and decompressor objects co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) dco = zlib.decompressobj() # Try 17K of data # generate random data stream try: # In 2.3 and later, WichmannHill is the RNG of the bug report gen = random.WichmannHill() except AttributeError: try: # 2.2 called it Random gen = random.Random() except AttributeError: # others might simply have a single RNG gen = random gen.seed(1) data = genblock(1, 17 * 1024, generator=gen) # compress, sync-flush, and decompress first = co.compress(data) second = co.flush(zlib.Z_SYNC_FLUSH) expanded = dco.decompress(first + second) # if decompressed data is different from the input data, choke. self.assertEqual(expanded, data, "17K random source doesn't match")
Example #14
Source File: common.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def randomInt(length=4, seed=None): """ Returns random integer value with provided number of digits >>> random.seed(0) >>> randomInt(6) 874254 """ choice = random.WichmannHill(seed).choice if seed is not None else random.choice return int("".join(choice(string.digits if _ != 0 else string.digits.replace('0', '')) for _ in xrange(0, length)))
Example #15
Source File: common.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def randomRange(start=0, stop=1000, seed=None): """ Returns random integer value in given range >>> random.seed(0) >>> randomRange(1, 500) 423 """ randint = random.WichmannHill(seed).randint if seed is not None else random.randint return int(randint(start, stop))
Example #16
Source File: common.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def randomInt(length=4, seed=None): """ Returns random integer value with provided number of digits >>> random.seed(0) >>> randomInt(6) 874254 """ choice = random.WichmannHill(seed).choice if seed is not None else random.choice return int("".join(choice(string.digits if _ != 0 else string.digits.replace('0', '')) for _ in xrange(0, length)))
Example #17
Source File: common.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def randomRange(start=0, stop=1000, seed=None): """ Returns random integer value in given range >>> random.seed(0) >>> randomRange(1, 500) 423 """ randint = random.WichmannHill(seed).randint if seed is not None else random.randint return int(randint(start, stop))
Example #18
Source File: test_zlib.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def test_odd_flush(self): # Test for odd flushing bugs noted in 2.0, and hopefully fixed in 2.1 import random # Testing on 17K of "random" data # Create compressor and decompressor objects co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) dco = zlib.decompressobj() # Try 17K of data # generate random data stream try: # In 2.3 and later, WichmannHill is the RNG of the bug report gen = random.WichmannHill() except AttributeError: try: # 2.2 called it Random gen = random.Random() except AttributeError: # others might simply have a single RNG gen = random gen.seed(1) data = genblock(1, 17 * 1024, generator=gen) # compress, sync-flush, and decompress first = co.compress(data) second = co.flush(zlib.Z_SYNC_FLUSH) expanded = dco.decompress(first + second) # if decompressed data is different from the input data, choke. self.assertEqual(expanded, data, "17K random source doesn't match")
Example #19
Source File: test_zlib.py From oss-ftp with MIT License | 5 votes |
def test_odd_flush(self): # Test for odd flushing bugs noted in 2.0, and hopefully fixed in 2.1 import random # Testing on 17K of "random" data # Create compressor and decompressor objects co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) dco = zlib.decompressobj() # Try 17K of data # generate random data stream try: # In 2.3 and later, WichmannHill is the RNG of the bug report gen = random.WichmannHill() except AttributeError: try: # 2.2 called it Random gen = random.Random() except AttributeError: # others might simply have a single RNG gen = random gen.seed(1) data = genblock(1, 17 * 1024, generator=gen) # compress, sync-flush, and decompress first = co.compress(data) second = co.flush(zlib.Z_SYNC_FLUSH) expanded = dco.decompress(first + second) # if decompressed data is different from the input data, choke. self.assertEqual(expanded, data, "17K random source doesn't match")
Example #20
Source File: test_zlib.py From BinderFilter with MIT License | 5 votes |
def test_odd_flush(self): # Test for odd flushing bugs noted in 2.0, and hopefully fixed in 2.1 import random if hasattr(zlib, 'Z_SYNC_FLUSH'): # Testing on 17K of "random" data # Create compressor and decompressor objects co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) dco = zlib.decompressobj() # Try 17K of data # generate random data stream try: # In 2.3 and later, WichmannHill is the RNG of the bug report gen = random.WichmannHill() except AttributeError: try: # 2.2 called it Random gen = random.Random() except AttributeError: # others might simply have a single RNG gen = random gen.seed(1) data = genblock(1, 17 * 1024, generator=gen) # compress, sync-flush, and decompress first = co.compress(data) second = co.flush(zlib.Z_SYNC_FLUSH) expanded = dco.decompress(first + second) # if decompressed data is different from the input data, choke. self.assertEqual(expanded, data, "17K random source doesn't match")