INNER CODE UNIT · TypeScript
randomHex
PerryTS/perry · example-code/forgejo-deployment/main.ts:79
function randomHex(bytes: number): string {
let out = '';
for (let i = 0; i < bytes; i++) {
const b = Math.floor(Math.random() * 256);
out += b.toString(16).padStart(2, '0');
}
return out;
}
// ──────────────────────────────────────────────────────────────────────
// Pre-flight checks
// ──────────────────────────────────────────────────────────────────────
async function preflightOrExit(httpPort: number, sshPort: number): Promise<void> {
const backend = getBackend();
if (backend === 'unknown' || backend === '') {
console.error(
'❌ No container runtime detected. Install one of:\n' +