Lines Matching full:random
19 import random
87 This class allows to create qcow2 images with random valid structures and
93 """Create a random valid qcow2 image with the correct header and stored
113 self.bias = random.uniform(0.2, 0.5)
122 """Generate a random valid header."""
125 ['>I', 4, random.randint(2, 3), 'version'],
151 random.getrandbits(2)
152 self.header['compatible_features'][0].value = random.getrandbits(1)
212 """Generate a random header extension for names of features used in
216 """Return random feature type and feature bit."""
217 return (random.randint(0, 2), random.randint(0, 63))
269 """Generate random valid L1 and L2 tables."""
277 cluster_descriptor += random.randint(0, 1)
295 l1_offset = random.randint(1, 3) * self.cluster_size
300 guest_clusters = random.sample(range(self.image_size //
337 """Generate random refcount blocks and refcount table."""
423 block_clusters = set([random.choice(list(set(range(1, 4)) -
426 table_clusters = set([random.choice(list(set(range(1, 4)) -
469 """Fuzz an image by corrupting values of a random subset of its fields.
478 In the second a random subset of fields will be selected and fuzzed.
484 return random.random() < self.bias
525 """Generate a random image size aligned to a random correct
528 cluster_bits = random.randrange(9, 21)
530 img_size = random.randrange(0, MAX_IMAGE_SIZE + 1, cluster_size)
544 return set(random.sample(free, number))
571 random.shuffle(pairs)
587 """Return a set of random indices of clusters allocated for guest data.
590 return set(random.sample(range(1, num_of_cls + 1),
591 random.randint(0, num_of_cls)))