// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. /** * Returns a random integer value between a lower and upper bound, * inclusive of both bounds. * Note that this uses Math.random and isn't secure. If you need to use * this for any kind of security purpose, find a better source of random. * @param min - The smallest integer value allowed. * @param max - The largest integer value allowed. */ export function getRandomIntegerInclusive(min, max) { // Make sure inputs are integers. min = Math.ceil(min); max = Math.floor(max); // Pick a random offset from zero to the size of the range. // Since Math.random() can never return 1, we have to make the range one larger // in order to be inclusive of the maximum value after we take the floor. const offset = Math.floor(Math.random() * (max - min + 1)); return offset + min; }//# sourceMappingURL=https://main.vscode-cdn.net/sourcemaps/072586267e68ece9a47aa43f8c108e0dcbf44622/node_modules/@typespec/ts-http-runtime/dist/browser/util/random.js.map