UNPKG

317 BPlain TextView Raw
1// Copyright (c) .NET Foundation. All rights reserved.
2// Licensed under the MIT License.
3
4import * as crypto from 'crypto';
5
6export function getRandomHexString(length = 10): string {
7 const buffer: Buffer = crypto.randomBytes(Math.ceil(length / 2));
8 return buffer.toString('hex').slice(0, length);
9}