Home | History | Annotate | Download | only in fuzzer

Lines Matching refs:Rand

27 MutationDispatcher::MutationDispatcher(Random &Rand,
29 : Rand(Rand), Options(Options) {
63 static char RandCh(Random &Rand) {
64 if (Rand.RandBool()) return Rand(256);
66 return Special[Rand(sizeof(Special) - 1)];
71 return EF->LLVMFuzzerCustomMutator(Data, Size, MaxSize, Rand.Rand());
78 size_t Idx = Rand(Corpus->size());
85 Data, Size, Other.data(), Other.size(), U.data(), U.size(), Rand.Rand());
97 Rand(std::min(Size, (size_t)8)) + 1; // [1,8] and <= Size.
98 size_t ShuffleStart = Rand(Size - ShuffleAmount);
100 std::shuffle(Data + ShuffleStart, Data + ShuffleStart + ShuffleAmount, Rand);
107 size_t N = Rand(Size / 2) + 1;
109 size_t Idx = Rand(Size - N + 1);
119 size_t Idx = Rand(Size + 1);
122 Data[Idx] = RandCh(Rand);
132 size_t N = Rand(MaxBytesToInsert - kMinBytesToInsert + 1) + kMinBytesToInsert;
134 size_t Idx = Rand(Size + 1);
138 uint8_t Byte = Rand.RandBool() ? Rand(256) : (Rand.RandBool() ? 0 : 255);
147 size_t Idx = Rand(Size);
148 Data[Idx] = RandCh(Rand);
155 size_t Idx = Rand(Size);
156 Data[Idx] ^= 1 << Rand(8);
172 Rand.RandBool();
173 if (Rand.RandBool()) { // Insert W.
175 size_t Idx = UsePositionHint ? DE.GetPositionHint() : Rand(Size + 1);
181 size_t Idx = UsePositionHint ? DE.GetPositionHint() : Rand(Size - W.size());
198 bool HandleFirst = Rand.RandBool();
218 return DictionaryEntry(W, Positions[Rand(NumPositions)]);
228 if (Rand.RandBool()) Arg1 = Bswap(Arg1);
229 if (Rand.RandBool()) Arg2 = Bswap(Arg2);
230 T Arg1Mutation = Arg1 + Rand(-1, 1);
231 T Arg2Mutation = Arg2 + Rand(-1, 1);
246 switch (Rand(4)) {
248 auto X = TPC.TORC8.Get(Rand.Rand());
252 auto X = TPC.TORC4.Get(Rand.Rand());
253 if ((X.A >> 16) == 0 && (X.B >> 16) == 0 && Rand.RandBool())
259 auto X = TPC.TORCW.Get(Rand.Rand());
263 auto X = TPC.MMT.Get(Rand.Rand());
289 DictionaryEntry &DE = D[Rand(D.size())];
302 size_t ToBeg = Rand(ToSize);
303 size_t CopySize = Rand(ToSize - ToBeg) + 1;
306 size_t FromBeg = Rand(FromSize - CopySize + 1);
320 size_t CopySize = Rand(MaxCopySize) + 1;
321 size_t FromBeg = Rand(FromSize - CopySize + 1);
323 size_t ToInsertPos = Rand(ToSize + 1);
343 if (Size == MaxSize || Rand.RandBool())
352 size_t B = Rand(Size);
365 switch(Rand(5)) {
370 case 4: Val = Rand(Val * Val); break;
384 size_t ChangeBinaryInteger(uint8_t *Data, size_t Size, Random &Rand) {
386 size_t Off = Rand(Size - sizeof(T) + 1);
389 if (Off < 64 && !Rand(4)) {
391 if (Rand.RandBool())
395 T Add = Rand(21);
397 if (Rand.RandBool())
401 if (Add == 0 || Rand.RandBool()) // Maybe negate.
412 switch (Rand(4)) {
413 case 3: return ChangeBinaryInteger<uint64_t>(Data, Size, Rand);
414 case 2: return ChangeBinaryInteger<uint32_t>(Data, Size, Rand);
415 case 1: return ChangeBinaryInteger<uint16_t>(Data, Size, Rand);
416 case 0: return ChangeBinaryInteger<uint8_t>(Data, Size, Rand);
426 size_t Idx = Rand(Corpus->size());
432 switch(Rand(3)) {
516 auto M = Mutators[Rand(Mutators.size())];