Lines Matching refs:Rand
27 MutationDispatcher::MutationDispatcher(Random &Rand,
29 : Rand(Rand), Options(Options) {
65 static char RandCh(Random &Rand) {
66 if (Rand.RandBool()) return Rand(256);
68 return Special[Rand(sizeof(Special) - 1)];
73 return EF->LLVMFuzzerCustomMutator(Data, Size, MaxSize, Rand.Rand());
80 size_t Idx = Rand(Corpus->size());
87 Data, Size, Other.data(), Other.size(), U.data(), U.size(), Rand.Rand());
100 Rand(std::min(Size, (size_t)8)) + 1; // [1,8] and <= Size.
101 size_t ShuffleStart = Rand(Size - ShuffleAmount);
104 Rand);
112 size_t N = Rand(Size / 2) + 1;
114 size_t Idx = Rand(Size - N + 1);
124 size_t Idx = Rand(Size + 1);
127 Data[Idx] = RandCh(Rand);
137 size_t N = Rand(MaxBytesToInsert - kMinBytesToInsert + 1) + kMinBytesToInsert;
139 size_t Idx = Rand(Size + 1);
143 uint8_t Byte = Rand.RandBool() ? Rand(256) : (Rand.RandBool() ? 0 : 255);
152 size_t Idx = Rand(Size);
153 Data[Idx] = RandCh(Rand);
160 size_t Idx = Rand(Size);
161 Data[Idx] ^= 1 << Rand(8);
182 Rand.RandBool();
183 if (Rand.RandBool()) { // Insert W.
185 size_t Idx = UsePositionHint ? DE.GetPositionHint() : Rand(Size + 1);
191 size_t Idx = UsePositionHint ? DE.GetPositionHint() : Rand(Size - W.size());
207 bool HandleFirst = Rand.RandBool();
214 DesiredBytes += Rand(-1, 1);
215 if (Rand.RandBool()) ExistingBytes = Bswap(ExistingBytes);
216 if (Rand.RandBool()) DesiredBytes = Bswap(DesiredBytes);
229 return DictionaryEntry(W, Positions[Rand(NumPositions)]);
239 if (Rand.RandBool()) {
240 auto X = TPC.TORC8.Get(Rand.Rand());
243 auto X = TPC.TORC4.Get(Rand.Rand());
244 if ((X.A >> 16) == 0 && (X.B >> 16) == 0 && Rand.RandBool())
269 DictionaryEntry &DE = D[Rand(D.size())];
282 size_t ToBeg = Rand(ToSize);
283 size_t CopySize = Rand(ToSize - ToBeg) + 1;
286 size_t FromBeg = Rand(FromSize - CopySize + 1);
300 size_t CopySize = Rand(MaxCopySize) + 1;
301 size_t FromBeg = Rand(FromSize - CopySize + 1);
303 size_t ToInsertPos = Rand(ToSize + 1);
321 if (Rand.RandBool())
330 size_t B = Rand(Size);
343 switch(Rand(5)) {
348 case 4: Val = Rand(Val * Val); break;
362 size_t ChangeBinaryInteger(uint8_t *Data, size_t Size, Random &Rand) {
364 size_t Off = Rand(Size - sizeof(T) + 1);
367 if (Off < 64 && !Rand(4)) {
369 if (Rand.RandBool())
373 T Add = Rand(21);
375 if (Rand.RandBool())
379 if (Add == 0 || Rand.RandBool()) // Maybe negate.
390 switch (Rand(4)) {
391 case 3: return ChangeBinaryInteger<uint64_t>(Data, Size, Rand);
392 case 2: return ChangeBinaryInteger<uint32_t>(Data, Size, Rand);
393 case 1: return ChangeBinaryInteger<uint16_t>(Data, Size, Rand);
394 case 0: return ChangeBinaryInteger<uint8_t>(Data, Size, Rand);
404 size_t Idx = Rand(Corpus->size());
410 switch(Rand(3)) {
490 Data[i] = RandCh(Rand);
500 auto M = Mutators[Rand(Mutators.size())];