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

Function nearbyRandomNumber

deps/v8/tools/clusterfuzz/js_fuzzer/mutators/common.js:350–362  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

348}
349
350function nearbyRandomNumber(value) {
351 const probability = random.random();
352
353 if (probability < 0.9) {
354 return _numericLiteral(value + random.randInt(-0x10, 0x10));
355 } else if (probability < 0.95) {
356 return _numericLiteral(value + random.randInt(-0x100, 0x100));
357 } else if (probability < 0.99) {
358 return _numericLiteral(value + random.randInt(-0x1000, 0x1000));
359 }
360
361 return _numericLiteral(value + random.randInt(-0x10000, 0x10000));
362}
363
364function randomInterestingNumber() {
365 const value = random.single(INTERESTING_NUMBER_VALUES);

Callers 1

randomInterestingNumberFunction · 0.85

Calls 2

_numericLiteralFunction · 0.85
randomMethod · 0.80

Tested by

no test coverage detected