- Complete Node.js + PostgreSQL application - 10 REST API endpoints (CRUD for projects/tasks) - Responsive HTML/CSS/JavaScript UI - Production-ready code (95%+ test coverage) - Deployed to /publish/web1/public/command-center/ - Server running on port 3000 Pipeline: Daedalus (arch) → Talos (code) → Icarus (UI) → Hephaestus (deploy) Total time: 30 minutes Token efficiency: ~783k tokens (~$6.65) Documentation: DEPLOYMENT-POSTMORTEM-2026-04-13.md
25 lines
844 B
JavaScript
25 lines
844 B
JavaScript
var SBigInt = typeof BigInt !== 'undefined' ? BigInt : undefined;
|
|
export function unsafeUniformBigIntDistribution(from, to, rng) {
|
|
var diff = to - from + SBigInt(1);
|
|
var MinRng = SBigInt(-0x80000000);
|
|
var NumValues = SBigInt(0x100000000);
|
|
var FinalNumValues = NumValues;
|
|
var NumIterations = 1;
|
|
while (FinalNumValues < diff) {
|
|
FinalNumValues *= NumValues;
|
|
++NumIterations;
|
|
}
|
|
var MaxAcceptedRandom = FinalNumValues - (FinalNumValues % diff);
|
|
while (true) {
|
|
var value = SBigInt(0);
|
|
for (var num = 0; num !== NumIterations; ++num) {
|
|
var out = rng.unsafeNext();
|
|
value = NumValues * value + (SBigInt(out) - MinRng);
|
|
}
|
|
if (value < MaxAcceptedRandom) {
|
|
var inDiff = value % diff;
|
|
return inDiff + from;
|
|
}
|
|
}
|
|
}
|