@azure/functions
Version:
Microsoft Azure Functions NodeJS Framework
10 lines (7 loc) • 317 B
text/typescript
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License.
import * as crypto from 'crypto';
export function getRandomHexString(length = 10): string {
const buffer: Buffer = crypto.randomBytes(Math.ceil(length / 2));
return buffer.toString('hex').slice(0, length);
}