• Home
  • Raw
  • Download

Lines Matching refs:Rand

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