MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / unisonRandom

Function unisonRandom

lib/core/patch.py:193–223  ·  view source on GitHub ↗

Unifying random generated data across different Python versions

()

Source from the content-addressed store, hash-verified

191 pass
192
193def unisonRandom():
194 """
195 Unifying random generated data across different Python versions
196 """
197
198 def _lcg():
199 global _rand
200 a = 1140671485
201 c = 128201163
202 m = 2 ** 24
203 _rand = (a * _rand + c) % m
204 return _rand
205
206 def _randint(a, b):
207 _ = a + (_lcg() % (b - a + 1))
208 return _
209
210 def _choice(seq):
211 return seq[_randint(0, len(seq) - 1)]
212
213 def _sample(population, k):
214 return [_choice(population) for _ in xrange(k)]
215
216 def _seed(seed):
217 global _rand
218 _rand = seed
219
220 random.choice = _choice
221 random.randint = _randint
222 random.sample = _sample
223 random.seed = _seed

Callers 1

smokeTestFunction · 0.90

Calls

no outgoing calls

Tested by 1

smokeTestFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…