MCPcopy Create free account
hub / github.com/nodejs/node / randomValue

Function randomValue

deps/v8/tools/clusterfuzz/js_fuzzer/mutators/common.js:304–330  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

302}
303
304function randomValue(path) {
305 const probability = random.random();
306
307 if (probability < 0.01) {
308 const randomFunc = randomFunction(path);
309 if (randomFunc) {
310 return randomFunc;
311 }
312 }
313
314 if (probability < 0.25) {
315 const randomVar = randomVariable(path);
316 if (randomVar) {
317 return randomVar;
318 }
319 }
320
321 if (probability < 0.5) {
322 return randomInterestingNumber();
323 }
324
325 if (probability < 0.75) {
326 return randomInterestingNonNumber();
327 }
328
329 return randomObject();
330}
331
332function callRandomFunction(path, identifier, seed) {
333 if (seed === undefined) {

Callers 1

randomArgumentsFunction · 0.85

Calls 6

randomFunctionFunction · 0.85
randomVariableFunction · 0.85
randomInterestingNumberFunction · 0.85
randomObjectFunction · 0.85
randomMethod · 0.80

Tested by

no test coverage detected