Eve library

Silent `Math.random()` Candidates — Inventory (V1-P2-3400)

Guide

Revision 1

On this page

Generated 2026-05-04T16:46:56Z by scripts/stub-indicator-scan.sh --mode=random --format=paths (whole-repo).

Summary#

Metric Count
Total Math.random() sites in scanned source 7143
Sites already annotated // random:legitimate <reason> 189
Sites still unannotated (this inventory's scope) 6954
Files containing at least one unannotated site 2752

The 6,954 unannotated sites are the ones that require V1-P2-3401 classification (REPLACE / ALLOW / DELETE). The 189 already-annotated sites are not listed below — they are pre-classified ALLOWs, suppressed by the scanner's random:legitimate allow-list filter.

Scope follows scripts/stub-indicator-scan.sh: tracked *.ts, *.tsx, *.rs, *.py, excluding test files (*.test.ts, *.spec.ts, *.test.tsx, *.spec.tsx, tests/, test/, test_*.py, *_test.py), node_modules/, dist/, .next/, build/, the scanner itself, the workflow file, and the master TODO.

Per-Domain Counts#

Domain root Sites
libs/aphrodite 959
libs/iris 695
apps/aphrodite 642
apps/lilith 617
libs/psyche 538
apps/oshun 430
libs/yemaya 387
libs/veritas 213
libs/oya 202
libs/isis 155
libs/aja 128
apps/hathor 128
libs/nous 125
apps/nyx 110
apps/veritas 108
libs/kuanyin 107
scripts/lilith 93
libs/maat 88
libs/hathor 76
libs/bellona 75
apps/aja 72
libs/shared 58
libs/neith 53
libs/euterpe 53
apps/yemaya 52
libs/mnemosyne 50
yaa/packages 47
libs/metis 45
libs/freya 41
apps/brigid 41
libs/demeter 40
libs/brigid 39
libs/nyx 36
libs/aglaea 30
apps/iris 28
libs/maya 26
libs/cybele 26
apps/arete 25
libs/tara 24
apps/demeter 23
apps/hestia 22
libs/lilith 21
libs/hestia 21
libs/oshun 18
libs/airmid 15
libs/saraswati 12
libs/meditation 12
libs/lakshmi 12
apps/tara 12
apps/maat 11
apps/isis 11
apps/psyche 10
serwaa/services 9
libs/nisaba 9
libs/arete 9
libs/sophia 8
apps/asase 8
libs/contracts 5
docs/training 5
apps/metis 5
testing/utils 4
libs/kalika 4
libs/asase 4
libs/aje 4
apps/sophia 4
libs/seshat 3
apps/freya 3
tests/integration 2
apps/cybele 2
apps/bellona 2
minerva/minerva 1
libs/galatea 1

Per-Candidate Listing#

Each candidate is shown with the surrounding 5-line context (2 lines before, the hit line, 2 lines after). Lines already bearing the random:legitimate annotation are tagged (annotated).

apps/aja/cli/src/commands/inspect.ts#

  • L341

    ts
    339      fps: 30,
    340      jointCount: 65,
    341      jitterScore: Math.random() * 0.05,
    342      footSlidingDistance: Math.random() * 3,
    343      boneLengthVariance: Math.random() * 0.03,
    
  • L342

    ts
    340      jointCount: 65,
    341      jitterScore: Math.random() * 0.05,
    342      footSlidingDistance: Math.random() * 3,
    343      boneLengthVariance: Math.random() * 0.03,
    344      jointAngleSmoothness: 0.8 + Math.random() * 0.2,
    
  • L343

    ts
    341      jitterScore: Math.random() * 0.05,
    342      footSlidingDistance: Math.random() * 3,
    343      boneLengthVariance: Math.random() * 0.03,
    344      jointAngleSmoothness: 0.8 + Math.random() * 0.2,
    345      physicalPlausibility: 0.75 + Math.random() * 0.25,
    
  • L344

    ts
    342      footSlidingDistance: Math.random() * 3,
    343      boneLengthVariance: Math.random() * 0.03,
    344      jointAngleSmoothness: 0.8 + Math.random() * 0.2,
    345      physicalPlausibility: 0.75 + Math.random() * 0.25,
    346      overallScore: 0,
    
  • L345

    ts
    343      boneLengthVariance: Math.random() * 0.03,
    344      jointAngleSmoothness: 0.8 + Math.random() * 0.2,
    345      physicalPlausibility: 0.75 + Math.random() * 0.25,
    346      overallScore: 0,
    347    };
    

apps/aja/svc-motion-ai/src/live-motion-capture/live-avatar-driving.ts#

  • L516

    ts
    514            // Reset timer with some randomness
    515            const avgInterval = 60 / this.settings.blinkRate;
    516            this.blinkTimer = avgInterval + (Math.random() - 0.5) * avgInterval * 0.5;
    517          }
    518
    

apps/aja/svc-motion-ai/src/live-motion-capture/realtime-pose-estimation.ts#

  • L42

    ts
    40
    41  function generateDetectionId(): string {
    42    return `det_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    43  }
    44
    
  • L1163

    ts
    1161      // We simulate finding 0-2 people in the frame
    1162
    1163      const numPeople = Math.random() > 0.3 ? 1 : Math.random() > 0.7 ? 2 : 0;
    1164
    1165      for (let p = 0; p < numPeople; p++) {
    
  • L1166

    ts
    1164
    1165      for (let p = 0; p < numPeople; p++) {
    1166        const baseX = 0.2 + p * 0.4 + (Math.random() - 0.5) * 0.1;
    1167        const baseY = 0.3 + (Math.random() - 0.5) * 0.1;
    1168
    
  • L1167

    ts
    1165      for (let p = 0; p < numPeople; p++) {
    1166        const baseX = 0.2 + p * 0.4 + (Math.random() - 0.5) * 0.1;
    1167        const baseY = 0.3 + (Math.random() - 0.5) * 0.1;
    1168
    1169        const keypoints2D = this.generateSimulatedKeypoints(frame.width, frame.height, baseX, baseY);
    
  • L1194

    ts
    1192        detections.push({
    1193          detectionId: generateDetectionId(),
    1194          confidence: 0.85 + Math.random() * 0.1,
    1195          boundingBox,
    1196          keypoints2D,
    
  • L1201

    ts
    1199
    1200      // Simulate processing time
    1201      await new Promise((resolve) => setTimeout(resolve, 15 + Math.random() * 20));
    1202
    1203      return detections;
    
  • L1253

    ts
    1251      for (const kp of keypointOffsets) {
    1252        // Add some noise
    1253        const noise = () => (Math.random() - 0.5) * 0.02;
    1254
    1255        keypoints.push({
    
  • L1259

    ts
    1257          x: (baseX + kp.dx + noise()) * width,
    1258          y: (baseY + kp.dy + noise()) * height,
    1259          confidence: 0.7 + Math.random() * 0.3,
    1260          visible: Math.random() > 0.1,
    1261        });
    
  • L1260

    ts
    1258          y: (baseY + kp.dy + noise()) * height,
    1259          confidence: 0.7 + Math.random() * 0.3,
    1260          visible: Math.random() > 0.1,
    1261        });
    1262      }
    

apps/aja/svc-motion-ai/src/live-motion-capture/webcam-capture.ts#

  • L35

    ts
    33
    34  function generateFrameId(): string {
    35    return `frame_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    36  }
    37
    

apps/aja/svc-motion-ai/src/motion-enhancement/motion-synthesis.ts#

  • L183

    ts
    181      for (let i = 0; i < length; i += 2) {
    182        // Box-Muller transform for Gaussian samples
    183        const u1 = Math.random();
    184        const u2 = Math.random();
    185        const r = Math.sqrt(-2 * Math.log(u1));
    
  • L184

    ts
    182        // Box-Muller transform for Gaussian samples
    183        const u1 = Math.random();
    184        const u2 = Math.random();
    185        const r = Math.sqrt(-2 * Math.log(u1));
    186        const theta = 2 * Math.PI * u2;
    
  • L2647

    ts
    2645        // Add noise to positions
    2646        const noisyPos: [number, number, number] = [
    2647          frame.rootPosition[0] + (Math.random() - 0.5) * noiseScale,
    2648          preserveContacts && frame.rootPosition[1] < 0.1
    2649            ? frame.rootPosition[1]
    
  • L2650

    ts
    2648          preserveContacts && frame.rootPosition[1] < 0.1
    2649            ? frame.rootPosition[1]
    2650            : frame.rootPosition[1] + (Math.random() - 0.5) * noiseScale,
    2651          frame.rootPosition[2] + (Math.random() - 0.5) * noiseScale,
    2652        ];
    
  • L2651

    ts
    2649            ? frame.rootPosition[1]
    2650            : frame.rootPosition[1] + (Math.random() - 0.5) * noiseScale,
    2651          frame.rootPosition[2] + (Math.random() - 0.5) * noiseScale,
    2652        ];
    2653
    
  • L2657

    ts
    2655        const noisyRotations = new Float32Array(frame.jointRotations.length);
    2656        for (let j = 0; j < frame.jointRotations.length; j++) {
    2657          noisyRotations[j] = frame.jointRotations[j] + (Math.random() - 0.5) * noiseScale * 0.1;
    2658        }
    2659
    

apps/aja/svc-motion-ai/src/motion-enhancement/types.ts#

  • L1528

    ts
    1526   */
    1527  export function generateMotionId(): MotionId {
    1528    return `motion_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as MotionId;
    1529  }
    1530
    
  • L1535

    ts
    1533   */
    1534  export function generateDiffusionSessionId(): DiffusionSessionId {
    1535    return `diff_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as DiffusionSessionId;
    1536  }
    1537
    
  • L1542

    ts
    1540   */
    1541  export function generateStyleId(): StyleId {
    1542    return `style_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as StyleId;
    1543  }
    1544
    
  • L1549

    ts
    1547   */
    1548  export function generatePipelineId(): EnhancementPipelineId {
    1549    return `pipeline_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as EnhancementPipelineId;
    1550  }
    1551
    
  • L1556

    ts
    1554   */
    1555  export function generatePhysicsSessionId(): PhysicsSessionId {
    1556    return `physics_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as PhysicsSessionId;
    1557  }
    

apps/aja/svc-motion-ai/src/video-to-motion/video-to-motion-service.ts#

  • L409

    ts
    407
    408    private generateJobId(): string {
    409      return `job_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    410    }
    411
    

apps/aja/svc-reference-video/src/annotation.ts#

  • L449

    ts
    447      data: Omit<T, 'id' | 'videoId' | 'createdAt' | 'updatedAt'>
    448    ): T {
    449      const id = `ann_${data.type}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as AnnotationId;
    450      const now = new Date();
    451
    
  • L708

    ts
    706      } = {}
    707    ): SegmentAnnotation {
    708      const segmentId = `seg_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as SegmentId;
    709
    710      return this.create<SegmentAnnotation>(videoId, {
    
  • L741

    ts
    739        '#DDA0DD', '#98D8C8', '#F7DC6F', '#BB8FCE', '#85C1E9',
    740      ];
    741      return colors[Math.floor(Math.random() * colors.length)];
    742    }
    743
    
  • L1168

    ts
    1166      options: { color?: string } = {}
    1167    ): AnnotationTrack {
    1168      const id = `track_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    1169
    1170      const track: AnnotationTrack = {
    
  • L1294

    ts
    1292      } = {}
    1293    ): VideoClip {
    1294      const id = `clip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as ClipId;
    1295
    1296      const clip: VideoClip = {
    

apps/aja/svc-reference-video/src/collaboration.ts#

  • L638

    ts
    636      } = {}
    637    ): Workspace {
    638      const id = `ws_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as WorkspaceId;
    639      const slug = name.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
    640
    
  • L888

    ts
    886      expiresInDays: number = 7
    887    ): WorkspaceInvitation {
    888      const id = `inv_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    889
    890      const invitation: WorkspaceInvitation = {
    
  • L982

    ts
    980      }
    981
    982      const id = `cmt_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as CommentId;
    983
    984      const comment: Comment = {
    
  • L1230

    ts
    1228      }
    1229
    1230      const id = `rev_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as ReviewId;
    1231
    1232      // Apply template if specified
    
  • L1428

    ts
    1426      } = {}
    1427    ): ReviewTemplate {
    1428      const id = `tmpl_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    1429
    1430      const template: ReviewTemplate = {
    
  • L1469

    ts
    1467      } = {}
    1468    ): Assignment {
    1469      const id = `asn_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as AssignmentId;
    1470
    1471      const assignment: Assignment = {
    
  • L1654

    ts
    1652      } = {}
    1653    ): AssignmentBatch {
    1654      const batchId = `batch_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    1655      const assignmentIds: AssignmentId[] = [];
    1656
    
  • L1728

    ts
    1726    ): ActivityEvent {
    1727      const event: ActivityEvent = {
    1728        id: `act_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    1729        workspaceId,
    1730        userId,
    
  • L1806

    ts
    1804    ): Notification {
    1805      const notification: Notification = {
    1806        id: `notif_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    1807        userId,
    1808        type,
    

apps/aja/svc-reference-video/src/metadata-extraction.ts#

  • L526

    ts
    524      const width = is4K ? 3840 : isHD ? 1920 : 1280;
    525      const height = is4K ? 2160 : isHD ? 1080 : 720;
    526      const duration = 120 + Math.random() * 300; // 2-7 minutes
    527
    528      return {
    

apps/aja/svc-reference-video/src/scene-detection.ts#

  • L263

    ts
    261          // Create a noticeable difference at scene change
    262          stats[frame].avgHsv.hue = (stats[frame].avgHsv.hue + 120) % 360;
    263          stats[frame].avgLuminance = Math.random() * 128 + 64;
    264        }
    265      }
    
  • L284

    ts
    282        frameNumber,
    283        avgHsv: {
    284          hue: (baseHue + Math.random() * 5) % 360,
    285          saturation: 0.5 + Math.random() * 0.1,
    286          value: 0.5 + Math.random() * 0.1,
    
  • L285

    ts
    283        avgHsv: {
    284          hue: (baseHue + Math.random() * 5) % 360,
    285          saturation: 0.5 + Math.random() * 0.1,
    286          value: 0.5 + Math.random() * 0.1,
    287        },
    
  • L286

    ts
    284          hue: (baseHue + Math.random() * 5) % 360,
    285          saturation: 0.5 + Math.random() * 0.1,
    286          value: 0.5 + Math.random() * 0.1,
    287        },
    288        histogram: this.generateHistogram(baseLum),
    
  • L289

    ts
    287        },
    288        histogram: this.generateHistogram(baseLum),
    289        avgLuminance: baseLum + Math.random() * 10 - 5,
    290        edgeDensity: 0.3 + Math.random() * 0.2,
    291        motionMagnitude: Math.random() * 10,
    
  • L290

    ts
    288        histogram: this.generateHistogram(baseLum),
    289        avgLuminance: baseLum + Math.random() * 10 - 5,
    290        edgeDensity: 0.3 + Math.random() * 0.2,
    291        motionMagnitude: Math.random() * 10,
    292      };
    
  • L291

    ts
    289        avgLuminance: baseLum + Math.random() * 10 - 5,
    290        edgeDensity: 0.3 + Math.random() * 0.2,
    291        motionMagnitude: Math.random() * 10,
    292      };
    293    }
    
  • L321

    ts
    319      const avgSceneLength = 150; // ~5 seconds at 30fps
    320
    321      let currentFrame = avgSceneLength + Math.floor(Math.random() * 100);
    322      while (currentFrame < frameCount - 30) {
    323        changes.push(currentFrame);
    
  • L324

    ts
    322      while (currentFrame < frameCount - 30) {
    323        changes.push(currentFrame);
    324        currentFrame += avgSceneLength + Math.floor(Math.random() * 100 - 50);
    325      }
    326
    
  • L726

    ts
    724          transitionIn,
    725          transitionOut,
    726          confidence: 0.85 + Math.random() * 0.15, // Simulated confidence
    727          keyframeNumber,
    728          averageBrightness,
    
  • L853

    ts
    851
    852      while (currentFrame < frameCount) {
    853        const actionLength = 60 + Math.floor(Math.random() * 120); // 2-6 seconds at 30fps
    854        const endFrame = Math.min(currentFrame + actionLength, frameCount - 1);
    855
    
  • L859

    ts
    857          startFrame: currentFrame,
    858          endFrame,
    859          label: actionLabels[Math.floor(Math.random() * actionLabels.length)],
    860          confidence: 0.7 + Math.random() * 0.3,
    861        });
    
  • L860

    ts
    858          endFrame,
    859          label: actionLabels[Math.floor(Math.random() * actionLabels.length)],
    860          confidence: 0.7 + Math.random() * 0.3,
    861        });
    862
    
  • L911

    ts
    909          startFrame: i * repDuration,
    910          endFrame: (i + 1) * repDuration - 1,
    911          quality: 0.6 + Math.random() * 0.4,
    912        });
    913      }
    
  • L951

    ts
    949      let currentFrame = 300; // First rest after ~10 seconds
    950      while (currentFrame < frameCount - 100) {
    951        const restLength = 90 + Math.floor(Math.random() * 60); // 3-5 seconds
    952        restPeriods.push({
    953          startFrame: currentFrame,
    
  • L958

    ts
    956        });
    957
    958        currentFrame += restLength + 300 + Math.floor(Math.random() * 200);
    959      }
    960
    

apps/aja/svc-reference-video/src/types.ts#

  • L63

    ts
    61
    62  export function generateVideoId(): VideoId {
    63    return `vid_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as VideoId;
    64  }
    65
    
  • L67

    ts
    65
    66  export function generateSegmentId(): SegmentId {
    67    return `seg_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as SegmentId;
    68  }
    69
    
  • L71

    ts
    69
    70  export function generateAnnotationId(): AnnotationId {
    71    return `ann_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as AnnotationId;
    72  }
    73
    
  • L75

    ts
    73
    74  export function generateClipId(): ClipId {
    75    return `clip_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as ClipId;
    76  }
    77
    
  • L79

    ts
    77
    78  export function generateCategoryId(): CategoryId {
    79    return `cat_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as CategoryId;
    80  }
    81
    
  • L83

    ts
    81
    82  export function generateTagId(): TagId {
    83    return `tag_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as TagId;
    84  }
    85
    
  • L87

    ts
    85
    86  export function generateWorkspaceId(): WorkspaceId {
    87    return `ws_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as WorkspaceId;
    88  }
    89
    
  • L91

    ts
    89
    90  export function generateCommentId(): CommentId {
    91    return `cmt_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as CommentId;
    92  }
    93
    
  • L95

    ts
    93
    94  export function generateReviewId(): ReviewId {
    95    return `rev_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as ReviewId;
    96  }
    97
    
  • L99

    ts
    97
    98  export function generateAssignmentId(): AssignmentId {
    99    return `asn_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as AssignmentId;
    100  }
    101
    
  • L103

    ts
    101
    102  export function generateVersionId(): VersionId {
    103    return `ver_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as VersionId;
    104  }
    105
    
  • L107

    ts
    105
    106  export function generateEmbeddingId(): EmbeddingId {
    107    return `emb_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as EmbeddingId;
    108  }
    109
    

apps/aja/svc-reference-video/src/video-ingestion.ts#

  • L769

    ts
    767
    768    private generateSessionId(): string {
    769      return `upload_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
    770    }
    771
    

apps/aphrodite/admin-bi-dashboard/src/routes/compliance.ts#

  • L55

    ts
    53
    54    // Generate compliance scores
    55    const ageVerificationScore = 92 + Math.random() * 6;
    56    const moderationScore = 88 + Math.random() * 8;
    57    const record2257Score = 95 + Math.random() * 4;
    
  • L56

    ts
    54    // Generate compliance scores
    55    const ageVerificationScore = 92 + Math.random() * 6;
    56    const moderationScore = 88 + Math.random() * 8;
    57    const record2257Score = 95 + Math.random() * 4;
    58    const gdprScore = 90 + Math.random() * 7;
    
  • L57

    ts
    55    const ageVerificationScore = 92 + Math.random() * 6;
    56    const moderationScore = 88 + Math.random() * 8;
    57    const record2257Score = 95 + Math.random() * 4;
    58    const gdprScore = 90 + Math.random() * 7;
    59    const overallScore = (ageVerificationScore + moderationScore + record2257Score + gdprScore) / 4;
    
  • L58

    ts
    56    const moderationScore = 88 + Math.random() * 8;
    57    const record2257Score = 95 + Math.random() * 4;
    58    const gdprScore = 90 + Math.random() * 7;
    59    const overallScore = (ageVerificationScore + moderationScore + record2257Score + gdprScore) / 4;
    60
    
  • L206

    ts
    204
    205    // Verification summary
    206    const totalVerifications = 5000 + Math.floor(Math.random() * 2000);
    207    const successfulVerifications = Math.floor(totalVerifications * (0.92 + Math.random() * 0.05));
    208    const failedVerifications = Math.floor(
    
  • L207

    ts
    205    // Verification summary
    206    const totalVerifications = 5000 + Math.floor(Math.random() * 2000);
    207    const successfulVerifications = Math.floor(totalVerifications * (0.92 + Math.random() * 0.05));
    208    const failedVerifications = Math.floor(
    209      (totalVerifications - successfulVerifications) * (0.6 + Math.random() * 0.3)
    
  • L209

    ts
    207    const successfulVerifications = Math.floor(totalVerifications * (0.92 + Math.random() * 0.05));
    208    const failedVerifications = Math.floor(
    209      (totalVerifications - successfulVerifications) * (0.6 + Math.random() * 0.3)
    210    );
    211    const pendingVerifications = totalVerifications - successfulVerifications - failedVerifications;
    
  • L213

    ts
    211    const pendingVerifications = totalVerifications - successfulVerifications - failedVerifications;
    212    const successRate = successfulVerifications / totalVerifications;
    213    const avgVerificationTime = 45 + Math.random() * 30; // seconds
    214
    215    // Verification methods
    
  • L225

    ts
    223    const byMethod = methods.map((m) => ({
    224      method: m.method,
    225      count: Math.floor(totalVerifications * m.share * (0.9 + Math.random() * 0.2)),
    226      successRate: 0.88 + Math.random() * 0.1,
    227      avgTime: m.avgTime * (0.8 + Math.random() * 0.4),
    
  • L226

    ts
    224      method: m.method,
    225      count: Math.floor(totalVerifications * m.share * (0.9 + Math.random() * 0.2)),
    226      successRate: 0.88 + Math.random() * 0.1,
    227      avgTime: m.avgTime * (0.8 + Math.random() * 0.4),
    228      percentage: m.share * 100,
    
  • L227

    ts
    225      count: Math.floor(totalVerifications * m.share * (0.9 + Math.random() * 0.2)),
    226      successRate: 0.88 + Math.random() * 0.1,
    227      avgTime: m.avgTime * (0.8 + Math.random() * 0.4),
    228      percentage: m.share * 100,
    229    }));
    
  • L241

    ts
    239    const byProvider = providers.map((p) => ({
    240      provider: p.provider,
    241      verifications: Math.floor(totalVerifications * p.share * (0.9 + Math.random() * 0.2)),
    242      successRate: 0.9 + Math.random() * 0.08,
    243      avgCost: p.cost * (0.9 + Math.random() * 0.2),
    
  • L242

    ts
    240      provider: p.provider,
    241      verifications: Math.floor(totalVerifications * p.share * (0.9 + Math.random() * 0.2)),
    242      successRate: 0.9 + Math.random() * 0.08,
    243      avgCost: p.cost * (0.9 + Math.random() * 0.2),
    244      avgTime: 30 + Math.random() * 60,
    
  • L243

    ts
    241      verifications: Math.floor(totalVerifications * p.share * (0.9 + Math.random() * 0.2)),
    242      successRate: 0.9 + Math.random() * 0.08,
    243      avgCost: p.cost * (0.9 + Math.random() * 0.2),
    244      avgTime: 30 + Math.random() * 60,
    245    }));
    
  • L244

    ts
    242      successRate: 0.9 + Math.random() * 0.08,
    243      avgCost: p.cost * (0.9 + Math.random() * 0.2),
    244      avgTime: 30 + Math.random() * 60,
    245    }));
    246
    
  • L259

    ts
    257    const byRegion = regions.map((r) => ({
    258      region: r.region,
    259      verifications: Math.floor(totalVerifications * (0.05 + Math.random() * 0.25)),
    260      successRate: 0.88 + Math.random() * 0.1,
    261      complianceLevel: r.level,
    
  • L260

    ts
    258      region: r.region,
    259      verifications: Math.floor(totalVerifications * (0.05 + Math.random() * 0.25)),
    260      successRate: 0.88 + Math.random() * 0.1,
    261      complianceLevel: r.level,
    262    }));
    
  • L273

    ts
    271    ].map((a) => ({
    272      ageRange: a.ageRange,
    273      count: Math.floor(successfulVerifications * a.share * (0.9 + Math.random() * 0.2)),
    274      percentage: a.share * 100,
    275    }));
    
  • L351

    ts
    349
    350    // Summary metrics
    351    const totalContent = 500000 + Math.floor(Math.random() * 200000);
    352    const reviewedContent = Math.floor(totalContent * (0.15 + Math.random() * 0.1));
    353    const flaggedContent = Math.floor(reviewedContent * (0.08 + Math.random() * 0.04));
    
  • L352

    ts
    350    // Summary metrics
    351    const totalContent = 500000 + Math.floor(Math.random() * 200000);
    352    const reviewedContent = Math.floor(totalContent * (0.15 + Math.random() * 0.1));
    353    const flaggedContent = Math.floor(reviewedContent * (0.08 + Math.random() * 0.04));
    354    const removedContent = Math.floor(flaggedContent * (0.6 + Math.random() * 0.2));
    
  • L353

    ts
    351    const totalContent = 500000 + Math.floor(Math.random() * 200000);
    352    const reviewedContent = Math.floor(totalContent * (0.15 + Math.random() * 0.1));
    353    const flaggedContent = Math.floor(reviewedContent * (0.08 + Math.random() * 0.04));
    354    const removedContent = Math.floor(flaggedContent * (0.6 + Math.random() * 0.2));
    355    const appealedContent = Math.floor(removedContent * (0.15 + Math.random() * 0.1));
    
  • L354

    ts
    352    const reviewedContent = Math.floor(totalContent * (0.15 + Math.random() * 0.1));
    353    const flaggedContent = Math.floor(reviewedContent * (0.08 + Math.random() * 0.04));
    354    const removedContent = Math.floor(flaggedContent * (0.6 + Math.random() * 0.2));
    355    const appealedContent = Math.floor(removedContent * (0.15 + Math.random() * 0.1));
    356    const restoredContent = Math.floor(appealedContent * (0.2 + Math.random() * 0.15));
    
  • L355

    ts
    353    const flaggedContent = Math.floor(reviewedContent * (0.08 + Math.random() * 0.04));
    354    const removedContent = Math.floor(flaggedContent * (0.6 + Math.random() * 0.2));
    355    const appealedContent = Math.floor(removedContent * (0.15 + Math.random() * 0.1));
    356    const restoredContent = Math.floor(appealedContent * (0.2 + Math.random() * 0.15));
    357    const avgReviewTime = 30 + Math.random() * 60; // seconds
    
  • L356

    ts
    354    const removedContent = Math.floor(flaggedContent * (0.6 + Math.random() * 0.2));
    355    const appealedContent = Math.floor(removedContent * (0.15 + Math.random() * 0.1));
    356    const restoredContent = Math.floor(appealedContent * (0.2 + Math.random() * 0.15));
    357    const avgReviewTime = 30 + Math.random() * 60; // seconds
    358    const falsePositiveRate = 0.02 + Math.random() * 0.03;
    
  • L357

    ts
    355    const appealedContent = Math.floor(removedContent * (0.15 + Math.random() * 0.1));
    356    const restoredContent = Math.floor(appealedContent * (0.2 + Math.random() * 0.15));
    357    const avgReviewTime = 30 + Math.random() * 60; // seconds
    358    const falsePositiveRate = 0.02 + Math.random() * 0.03;
    359
    
  • L358

    ts
    356    const restoredContent = Math.floor(appealedContent * (0.2 + Math.random() * 0.15));
    357    const avgReviewTime = 30 + Math.random() * 60; // seconds
    358    const falsePositiveRate = 0.02 + Math.random() * 0.03;
    359
    360    // Violation types
    
  • L374

    ts
    372
    373    const byViolationType = violationTypes.map((v) => {
    374      const count = Math.floor(flaggedContent * v.share * (0.85 + Math.random() * 0.3));
    375      const actionsTaken = Math.floor(count * (0.7 + Math.random() * 0.25));
    376      const appealed = Math.floor(actionsTaken * (0.1 + Math.random() * 0.1));
    
  • L375

    ts
    373    const byViolationType = violationTypes.map((v) => {
    374      const count = Math.floor(flaggedContent * v.share * (0.85 + Math.random() * 0.3));
    375      const actionsTaken = Math.floor(count * (0.7 + Math.random() * 0.25));
    376      const appealed = Math.floor(actionsTaken * (0.1 + Math.random() * 0.1));
    377      const upheld = Math.floor(appealed * (0.75 + Math.random() * 0.2));
    
  • L376

    ts
    374      const count = Math.floor(flaggedContent * v.share * (0.85 + Math.random() * 0.3));
    375      const actionsTaken = Math.floor(count * (0.7 + Math.random() * 0.25));
    376      const appealed = Math.floor(actionsTaken * (0.1 + Math.random() * 0.1));
    377      const upheld = Math.floor(appealed * (0.75 + Math.random() * 0.2));
    378      return {
    
  • L377

    ts
    375      const actionsTaken = Math.floor(count * (0.7 + Math.random() * 0.25));
    376      const appealed = Math.floor(actionsTaken * (0.1 + Math.random() * 0.1));
    377      const upheld = Math.floor(appealed * (0.75 + Math.random() * 0.2));
    378      return {
    379        type: v.type,
    
  • L399

    ts
    397
    398    const byContentType = contentTypes.map((ct) => {
    399      const reviewed = Math.floor(reviewedContent * ct.share * (0.9 + Math.random() * 0.2));
    400      const flagged = Math.floor(reviewed * (0.05 + Math.random() * 0.05));
    401      const removed = Math.floor(flagged * (0.6 + Math.random() * 0.3));
    
  • L400

    ts
    398    const byContentType = contentTypes.map((ct) => {
    399      const reviewed = Math.floor(reviewedContent * ct.share * (0.9 + Math.random() * 0.2));
    400      const flagged = Math.floor(reviewed * (0.05 + Math.random() * 0.05));
    401      const removed = Math.floor(flagged * (0.6 + Math.random() * 0.3));
    402      return {
    
  • L401

    ts
    399      const reviewed = Math.floor(reviewedContent * ct.share * (0.9 + Math.random() * 0.2));
    400      const flagged = Math.floor(reviewed * (0.05 + Math.random() * 0.05));
    401      const removed = Math.floor(flagged * (0.6 + Math.random() * 0.3));
    402      return {
    403        contentType: ct.contentType,
    
  • L414

    ts
    412    const moderatorPerformance = Array.from({ length: 10 }, (_, i) => ({
    413      moderatorId: `mod_${1000 + i}`,
    414      reviewed: Math.floor((reviewedContent / 20 / (i + 1)) * (0.8 + Math.random() * 0.4)),
    415      accuracy: 0.92 + Math.random() * 0.06,
    416      avgTime: 20 + Math.random() * 40,
    
  • L415

    ts
    413      moderatorId: `mod_${1000 + i}`,
    414      reviewed: Math.floor((reviewedContent / 20 / (i + 1)) * (0.8 + Math.random() * 0.4)),
    415      accuracy: 0.92 + Math.random() * 0.06,
    416      avgTime: 20 + Math.random() * 40,
    417      appeals: Math.floor(50 / (i + 1)),
    
  • L416

    ts
    414      reviewed: Math.floor((reviewedContent / 20 / (i + 1)) * (0.8 + Math.random() * 0.4)),
    415      accuracy: 0.92 + Math.random() * 0.06,
    416      avgTime: 20 + Math.random() * 40,
    417      appeals: Math.floor(50 / (i + 1)),
    418      overturned: Math.floor(10 / (i + 1)),
    
  • L422

    ts
    420
    421    // Automated moderation metrics
    422    const aiReviewed = Math.floor(totalContent * (0.95 + Math.random() * 0.04));
    423    const automatedModeration = {
    424      aiReviewed,
    
  • L425

    ts
    423    const automatedModeration = {
    424      aiReviewed,
    425      aiActioned: Math.floor(aiReviewed * (0.02 + Math.random() * 0.01)),
    426      humanEscalated: Math.floor(aiReviewed * (0.03 + Math.random() * 0.02)),
    427      accuracy: 0.94 + Math.random() * 0.04,
    
  • L426

    ts
    424      aiReviewed,
    425      aiActioned: Math.floor(aiReviewed * (0.02 + Math.random() * 0.01)),
    426      humanEscalated: Math.floor(aiReviewed * (0.03 + Math.random() * 0.02)),
    427      accuracy: 0.94 + Math.random() * 0.04,
    428      avgConfidence: 0.85 + Math.random() * 0.1,
    
  • L427

    ts
    425      aiActioned: Math.floor(aiReviewed * (0.02 + Math.random() * 0.01)),
    426      humanEscalated: Math.floor(aiReviewed * (0.03 + Math.random() * 0.02)),
    427      accuracy: 0.94 + Math.random() * 0.04,
    428      avgConfidence: 0.85 + Math.random() * 0.1,
    429    };
    
  • L428

    ts
    426      humanEscalated: Math.floor(aiReviewed * (0.03 + Math.random() * 0.02)),
    427      accuracy: 0.94 + Math.random() * 0.04,
    428      avgConfidence: 0.85 + Math.random() * 0.1,
    429    };
    430
    
  • L434

    ts
    432    const appealMetrics = {
    433      totalAppeals: appealedContent,
    434      resolved: Math.floor(appealedContent * (0.85 + Math.random() * 0.1)),
    435      pending: Math.floor(appealedContent * (0.1 + Math.random() * 0.05)),
    436      upheld: Math.floor(appealedContent * (0.65 + Math.random() * 0.15)),
    
  • L435

    ts
    433      totalAppeals: appealedContent,
    434      resolved: Math.floor(appealedContent * (0.85 + Math.random() * 0.1)),
    435      pending: Math.floor(appealedContent * (0.1 + Math.random() * 0.05)),
    436      upheld: Math.floor(appealedContent * (0.65 + Math.random() * 0.15)),
    437      overturned: restoredContent,
    
  • L436

    ts
    434      resolved: Math.floor(appealedContent * (0.85 + Math.random() * 0.1)),
    435      pending: Math.floor(appealedContent * (0.1 + Math.random() * 0.05)),
    436      upheld: Math.floor(appealedContent * (0.65 + Math.random() * 0.15)),
    437      overturned: restoredContent,
    438      avgResolutionTime: 24 + Math.random() * 48, // hours
    
  • L438

    ts
    436      upheld: Math.floor(appealedContent * (0.65 + Math.random() * 0.15)),
    437      overturned: restoredContent,
    438      avgResolutionTime: 24 + Math.random() * 48, // hours
    439    };
    440
    
  • L508

    ts
    506
    507    // Creator compliance summary
    508    const totalCreators = 8000 + Math.floor(Math.random() * 2000);
    509    const compliantCreators = Math.floor(totalCreators * (0.94 + Math.random() * 0.04));
    510    const pendingVerification = Math.floor(totalCreators * (0.02 + Math.random() * 0.02));
    
  • L509

    ts
    507    // Creator compliance summary
    508    const totalCreators = 8000 + Math.floor(Math.random() * 2000);
    509    const compliantCreators = Math.floor(totalCreators * (0.94 + Math.random() * 0.04));
    510    const pendingVerification = Math.floor(totalCreators * (0.02 + Math.random() * 0.02));
    511    const nonCompliant = totalCreators - compliantCreators - pendingVerification;
    
  • L510

    ts
    508    const totalCreators = 8000 + Math.floor(Math.random() * 2000);
    509    const compliantCreators = Math.floor(totalCreators * (0.94 + Math.random() * 0.04));
    510    const pendingVerification = Math.floor(totalCreators * (0.02 + Math.random() * 0.02));
    511    const nonCompliant = totalCreators - compliantCreators - pendingVerification;
    512    const complianceRate = compliantCreators / totalCreators;
    
  • L514

    ts
    512    const complianceRate = compliantCreators / totalCreators;
    513    const recordsOnFile = compliantCreators * 3; // avg 3 documents per creator
    514    const avgRecordAge = 180 + Math.random() * 180; // days
    515
    516    // Document status
    
  • L525

    ts
    523    ].map((s) => ({
    524      status: s.status,
    525      count: Math.floor(recordsOnFile * s.percentage * (0.9 + Math.random() * 0.2)),
    526      percentage: s.percentage * 100,
    527    }));
    
  • L538

    ts
    536    ].map((d) => {
    537      const count = Math.floor(recordsOnFile * d.share);
    538      const valid = Math.floor(count * (0.92 + Math.random() * 0.06));
    539      const expiringSoon = Math.floor(count * (0.03 + Math.random() * 0.02));
    540      const expired = count - valid - expiringSoon;
    
  • L539

    ts
    537      const count = Math.floor(recordsOnFile * d.share);
    538      const valid = Math.floor(count * (0.92 + Math.random() * 0.06));
    539      const expiringSoon = Math.floor(count * (0.03 + Math.random() * 0.02));
    540      const expired = count - valid - expiringSoon;
    541      return {
    
  • L558

    ts
    556    ].map((e) => ({
    557      range: e.range,
    558      count: Math.floor(recordsOnFile * e.percentage * (0.8 + Math.random() * 0.4)),
    559      percentage: e.percentage * 100,
    560    }));
    
  • L567

    ts
    565        new Date(Date.now() - (i + 1) * 90 * 24 * 60 * 60 * 1000).toISOString().split('T')[0] ?? '',
    566      type: i === 0 ? 'Internal Audit' : i === 2 ? 'External Audit' : 'Spot Check',
    567      result: (i === 0 ? 'passed' : Math.random() > 0.2 ? 'passed' : 'warning') as
    568        | 'passed'
    569        | 'warning'
    
  • L571

    ts
    569        | 'warning'
    570        | 'failed',
    571      findings: Math.floor(Math.random() * 5),
    572      resolved: Math.floor(Math.random() * 3),
    573    }));
    
  • L572

    ts
    570        | 'failed',
    571      findings: Math.floor(Math.random() * 5),
    572      resolved: Math.floor(Math.random() * 3),
    573    }));
    574
    
  • L597

    ts
    595        lastUpdated: new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString(),
    596        recordsAccessible: true,
    597        avgRetrievalTime: 2.5 + Math.random() * 2, // seconds
    598      },
    599    };
    
  • L642

    ts
    640
    641    // Data subject requests
    642    const totalDSR = 150 + Math.floor(Math.random() * 100);
    643    const dataSubjectRequests = {
    644      total: totalDSR,
    
  • L651

    ts
    649      restriction: Math.floor(totalDSR * 0.05),
    650      objection: Math.floor(totalDSR * 0.05),
    651      avgResponseTime: 5 + Math.random() * 10, // days
    652      onTimeRate: 0.95 + Math.random() * 0.04,
    653    };
    
  • L652

    ts
    650      objection: Math.floor(totalDSR * 0.05),
    651      avgResponseTime: 5 + Math.random() * 10, // days
    652      onTimeRate: 0.95 + Math.random() * 0.04,
    653    };
    654
    
  • L656

    ts
    654
    655    // Consent metrics
    656    const totalUsers = 200000 + Math.floor(Math.random() * 50000);
    657    const consentMetrics = {
    658      totalUsers,
    
  • L659

    ts
    657    const consentMetrics = {
    658      totalUsers,
    659      consentGiven: Math.floor(totalUsers * (0.85 + Math.random() * 0.1)),
    660      consentWithdrawn: Math.floor(totalUsers * (0.02 + Math.random() * 0.02)),
    661      consentPending: Math.floor(totalUsers * (0.05 + Math.random() * 0.03)),
    
  • L660

    ts
    658      totalUsers,
    659      consentGiven: Math.floor(totalUsers * (0.85 + Math.random() * 0.1)),
    660      consentWithdrawn: Math.floor(totalUsers * (0.02 + Math.random() * 0.02)),
    661      consentPending: Math.floor(totalUsers * (0.05 + Math.random() * 0.03)),
    662      byPurpose: [
    
  • L661

    ts
    659      consentGiven: Math.floor(totalUsers * (0.85 + Math.random() * 0.1)),
    660      consentWithdrawn: Math.floor(totalUsers * (0.02 + Math.random() * 0.02)),
    661      consentPending: Math.floor(totalUsers * (0.05 + Math.random() * 0.03)),
    662      byPurpose: [
    663        { purpose: 'Marketing', rate: 0.45 },
    
  • L670

    ts
    668      ].map((p) => ({
    669        purpose: p.purpose,
    670        consented: Math.floor(totalUsers * p.rate * (0.9 + Math.random() * 0.2)),
    671        declined: Math.floor(totalUsers * (1 - p.rate) * (0.9 + Math.random() * 0.2)),
    672        rate: p.rate * (0.95 + Math.random() * 0.1),
    
  • L671

    ts
    669        purpose: p.purpose,
    670        consented: Math.floor(totalUsers * p.rate * (0.9 + Math.random() * 0.2)),
    671        declined: Math.floor(totalUsers * (1 - p.rate) * (0.9 + Math.random() * 0.2)),
    672        rate: p.rate * (0.95 + Math.random() * 0.1),
    673      })),
    
  • L672

    ts
    670        consented: Math.floor(totalUsers * p.rate * (0.9 + Math.random() * 0.2)),
    671        declined: Math.floor(totalUsers * (1 - p.rate) * (0.9 + Math.random() * 0.2)),
    672        rate: p.rate * (0.95 + Math.random() * 0.1),
    673      })),
    674    };
    
  • L678

    ts
    676    // Breach incidents
    677    const breachIncidents = {
    678      total: Math.floor(Math.random() * 3),
    679      resolved: Math.floor(Math.random() * 2),
    680      pending: Math.floor(Math.random() * 2),
    
  • L679

    ts
    677    const breachIncidents = {
    678      total: Math.floor(Math.random() * 3),
    679      resolved: Math.floor(Math.random() * 2),
    680      pending: Math.floor(Math.random() * 2),
    681      reportedToAuthority: Math.floor(Math.random() * 2),
    
  • L680

    ts
    678      total: Math.floor(Math.random() * 3),
    679      resolved: Math.floor(Math.random() * 2),
    680      pending: Math.floor(Math.random() * 2),
    681      reportedToAuthority: Math.floor(Math.random() * 2),
    682      reportedToSubjects: Math.floor(Math.random() * 1),
    
  • L681

    ts
    679      resolved: Math.floor(Math.random() * 2),
    680      pending: Math.floor(Math.random() * 2),
    681      reportedToAuthority: Math.floor(Math.random() * 2),
    682      reportedToSubjects: Math.floor(Math.random() * 1),
    683      avgDetectionTime: 2 + Math.random() * 4, // hours
    
  • L682

    ts
    680      pending: Math.floor(Math.random() * 2),
    681      reportedToAuthority: Math.floor(Math.random() * 2),
    682      reportedToSubjects: Math.floor(Math.random() * 1),
    683      avgDetectionTime: 2 + Math.random() * 4, // hours
    684      avgNotificationTime: 24 + Math.random() * 24, // hours
    
  • L683

    ts
    681      reportedToAuthority: Math.floor(Math.random() * 2),
    682      reportedToSubjects: Math.floor(Math.random() * 1),
    683      avgDetectionTime: 2 + Math.random() * 4, // hours
    684      avgNotificationTime: 24 + Math.random() * 24, // hours
    685    };
    
  • L684

    ts
    682      reportedToSubjects: Math.floor(Math.random() * 1),
    683      avgDetectionTime: 2 + Math.random() * 4, // hours
    684      avgNotificationTime: 24 + Math.random() * 24, // hours
    685    };
    686
    
  • L689

    ts
    687    // Data processing activities
    688    const dataProcessing = {
    689      activitiesDocumented: 45 + Math.floor(Math.random() * 15),
    690      dpiaRequired: 8 + Math.floor(Math.random() * 5),
    691      dpiaCompleted: 7 + Math.floor(Math.random() * 4),
    
  • L690

    ts
    688    const dataProcessing = {
    689      activitiesDocumented: 45 + Math.floor(Math.random() * 15),
    690      dpiaRequired: 8 + Math.floor(Math.random() * 5),
    691      dpiaCompleted: 7 + Math.floor(Math.random() * 4),
    692      internationalTransfers: 5 + Math.floor(Math.random() * 3),
    
  • L691

    ts
    689      activitiesDocumented: 45 + Math.floor(Math.random() * 15),
    690      dpiaRequired: 8 + Math.floor(Math.random() * 5),
    691      dpiaCompleted: 7 + Math.floor(Math.random() * 4),
    692      internationalTransfers: 5 + Math.floor(Math.random() * 3),
    693      validMechanisms: 5 + Math.floor(Math.random() * 2),
    
  • L692

    ts
    690      dpiaRequired: 8 + Math.floor(Math.random() * 5),
    691      dpiaCompleted: 7 + Math.floor(Math.random() * 4),
    692      internationalTransfers: 5 + Math.floor(Math.random() * 3),
    693      validMechanisms: 5 + Math.floor(Math.random() * 2),
    694    };
    
  • L693

    ts
    691      dpiaCompleted: 7 + Math.floor(Math.random() * 4),
    692      internationalTransfers: 5 + Math.floor(Math.random() * 3),
    693      validMechanisms: 5 + Math.floor(Math.random() * 2),
    694    };
    695
    
  • L698

    ts
    696    // Retention compliance
    697    const retentionCompliance = {
    698      categoriesTracked: 25 + Math.floor(Math.random() * 10),
    699      compliantCategories: 23 + Math.floor(Math.random() * 8),
    700      dataDeleted: 50000 + Math.floor(Math.random() * 30000),
    
  • L699

    ts
    697    const retentionCompliance = {
    698      categoriesTracked: 25 + Math.floor(Math.random() * 10),
    699      compliantCategories: 23 + Math.floor(Math.random() * 8),
    700      dataDeleted: 50000 + Math.floor(Math.random() * 30000),
    701      dataArchived: 100000 + Math.floor(Math.random() * 50000),
    
  • L700

    ts
    698      categoriesTracked: 25 + Math.floor(Math.random() * 10),
    699      compliantCategories: 23 + Math.floor(Math.random() * 8),
    700      dataDeleted: 50000 + Math.floor(Math.random() * 30000),
    701      dataArchived: 100000 + Math.floor(Math.random() * 50000),
    702      overRetained: Math.floor(Math.random() * 5000),
    
  • L701

    ts
    699      compliantCategories: 23 + Math.floor(Math.random() * 8),
    700      dataDeleted: 50000 + Math.floor(Math.random() * 30000),
    701      dataArchived: 100000 + Math.floor(Math.random() * 50000),
    702      overRetained: Math.floor(Math.random() * 5000),
    703    };
    
  • L702

    ts
    700      dataDeleted: 50000 + Math.floor(Math.random() * 30000),
    701      dataArchived: 100000 + Math.floor(Math.random() * 50000),
    702      overRetained: Math.floor(Math.random() * 5000),
    703    };
    704
    
  • L756

    ts
    754    const { logger, requestId } = ctx;
    755
    756    const exportId = `export_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    757
    758    const response: RegulatoryExportResponse = {
    
  • L791

    ts
    789
    790    // Simulate export completion
    791    const isCompleted = Math.random() > 0.3;
    792
    793    const response: RegulatoryExportResponse = {
    
  • L802

    ts
    800      expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(),
    801      downloadUrl: isCompleted ? `/api/v1/compliance/export/${exportId}/download` : undefined,
    802      fileSize: isCompleted ? 1024 * 1024 * (5 + Math.random() * 10) : undefined,
    803      recordCount: isCompleted ? 10000 + Math.floor(Math.random() * 5000) : undefined,
    804    };
    
  • L803

    ts
    801      downloadUrl: isCompleted ? `/api/v1/compliance/export/${exportId}/download` : undefined,
    802      fileSize: isCompleted ? 1024 * 1024 * (5 + Math.random() * 10) : undefined,
    803      recordCount: isCompleted ? 10000 + Math.floor(Math.random() * 5000) : undefined,
    804    };
    805
    
  • L825

    ts
    823    // Generate sample export list
    824    const exports: RegulatoryExportResponse[] = Array.from({ length: 5 }, (_, i) => ({
    825      exportId: `export_${Date.now() - i * 86400000}_${Math.random().toString(36).slice(2, 8)}`,
    826      status: i === 0 ? 'processing' : 'completed',
    827      type: ['age_verification', 'moderation', '2257', 'gdpr', 'full_audit'][i] ?? 'full_audit',
    
  • L832

    ts
    830      completedAt: i > 0 ? new Date(Date.now() - i * 86400000 + 300000).toISOString() : undefined,
    831      expiresAt: new Date(Date.now() + (7 - i) * 86400000).toISOString(),
    832      fileSize: i > 0 ? 1024 * 1024 * (5 + Math.random() * 10) : undefined,
    833      recordCount: i > 0 ? 10000 + Math.floor(Math.random() * 5000) : undefined,
    834    }));
    
  • L833

    ts
    831      expiresAt: new Date(Date.now() + (7 - i) * 86400000).toISOString(),
    832      fileSize: i > 0 ? 1024 * 1024 * (5 + Math.random() * 10) : undefined,
    833      recordCount: i > 0 ? 10000 + Math.floor(Math.random() * 5000) : undefined,
    834    }));
    835
    

apps/aphrodite/admin-bi-dashboard/src/routes/content.ts#

  • L56

    ts
    54
    55    // Generate content metrics
    56    const totalStreams = 15000 + Math.floor(Math.random() * 5000);
    57    const avgStreamDuration = 2.5 + Math.random() * 2; // hours
    58    const totalHours = totalStreams * avgStreamDuration;
    
  • L57

    ts
    55    // Generate content metrics
    56    const totalStreams = 15000 + Math.floor(Math.random() * 5000);
    57    const avgStreamDuration = 2.5 + Math.random() * 2; // hours
    58    const totalHours = totalStreams * avgStreamDuration;
    59    const avgViewers = 50 + Math.floor(Math.random() * 100);
    
  • L59

    ts
    57    const avgStreamDuration = 2.5 + Math.random() * 2; // hours
    58    const totalHours = totalStreams * avgStreamDuration;
    59    const avgViewers = 50 + Math.floor(Math.random() * 100);
    60    const totalViews = totalStreams * avgViewers * 1.5;
    61    const peakViewers = avgViewers * totalStreams * 0.01;
    
  • L66

    ts
    64
    65    // Previous period for comparison
    66    const prevStreams = totalStreams * (0.88 + Math.random() * 0.1);
    67    const prevHours = totalHours * (0.85 + Math.random() * 0.12);
    68    const prevAvgViewers = avgViewers * (0.9 + Math.random() * 0.15);
    
  • L67

    ts
    65    // Previous period for comparison
    66    const prevStreams = totalStreams * (0.88 + Math.random() * 0.1);
    67    const prevHours = totalHours * (0.85 + Math.random() * 0.12);
    68    const prevAvgViewers = avgViewers * (0.9 + Math.random() * 0.15);
    69
    
  • L68

    ts
    66    const prevStreams = totalStreams * (0.88 + Math.random() * 0.1);
    67    const prevHours = totalHours * (0.85 + Math.random() * 0.12);
    68    const prevAvgViewers = avgViewers * (0.9 + Math.random() * 0.15);
    69
    70    const response: ContentOverview = {
    
  • L92

    ts
    90      },
    91      quality: {
    92        avgBitrate: 5000 + Math.floor(Math.random() * 2000),
    93        avgResolution: '1080p',
    94        bufferingRate: 0.01 + Math.random() * 0.02,
    
  • L94

    ts
    92        avgBitrate: 5000 + Math.floor(Math.random() * 2000),
    93        avgResolution: '1080p',
    94        bufferingRate: 0.01 + Math.random() * 0.02,
    95        avgStartupTime: 1.5 + Math.random() * 1.5,
    96      },
    
  • L95

    ts
    93        avgResolution: '1080p',
    94        bufferingRate: 0.01 + Math.random() * 0.02,
    95        avgStartupTime: 1.5 + Math.random() * 1.5,
    96      },
    97    };
    
  • L154

    ts
    152    ];
    153
    154    const totalStreams = 15000 + Math.floor(Math.random() * 5000);
    155    const totalViewers = 500000 + Math.floor(Math.random() * 200000);
    156    const totalHours = 50000 + Math.floor(Math.random() * 20000);
    
  • L155

    ts
    153
    154    const totalStreams = 15000 + Math.floor(Math.random() * 5000);
    155    const totalViewers = 500000 + Math.floor(Math.random() * 200000);
    156    const totalHours = 50000 + Math.floor(Math.random() * 20000);
    157    const totalRevenue = 500000 + Math.random() * 300000;
    
  • L156

    ts
    154    const totalStreams = 15000 + Math.floor(Math.random() * 5000);
    155    const totalViewers = 500000 + Math.floor(Math.random() * 200000);
    156    const totalHours = 50000 + Math.floor(Math.random() * 20000);
    157    const totalRevenue = 500000 + Math.random() * 300000;
    158
    
  • L157

    ts
    155    const totalViewers = 500000 + Math.floor(Math.random() * 200000);
    156    const totalHours = 50000 + Math.floor(Math.random() * 20000);
    157    const totalRevenue = 500000 + Math.random() * 300000;
    158
    159    const categories = categoryData.map((cat) => {
    
  • L160

    ts
    158
    159    const categories = categoryData.map((cat) => {
    160      const streams = Math.floor(totalStreams * cat.share * (0.85 + Math.random() * 0.3));
    161      const viewers = Math.floor(totalViewers * cat.share * (0.8 + Math.random() * 0.4));
    162      const viewingHours = totalHours * cat.share * (0.85 + Math.random() * 0.3);
    
  • L161

    ts
    159    const categories = categoryData.map((cat) => {
    160      const streams = Math.floor(totalStreams * cat.share * (0.85 + Math.random() * 0.3));
    161      const viewers = Math.floor(totalViewers * cat.share * (0.8 + Math.random() * 0.4));
    162      const viewingHours = totalHours * cat.share * (0.85 + Math.random() * 0.3);
    163      const revenue = totalRevenue * cat.share * (0.8 + Math.random() * 0.4);
    
  • L162

    ts
    160      const streams = Math.floor(totalStreams * cat.share * (0.85 + Math.random() * 0.3));
    161      const viewers = Math.floor(totalViewers * cat.share * (0.8 + Math.random() * 0.4));
    162      const viewingHours = totalHours * cat.share * (0.85 + Math.random() * 0.3);
    163      const revenue = totalRevenue * cat.share * (0.8 + Math.random() * 0.4);
    164      const avgViewers = Math.floor(viewers / streams);
    
  • L163

    ts
    161      const viewers = Math.floor(totalViewers * cat.share * (0.8 + Math.random() * 0.4));
    162      const viewingHours = totalHours * cat.share * (0.85 + Math.random() * 0.3);
    163      const revenue = totalRevenue * cat.share * (0.8 + Math.random() * 0.4);
    164      const avgViewers = Math.floor(viewers / streams);
    165      const peakViewers = avgViewers * (3 + Math.random() * 5);
    
  • L165

    ts
    163      const revenue = totalRevenue * cat.share * (0.8 + Math.random() * 0.4);
    164      const avgViewers = Math.floor(viewers / streams);
    165      const peakViewers = avgViewers * (3 + Math.random() * 5);
    166
    167      const prevViewers = viewers * (0.85 + Math.random() * 0.15);
    
  • L167

    ts
    165      const peakViewers = avgViewers * (3 + Math.random() * 5);
    166
    167      const prevViewers = viewers * (0.85 + Math.random() * 0.15);
    168
    169      return {
    
  • L191

    ts
    189    ].map((e) => ({
    190      category: e.category,
    191      growthRate: e.growthRate * (0.8 + Math.random() * 0.4),
    192      newCreators: 50 + Math.floor(Math.random() * 100),
    193      momentum: 0.6 + Math.random() * 0.4,
    
  • L192

    ts
    190      category: e.category,
    191      growthRate: e.growthRate * (0.8 + Math.random() * 0.4),
    192      newCreators: 50 + Math.floor(Math.random() * 100),
    193      momentum: 0.6 + Math.random() * 0.4,
    194    }));
    
  • L193

    ts
    191      growthRate: e.growthRate * (0.8 + Math.random() * 0.4),
    192      newCreators: 50 + Math.floor(Math.random() * 100),
    193      momentum: 0.6 + Math.random() * 0.4,
    194    }));
    195
    
  • L203

    ts
    201    ].map((d) => ({
    202      category: d.category,
    203      declineRate: d.declineRate * (0.8 + Math.random() * 0.4),
    204      reason: d.category === 'Casino' ? 'Regulatory changes' : 'Shifting viewer interests',
    205    }));
    
  • L277

    ts
    275      // Top streams
    276      const topStreams = Array.from({ length: query.limit }, (_, i) => {
    277        const peakViewers = Math.floor((50000 / (i + 1)) * (0.8 + Math.random() * 0.4));
    278        const avgViewers = Math.floor(peakViewers * (0.4 + Math.random() * 0.3));
    279        const duration = 2 + Math.random() * 6; // hours
    
  • L278

    ts
    276      const topStreams = Array.from({ length: query.limit }, (_, i) => {
    277        const peakViewers = Math.floor((50000 / (i + 1)) * (0.8 + Math.random() * 0.4));
    278        const avgViewers = Math.floor(peakViewers * (0.4 + Math.random() * 0.3));
    279        const duration = 2 + Math.random() * 6; // hours
    280        const revenue = avgViewers * duration * (0.5 + Math.random() * 1.5);
    
  • L279

    ts
    277        const peakViewers = Math.floor((50000 / (i + 1)) * (0.8 + Math.random() * 0.4));
    278        const avgViewers = Math.floor(peakViewers * (0.4 + Math.random() * 0.3));
    279        const duration = 2 + Math.random() * 6; // hours
    280        const revenue = avgViewers * duration * (0.5 + Math.random() * 1.5);
    281
    
  • L280

    ts
    278        const avgViewers = Math.floor(peakViewers * (0.4 + Math.random() * 0.3));
    279        const duration = 2 + Math.random() * 6; // hours
    280        const revenue = avgViewers * duration * (0.5 + Math.random() * 1.5);
    281
    282        return {
    
  • L286

    ts
    284          creatorId: `creator_${100000 + i}`,
    285          creatorUsername: `top_streamer_${i + 1}`,
    286          title: `Epic Stream Session #${Math.floor(Math.random() * 1000)}`,
    287          category: contentCategories[i % contentCategories.length] ?? 'Gaming',
    288          peakViewers,
    
  • L292

    ts
    290          duration: duration * 60, // minutes
    291          revenue,
    292          engagement: 0.3 + Math.random() * 0.5,
    293        };
    294      });
    
  • L298

    ts
    296      // Top VODs
    297      const topVODs = Array.from({ length: query.limit }, (_, i) => {
    298        const views = Math.floor((100000 / (i + 1)) * (0.8 + Math.random() * 0.4));
    299        const watchTime = views * (0.3 + Math.random() * 0.4); // hours
    300        const retention = 0.3 + Math.random() * 0.4;
    
  • L299

    ts
    297      const topVODs = Array.from({ length: query.limit }, (_, i) => {
    298        const views = Math.floor((100000 / (i + 1)) * (0.8 + Math.random() * 0.4));
    299        const watchTime = views * (0.3 + Math.random() * 0.4); // hours
    300        const retention = 0.3 + Math.random() * 0.4;
    301        const revenue = views * (0.02 + Math.random() * 0.05);
    
  • L300

    ts
    298        const views = Math.floor((100000 / (i + 1)) * (0.8 + Math.random() * 0.4));
    299        const watchTime = views * (0.3 + Math.random() * 0.4); // hours
    300        const retention = 0.3 + Math.random() * 0.4;
    301        const revenue = views * (0.02 + Math.random() * 0.05);
    302
    
  • L301

    ts
    299        const watchTime = views * (0.3 + Math.random() * 0.4); // hours
    300        const retention = 0.3 + Math.random() * 0.4;
    301        const revenue = views * (0.02 + Math.random() * 0.05);
    302
    303        return {
    
  • L307

    ts
    305          creatorId: `creator_${100000 + (i % 50)}`,
    306          creatorUsername: `creator_${i + 1}`,
    307          title: `Best Moments - Episode ${Math.floor(Math.random() * 500)}`,
    308          views,
    309          watchTime,
    
  • L317

    ts
    315      // Top clips
    316      const topClips = Array.from({ length: query.limit }, (_, i) => {
    317        const views = Math.floor((500000 / (i + 1)) * (0.7 + Math.random() * 0.6));
    318        const shares = Math.floor(views * (0.05 + Math.random() * 0.1));
    319
    
  • L318

    ts
    316      const topClips = Array.from({ length: query.limit }, (_, i) => {
    317        const views = Math.floor((500000 / (i + 1)) * (0.7 + Math.random() * 0.6));
    318        const shares = Math.floor(views * (0.05 + Math.random() * 0.1));
    319
    320        return {
    
  • L324

    ts
    322          creatorId: `creator_${100000 + (i % 100)}`,
    323          creatorUsername: `clipper_${i + 1}`,
    324          title: `Unbelievable Moment #${Math.floor(Math.random() * 10000)}`,
    325          views,
    326          shares,
    
  • L399

    ts
    397      }
    398
    399      const viewers = Math.floor(baseViewers * (0.85 + Math.random() * 0.3));
    400      const streams = Math.floor(viewers / (40 + Math.random() * 40));
    401
    
  • L400

    ts
    398
    399      const viewers = Math.floor(baseViewers * (0.85 + Math.random() * 0.3));
    400      const streams = Math.floor(viewers / (40 + Math.random() * 40));
    401
    402      // Find peak day for this hour
    
  • L403

    ts
    401
    402      // Find peak day for this hour
    403      const peakDayIndex = Math.floor(Math.random() * 7);
    404      const peakDay = daysOfWeek[peakDayIndex] ?? 'Saturday';
    405
    
  • L419

    ts
    417      const isWeekend = index === 0 || index === 6;
    418      const baseMultiplier = isWeekend ? 1.3 : 1.0;
    419      const viewers = Math.floor(800000 * baseMultiplier * (0.9 + Math.random() * 0.2));
    420      const streams = Math.floor(viewers / 50);
    421      const avgDuration = (isWeekend ? 3.5 : 2.5) * (0.85 + Math.random() * 0.3);
    
  • L421

    ts
    419      const viewers = Math.floor(800000 * baseMultiplier * (0.9 + Math.random() * 0.2));
    420      const streams = Math.floor(viewers / 50);
    421      const avgDuration = (isWeekend ? 3.5 : 2.5) * (0.85 + Math.random() * 0.3);
    422
    423      return {
    
  • L444

    ts
    442      dayOfWeek: peak.dayOfWeek,
    443      hour: peak.hour,
    444      avgViewers: Math.floor(peak.avgViewers * (0.9 + Math.random() * 0.2)),
    445      confidence: 0.85 + Math.random() * 0.15,
    446    }));
    
  • L445

    ts
    443      hour: peak.hour,
    444      avgViewers: Math.floor(peak.avgViewers * (0.9 + Math.random() * 0.2)),
    445      confidence: 0.85 + Math.random() * 0.15,
    446    }));
    447
    
  • L526

    ts
    524
    525    // Moderation summary
    526    const totalReports = 5000 + Math.floor(Math.random() * 2000);
    527    const resolvedReports = Math.floor(totalReports * (0.85 + Math.random() * 0.1));
    528    const avgResolutionTime = 2 + Math.random() * 4; // hours
    
  • L527

    ts
    525    // Moderation summary
    526    const totalReports = 5000 + Math.floor(Math.random() * 2000);
    527    const resolvedReports = Math.floor(totalReports * (0.85 + Math.random() * 0.1));
    528    const avgResolutionTime = 2 + Math.random() * 4; // hours
    529    const contentRemoved = Math.floor(resolvedReports * (0.3 + Math.random() * 0.15));
    
  • L528

    ts
    526    const totalReports = 5000 + Math.floor(Math.random() * 2000);
    527    const resolvedReports = Math.floor(totalReports * (0.85 + Math.random() * 0.1));
    528    const avgResolutionTime = 2 + Math.random() * 4; // hours
    529    const contentRemoved = Math.floor(resolvedReports * (0.3 + Math.random() * 0.15));
    530    const warningsIssued = Math.floor(resolvedReports * (0.4 + Math.random() * 0.1));
    
  • L529

    ts
    527    const resolvedReports = Math.floor(totalReports * (0.85 + Math.random() * 0.1));
    528    const avgResolutionTime = 2 + Math.random() * 4; // hours
    529    const contentRemoved = Math.floor(resolvedReports * (0.3 + Math.random() * 0.15));
    530    const warningsIssued = Math.floor(resolvedReports * (0.4 + Math.random() * 0.1));
    531    const suspensions = Math.floor(resolvedReports * (0.08 + Math.random() * 0.04));
    
  • L530

    ts
    528    const avgResolutionTime = 2 + Math.random() * 4; // hours
    529    const contentRemoved = Math.floor(resolvedReports * (0.3 + Math.random() * 0.15));
    530    const warningsIssued = Math.floor(resolvedReports * (0.4 + Math.random() * 0.1));
    531    const suspensions = Math.floor(resolvedReports * (0.08 + Math.random() * 0.04));
    532    const bans = Math.floor(resolvedReports * (0.02 + Math.random() * 0.02));
    
  • L531

    ts
    529    const contentRemoved = Math.floor(resolvedReports * (0.3 + Math.random() * 0.15));
    530    const warningsIssued = Math.floor(resolvedReports * (0.4 + Math.random() * 0.1));
    531    const suspensions = Math.floor(resolvedReports * (0.08 + Math.random() * 0.04));
    532    const bans = Math.floor(resolvedReports * (0.02 + Math.random() * 0.02));
    533
    
  • L532

    ts
    530    const warningsIssued = Math.floor(resolvedReports * (0.4 + Math.random() * 0.1));
    531    const suspensions = Math.floor(resolvedReports * (0.08 + Math.random() * 0.04));
    532    const bans = Math.floor(resolvedReports * (0.02 + Math.random() * 0.02));
    533
    534    // Reports by category
    
  • L548

    ts
    546
    547    const byCategory = reportCategories.map((cat) => {
    548      const reports = Math.floor(totalReports * cat.share * (0.85 + Math.random() * 0.3));
    549      const actionsTaken = Math.floor(reports * (0.6 + Math.random() * 0.3));
    550      return {
    
  • L549

    ts
    547    const byCategory = reportCategories.map((cat) => {
    548      const reports = Math.floor(totalReports * cat.share * (0.85 + Math.random() * 0.3));
    549      const actionsTaken = Math.floor(reports * (0.6 + Math.random() * 0.3));
    550      return {
    551        category: cat.category,
    
  • L572

    ts
    570    ].map((a) => ({
    571      action: a.action,
    572      count: Math.floor(a.count * (0.9 + Math.random() * 0.2)),
    573      avgResponseTime: a.avgResponseTime * (0.8 + Math.random() * 0.4),
    574    }));
    
  • L573

    ts
    571      action: a.action,
    572      count: Math.floor(a.count * (0.9 + Math.random() * 0.2)),
    573      avgResponseTime: a.avgResponseTime * (0.8 + Math.random() * 0.4),
    574    }));
    575
    
  • L642

    ts
    640    // Overall quality metrics
    641    const overallMetrics = {
    642      avgBitrate: 5500 + Math.floor(Math.random() * 1500), // kbps
    643      avgResolution: '1080p',
    644      bufferingRate: 0.012 + Math.random() * 0.008,
    
  • L644

    ts
    642      avgBitrate: 5500 + Math.floor(Math.random() * 1500), // kbps
    643      avgResolution: '1080p',
    644      bufferingRate: 0.012 + Math.random() * 0.008,
    645      avgStartupTime: 1.8 + Math.random() * 0.8, // seconds
    646      avgLatency: 2.5 + Math.random() * 1.5, // seconds
    
  • L645

    ts
    643      avgResolution: '1080p',
    644      bufferingRate: 0.012 + Math.random() * 0.008,
    645      avgStartupTime: 1.8 + Math.random() * 0.8, // seconds
    646      avgLatency: 2.5 + Math.random() * 1.5, // seconds
    647      streamHealth: 0.95 + Math.random() * 0.04,
    
  • L646

    ts
    644      bufferingRate: 0.012 + Math.random() * 0.008,
    645      avgStartupTime: 1.8 + Math.random() * 0.8, // seconds
    646      avgLatency: 2.5 + Math.random() * 1.5, // seconds
    647      streamHealth: 0.95 + Math.random() * 0.04,
    648      transcodeSuccess: 0.995 + Math.random() * 0.004,
    
  • L647

    ts
    645      avgStartupTime: 1.8 + Math.random() * 0.8, // seconds
    646      avgLatency: 2.5 + Math.random() * 1.5, // seconds
    647      streamHealth: 0.95 + Math.random() * 0.04,
    648      transcodeSuccess: 0.995 + Math.random() * 0.004,
    649      cdnEfficiency: 0.92 + Math.random() * 0.06,
    
  • L648

    ts
    646      avgLatency: 2.5 + Math.random() * 1.5, // seconds
    647      streamHealth: 0.95 + Math.random() * 0.04,
    648      transcodeSuccess: 0.995 + Math.random() * 0.004,
    649      cdnEfficiency: 0.92 + Math.random() * 0.06,
    650    };
    
  • L649

    ts
    647      streamHealth: 0.95 + Math.random() * 0.04,
    648      transcodeSuccess: 0.995 + Math.random() * 0.004,
    649      cdnEfficiency: 0.92 + Math.random() * 0.06,
    650    };
    651
    
  • L662

    ts
    660    ].map((res) => ({
    661      resolution: res.resolution,
    662      streams: Math.floor(15000 * res.share * (0.9 + Math.random() * 0.2)),
    663      percentage: res.share * 100,
    664      avgBitrate: res.avgBitrate * (0.9 + Math.random() * 0.2),
    
  • L664

    ts
    662      streams: Math.floor(15000 * res.share * (0.9 + Math.random() * 0.2)),
    663      percentage: res.share * 100,
    664      avgBitrate: res.avgBitrate * (0.9 + Math.random() * 0.2),
    665      bufferingRate: 0.01 + (1 - res.share) * 0.02 + Math.random() * 0.01,
    666    }));
    
  • L665

    ts
    663      percentage: res.share * 100,
    664      avgBitrate: res.avgBitrate * (0.9 + Math.random() * 0.2),
    665      bufferingRate: 0.01 + (1 - res.share) * 0.02 + Math.random() * 0.01,
    666    }));
    667
    
  • L678

    ts
    676    ].map((reg) => ({
    677      region: reg.region,
    678      avgBitrate: reg.avgBitrate * (0.9 + Math.random() * 0.2),
    679      avgLatency: reg.latency * (0.9 + Math.random() * 0.2),
    680      bufferingRate: 0.01 + reg.latency * 0.002 + Math.random() * 0.005,
    
  • L679

    ts
    677      region: reg.region,
    678      avgBitrate: reg.avgBitrate * (0.9 + Math.random() * 0.2),
    679      avgLatency: reg.latency * (0.9 + Math.random() * 0.2),
    680      bufferingRate: 0.01 + reg.latency * 0.002 + Math.random() * 0.005,
    681      cdnNodes: 5 + Math.floor(Math.random() * 10),
    
  • L680

    ts
    678      avgBitrate: reg.avgBitrate * (0.9 + Math.random() * 0.2),
    679      avgLatency: reg.latency * (0.9 + Math.random() * 0.2),
    680      bufferingRate: 0.01 + reg.latency * 0.002 + Math.random() * 0.005,
    681      cdnNodes: 5 + Math.floor(Math.random() * 10),
    682    }));
    
  • L681

    ts
    679      avgLatency: reg.latency * (0.9 + Math.random() * 0.2),
    680      bufferingRate: 0.01 + reg.latency * 0.002 + Math.random() * 0.005,
    681      cdnNodes: 5 + Math.floor(Math.random() * 10),
    682    }));
    683
    
  • L704

    ts
    702    ].map((e) => ({
    703      type: e.type,
    704      count: Math.floor(e.count * (0.8 + Math.random() * 0.4)),
    705      percentage: e.percentage * 100,
    706      trend: -5 + Math.random() * 15, // percent change
    
  • L706

    ts
    704      count: Math.floor(e.count * (0.8 + Math.random() * 0.4)),
    705      percentage: e.percentage * 100,
    706      trend: -5 + Math.random() * 15, // percent change
    707    }));
    708
    
  • L759

    ts
    757
    758    // Discovery sources
    759    const totalDiscoveries = 2000000 + Math.floor(Math.random() * 500000);
    760
    761    const bySources = [
    
  • L773

    ts
    771    ].map((s) => ({
    772      source: s.source,
    773      discoveries: Math.floor(totalDiscoveries * s.share * (0.9 + Math.random() * 0.2)),
    774      percentage: s.share * 100,
    775      conversionRate: 0.1 + Math.random() * 0.2,
    
  • L775

    ts
    773      discoveries: Math.floor(totalDiscoveries * s.share * (0.9 + Math.random() * 0.2)),
    774      percentage: s.share * 100,
    775      conversionRate: 0.1 + Math.random() * 0.2,
    776      avgWatchTime: 5 + Math.random() * 20, // minutes
    777    }));
    
  • L776

    ts
    774      percentage: s.share * 100,
    775      conversionRate: 0.1 + Math.random() * 0.2,
    776      avgWatchTime: 5 + Math.random() * 20, // minutes
    777    }));
    778
    
  • L781

    ts
    779    // Recommendation performance
    780    const recommendationMetrics = {
    781      impressions: 10000000 + Math.floor(Math.random() * 2000000),
    782      clicks: 800000 + Math.floor(Math.random() * 200000),
    783      ctr: 0.06 + Math.random() * 0.04,
    
  • L782

    ts
    780    const recommendationMetrics = {
    781      impressions: 10000000 + Math.floor(Math.random() * 2000000),
    782      clicks: 800000 + Math.floor(Math.random() * 200000),
    783      ctr: 0.06 + Math.random() * 0.04,
    784      watches: 600000 + Math.floor(Math.random() * 150000),
    
  • L783

    ts
    781      impressions: 10000000 + Math.floor(Math.random() * 2000000),
    782      clicks: 800000 + Math.floor(Math.random() * 200000),
    783      ctr: 0.06 + Math.random() * 0.04,
    784      watches: 600000 + Math.floor(Math.random() * 150000),
    785      watchRate: 0.7 + Math.random() * 0.15,
    
  • L784

    ts
    782      clicks: 800000 + Math.floor(Math.random() * 200000),
    783      ctr: 0.06 + Math.random() * 0.04,
    784      watches: 600000 + Math.floor(Math.random() * 150000),
    785      watchRate: 0.7 + Math.random() * 0.15,
    786      follows: 50000 + Math.floor(Math.random() * 20000),
    
  • L785

    ts
    783      ctr: 0.06 + Math.random() * 0.04,
    784      watches: 600000 + Math.floor(Math.random() * 150000),
    785      watchRate: 0.7 + Math.random() * 0.15,
    786      follows: 50000 + Math.floor(Math.random() * 20000),
    787      followRate: 0.06 + Math.random() * 0.04,
    
  • L786

    ts
    784      watches: 600000 + Math.floor(Math.random() * 150000),
    785      watchRate: 0.7 + Math.random() * 0.15,
    786      follows: 50000 + Math.floor(Math.random() * 20000),
    787      followRate: 0.06 + Math.random() * 0.04,
    788      avgRelevanceScore: 0.72 + Math.random() * 0.15,
    
  • L787

    ts
    785      watchRate: 0.7 + Math.random() * 0.15,
    786      follows: 50000 + Math.floor(Math.random() * 20000),
    787      followRate: 0.06 + Math.random() * 0.04,
    788      avgRelevanceScore: 0.72 + Math.random() * 0.15,
    789    };
    
  • L788

    ts
    786      follows: 50000 + Math.floor(Math.random() * 20000),
    787      followRate: 0.06 + Math.random() * 0.04,
    788      avgRelevanceScore: 0.72 + Math.random() * 0.15,
    789    };
    790
    
  • L793

    ts
    791    // Search analytics
    792    const searchMetrics = {
    793      totalSearches: 500000 + Math.floor(Math.random() * 100000),
    794      uniqueSearchers: 150000 + Math.floor(Math.random() * 50000),
    795      avgResultsClicked: 1.5 + Math.random() * 1,
    
  • L794

    ts
    792    const searchMetrics = {
    793      totalSearches: 500000 + Math.floor(Math.random() * 100000),
    794      uniqueSearchers: 150000 + Math.floor(Math.random() * 50000),
    795      avgResultsClicked: 1.5 + Math.random() * 1,
    796      noResultsRate: 0.05 + Math.random() * 0.03,
    
  • L795

    ts
    793      totalSearches: 500000 + Math.floor(Math.random() * 100000),
    794      uniqueSearchers: 150000 + Math.floor(Math.random() * 50000),
    795      avgResultsClicked: 1.5 + Math.random() * 1,
    796      noResultsRate: 0.05 + Math.random() * 0.03,
    797      avgSearchToWatch: 45 + Math.random() * 30, // seconds
    
  • L796

    ts
    794      uniqueSearchers: 150000 + Math.floor(Math.random() * 50000),
    795      avgResultsClicked: 1.5 + Math.random() * 1,
    796      noResultsRate: 0.05 + Math.random() * 0.03,
    797      avgSearchToWatch: 45 + Math.random() * 30, // seconds
    798    };
    
  • L797

    ts
    795      avgResultsClicked: 1.5 + Math.random() * 1,
    796      noResultsRate: 0.05 + Math.random() * 0.03,
    797      avgSearchToWatch: 45 + Math.random() * 30, // seconds
    798    };
    799
    
  • L813

    ts
    811    ].map((term, i) => ({
    812      term,
    813      searches: Math.floor((10000 / (i + 1)) * (0.8 + Math.random() * 0.4)),
    814      clickRate: 0.3 + Math.random() * 0.4,
    815      trend: -10 + Math.random() * 30,
    
  • L814

    ts
    812      term,
    813      searches: Math.floor((10000 / (i + 1)) * (0.8 + Math.random() * 0.4)),
    814      clickRate: 0.3 + Math.random() * 0.4,
    815      trend: -10 + Math.random() * 30,
    816    }));
    
  • L815

    ts
    813      searches: Math.floor((10000 / (i + 1)) * (0.8 + Math.random() * 0.4)),
    814      clickRate: 0.3 + Math.random() * 0.4,
    815      trend: -10 + Math.random() * 30,
    816    }));
    817
    

apps/aphrodite/admin-bi-dashboard/src/routes/platform.ts#

  • L54

    ts
    52
    53    // Generate platform metrics
    54    const totalUsers = 150000 + Math.floor(Math.random() * 50000);
    55    const activeUsers = Math.floor(totalUsers * (0.3 + Math.random() * 0.2));
    56    const totalCreators = Math.floor(totalUsers * 0.05);
    
  • L55

    ts
    53    // Generate platform metrics
    54    const totalUsers = 150000 + Math.floor(Math.random() * 50000);
    55    const activeUsers = Math.floor(totalUsers * (0.3 + Math.random() * 0.2));
    56    const totalCreators = Math.floor(totalUsers * 0.05);
    57    const activeCreators = Math.floor(totalCreators * (0.4 + Math.random() * 0.3));
    
  • L57

    ts
    55    const activeUsers = Math.floor(totalUsers * (0.3 + Math.random() * 0.2));
    56    const totalCreators = Math.floor(totalUsers * 0.05);
    57    const activeCreators = Math.floor(totalCreators * (0.4 + Math.random() * 0.3));
    58    const totalStreams = activeCreators * (5 + Math.floor(Math.random() * 10));
    59    const liveStreams = Math.floor(activeCreators * (0.1 + Math.random() * 0.1));
    
  • L58

    ts
    56    const totalCreators = Math.floor(totalUsers * 0.05);
    57    const activeCreators = Math.floor(totalCreators * (0.4 + Math.random() * 0.3));
    58    const totalStreams = activeCreators * (5 + Math.floor(Math.random() * 10));
    59    const liveStreams = Math.floor(activeCreators * (0.1 + Math.random() * 0.1));
    60    const avgViewersPerStream = 50 + Math.floor(Math.random() * 150);
    
  • L59

    ts
    57    const activeCreators = Math.floor(totalCreators * (0.4 + Math.random() * 0.3));
    58    const totalStreams = activeCreators * (5 + Math.floor(Math.random() * 10));
    59    const liveStreams = Math.floor(activeCreators * (0.1 + Math.random() * 0.1));
    60    const avgViewersPerStream = 50 + Math.floor(Math.random() * 150);
    61    const totalViewingHours = totalStreams * avgViewersPerStream * 2;
    
  • L60

    ts
    58    const totalStreams = activeCreators * (5 + Math.floor(Math.random() * 10));
    59    const liveStreams = Math.floor(activeCreators * (0.1 + Math.random() * 0.1));
    60    const avgViewersPerStream = 50 + Math.floor(Math.random() * 150);
    61    const totalViewingHours = totalStreams * avgViewersPerStream * 2;
    62    const peakViewers = liveStreams * avgViewersPerStream * 3;
    
  • L63

    ts
    61    const totalViewingHours = totalStreams * avgViewersPerStream * 2;
    62    const peakViewers = liveStreams * avgViewersPerStream * 3;
    63    const totalRevenue = totalStreams * avgViewersPerStream * (0.5 + Math.random() * 1.5);
    64    const platformRevenue = totalRevenue * 0.2;
    65    const creatorPayouts = totalRevenue - platformRevenue;
    
  • L68

    ts
    66
    67    // Previous period for comparison
    68    const prevUsers = totalUsers * (0.85 + Math.random() * 0.1);
    69    const prevCreators = totalCreators * (0.9 + Math.random() * 0.1);
    70    const prevStreams = totalStreams * (0.85 + Math.random() * 0.15);
    
  • L69

    ts
    67    // Previous period for comparison
    68    const prevUsers = totalUsers * (0.85 + Math.random() * 0.1);
    69    const prevCreators = totalCreators * (0.9 + Math.random() * 0.1);
    70    const prevStreams = totalStreams * (0.85 + Math.random() * 0.15);
    71    const prevViewingHours = totalViewingHours * (0.8 + Math.random() * 0.2);
    
  • L70

    ts
    68    const prevUsers = totalUsers * (0.85 + Math.random() * 0.1);
    69    const prevCreators = totalCreators * (0.9 + Math.random() * 0.1);
    70    const prevStreams = totalStreams * (0.85 + Math.random() * 0.15);
    71    const prevViewingHours = totalViewingHours * (0.8 + Math.random() * 0.2);
    72    const prevRevenue = totalRevenue * (0.85 + Math.random() * 0.15);
    
  • L71

    ts
    69    const prevCreators = totalCreators * (0.9 + Math.random() * 0.1);
    70    const prevStreams = totalStreams * (0.85 + Math.random() * 0.15);
    71    const prevViewingHours = totalViewingHours * (0.8 + Math.random() * 0.2);
    72    const prevRevenue = totalRevenue * (0.85 + Math.random() * 0.15);
    73
    
  • L72

    ts
    70    const prevStreams = totalStreams * (0.85 + Math.random() * 0.15);
    71    const prevViewingHours = totalViewingHours * (0.8 + Math.random() * 0.2);
    72    const prevRevenue = totalRevenue * (0.85 + Math.random() * 0.15);
    73
    74    const response: PlatformOverviewMetrics = {
    
  • L102

    ts
    100      },
    101      health: {
    102        serverUptime: 99.95 + Math.random() * 0.04,
    103        avgLatency: 45 + Math.random() * 30,
    104        errorRate: 0.01 + Math.random() * 0.02,
    
  • L103

    ts
    101      health: {
    102        serverUptime: 99.95 + Math.random() * 0.04,
    103        avgLatency: 45 + Math.random() * 30,
    104        errorRate: 0.01 + Math.random() * 0.02,
    105        streamQuality: 0.95 + Math.random() * 0.04,
    
  • L104

    ts
    102        serverUptime: 99.95 + Math.random() * 0.04,
    103        avgLatency: 45 + Math.random() * 30,
    104        errorRate: 0.01 + Math.random() * 0.02,
    105        streamQuality: 0.95 + Math.random() * 0.04,
    106        contentModerationRate: 0.98 + Math.random() * 0.02,
    
  • L105

    ts
    103        avgLatency: 45 + Math.random() * 30,
    104        errorRate: 0.01 + Math.random() * 0.02,
    105        streamQuality: 0.95 + Math.random() * 0.04,
    106        contentModerationRate: 0.98 + Math.random() * 0.02,
    107      },
    
  • L106

    ts
    104        errorRate: 0.01 + Math.random() * 0.02,
    105        streamQuality: 0.95 + Math.random() * 0.04,
    106        contentModerationRate: 0.98 + Math.random() * 0.02,
    107      },
    108    };
    
  • L137

    ts
    135    const { logger, requestId } = ctx;
    136
    137    const liveStreams = 50 + Math.floor(Math.random() * 100);
    138    const avgViewersPerStream = 50 + Math.floor(Math.random() * 150);
    139
    
  • L138

    ts
    136
    137    const liveStreams = 50 + Math.floor(Math.random() * 100);
    138    const avgViewersPerStream = 50 + Math.floor(Math.random() * 150);
    139
    140    const response: RealTimePlatformMetrics = {
    
  • L145

    ts
    143      concurrentViewers: liveStreams * avgViewersPerStream,
    144      activeUsers: liveStreams * avgViewersPerStream * 1.5,
    145      transactionsPerMinute: 10 + Math.floor(Math.random() * 50),
    146      revenuePerMinute: 50 + Math.random() * 200,
    147      chatMessagesPerMinute: liveStreams * (20 + Math.floor(Math.random() * 30)),
    
  • L146

    ts
    144      activeUsers: liveStreams * avgViewersPerStream * 1.5,
    145      transactionsPerMinute: 10 + Math.floor(Math.random() * 50),
    146      revenuePerMinute: 50 + Math.random() * 200,
    147      chatMessagesPerMinute: liveStreams * (20 + Math.floor(Math.random() * 30)),
    148      newRegistrations: Math.floor(Math.random() * 5),
    
  • L147

    ts
    145      transactionsPerMinute: 10 + Math.floor(Math.random() * 50),
    146      revenuePerMinute: 50 + Math.random() * 200,
    147      chatMessagesPerMinute: liveStreams * (20 + Math.floor(Math.random() * 30)),
    148      newRegistrations: Math.floor(Math.random() * 5),
    149      errorCount: Math.floor(Math.random() * 3),
    
  • L148

    ts
    146      revenuePerMinute: 50 + Math.random() * 200,
    147      chatMessagesPerMinute: liveStreams * (20 + Math.floor(Math.random() * 30)),
    148      newRegistrations: Math.floor(Math.random() * 5),
    149      errorCount: Math.floor(Math.random() * 3),
    150      avgStreamBitrate: 4500 + Math.floor(Math.random() * 1500),
    
  • L149

    ts
    147      chatMessagesPerMinute: liveStreams * (20 + Math.floor(Math.random() * 30)),
    148      newRegistrations: Math.floor(Math.random() * 5),
    149      errorCount: Math.floor(Math.random() * 3),
    150      avgStreamBitrate: 4500 + Math.floor(Math.random() * 1500),
    151      avgStreamLatency: 1.5 + Math.random() * 1.5,
    
  • L150

    ts
    148      newRegistrations: Math.floor(Math.random() * 5),
    149      errorCount: Math.floor(Math.random() * 3),
    150      avgStreamBitrate: 4500 + Math.floor(Math.random() * 1500),
    151      avgStreamLatency: 1.5 + Math.random() * 1.5,
    152    };
    
  • L151

    ts
    149      errorCount: Math.floor(Math.random() * 3),
    150      avgStreamBitrate: 4500 + Math.floor(Math.random() * 1500),
    151      avgStreamLatency: 1.5 + Math.random() * 1.5,
    152    };
    153
    
  • L195

    ts
    193      { name: 'Transcoding', base: 0.99 },
    194    ].map((comp) => {
    195      const uptime = comp.base + Math.random() * (1 - comp.base);
    196      const errorRate = (1 - uptime) * 100;
    197      return {
    
  • L200

    ts
    198        name: comp.name,
    199        status: uptime > 0.99 ? 'healthy' : uptime > 0.95 ? 'degraded' : 'critical',
    200        latency: 10 + Math.floor(Math.random() * 50),
    201        errorRate,
    202        lastCheck: new Date().toISOString(),
    
  • L267

    ts
    265    }
    266
    267    const totalUsers = 150000 + Math.floor(Math.random() * 50000);
    268    const totalRevenue = 500000 + Math.random() * 500000;
    269
    
  • L268

    ts
    266
    267    const totalUsers = 150000 + Math.floor(Math.random() * 50000);
    268    const totalRevenue = 500000 + Math.random() * 500000;
    269
    270    const countries = [
    
  • L286

    ts
    284      country: c.country,
    285      countryCode: c.countryCode,
    286      users: Math.floor(totalUsers * c.share * (0.9 + Math.random() * 0.2)),
    287      creators: Math.floor(totalUsers * c.share * 0.05 * (0.9 + Math.random() * 0.2)),
    288      viewers: Math.floor(totalUsers * c.share * 0.5 * (0.9 + Math.random() * 0.2)),
    
  • L287

    ts
    285      countryCode: c.countryCode,
    286      users: Math.floor(totalUsers * c.share * (0.9 + Math.random() * 0.2)),
    287      creators: Math.floor(totalUsers * c.share * 0.05 * (0.9 + Math.random() * 0.2)),
    288      viewers: Math.floor(totalUsers * c.share * 0.5 * (0.9 + Math.random() * 0.2)),
    289      revenue: totalRevenue * c.share * (0.9 + Math.random() * 0.2),
    
  • L288

    ts
    286      users: Math.floor(totalUsers * c.share * (0.9 + Math.random() * 0.2)),
    287      creators: Math.floor(totalUsers * c.share * 0.05 * (0.9 + Math.random() * 0.2)),
    288      viewers: Math.floor(totalUsers * c.share * 0.5 * (0.9 + Math.random() * 0.2)),
    289      revenue: totalRevenue * c.share * (0.9 + Math.random() * 0.2),
    290      percentage: c.share * 100,
    
  • L289

    ts
    287      creators: Math.floor(totalUsers * c.share * 0.05 * (0.9 + Math.random() * 0.2)),
    288      viewers: Math.floor(totalUsers * c.share * 0.5 * (0.9 + Math.random() * 0.2)),
    289      revenue: totalRevenue * c.share * (0.9 + Math.random() * 0.2),
    290      percentage: c.share * 100,
    291    }));
    

apps/aphrodite/admin-bi-dashboard/src/routes/revenue.ts#

  • L56

    ts
    54    const granularity = query.granularity ?? getGranularityForPeriod(query.period);
    55
    56    const grossRevenue = 500000 + Math.random() * 500000;
    57    const platformFees = grossRevenue * 0.2;
    58    const refunds = grossRevenue * 0.02;
    
  • L75

    ts
    73    const bySource = sources.map((s) => {
    74      const current = grossRevenue * s.share;
    75      const previous = grossRevenue * s.prevShare * (0.85 + Math.random() * 0.15);
    76      const txCount = Math.floor(current / (10 + Math.random() * 30));
    77      return {
    
  • L76

    ts
    74      const current = grossRevenue * s.share;
    75      const previous = grossRevenue * s.prevShare * (0.85 + Math.random() * 0.15);
    76      const txCount = Math.floor(current / (10 + Math.random() * 30));
    77      return {
    78        source: s.source,
    
  • L99

    ts
    97      method: pm.method,
    98      revenue: grossRevenue * pm.share,
    99      transactions: Math.floor((grossRevenue * pm.share) / (15 + Math.random() * 25)),
    100      percentage: pm.share * 100,
    101      avgValue: 15 + Math.random() * 25,
    
  • L101

    ts
    99      transactions: Math.floor((grossRevenue * pm.share) / (15 + Math.random() * 25)),
    100      percentage: pm.share * 100,
    101      avgValue: 15 + Math.random() * 25,
    102    }));
    103
    
  • L170

    ts
    168
    169      const topCreators = Array.from({ length: query.limit }, (_, i) => {
    170        const grossRevenue = (50000 - i * 1500) * (0.8 + Math.random() * 0.4);
    171        const platformFee = grossRevenue * 0.2;
    172        const netEarnings = grossRevenue - platformFee;
    
  • L173

    ts
    171        const platformFee = grossRevenue * 0.2;
    172        const netEarnings = grossRevenue - platformFee;
    173        const subscribers = Math.floor((5000 - i * 150) * (0.8 + Math.random() * 0.4));
    174        const viewers = subscribers * (3 + Math.random() * 5);
    175        const streamHours = 50 + Math.floor(Math.random() * 100);
    
  • L174

    ts
    172        const netEarnings = grossRevenue - platformFee;
    173        const subscribers = Math.floor((5000 - i * 150) * (0.8 + Math.random() * 0.4));
    174        const viewers = subscribers * (3 + Math.random() * 5);
    175        const streamHours = 50 + Math.floor(Math.random() * 100);
    176        const prevGross = grossRevenue * (0.85 + Math.random() * 0.15);
    
  • L175

    ts
    173        const subscribers = Math.floor((5000 - i * 150) * (0.8 + Math.random() * 0.4));
    174        const viewers = subscribers * (3 + Math.random() * 5);
    175        const streamHours = 50 + Math.floor(Math.random() * 100);
    176        const prevGross = grossRevenue * (0.85 + Math.random() * 0.15);
    177
    
  • L176

    ts
    174        const viewers = subscribers * (3 + Math.random() * 5);
    175        const streamHours = 50 + Math.floor(Math.random() * 100);
    176        const prevGross = grossRevenue * (0.85 + Math.random() * 0.15);
    177
    178        return {
    
  • L276

    ts
    274    const granularity = query.granularity ?? getGranularityForPeriod(query.period);
    275
    276    const activeSubscriptions = 25000 + Math.floor(Math.random() * 10000);
    277    const avgSubValue = 12 + Math.random() * 8;
    278    const mrr = activeSubscriptions * avgSubValue;
    
  • L277

    ts
    275
    276    const activeSubscriptions = 25000 + Math.floor(Math.random() * 10000);
    277    const avgSubValue = 12 + Math.random() * 8;
    278    const mrr = activeSubscriptions * avgSubValue;
    279    const arr = mrr * 12;
    
  • L280

    ts
    278    const mrr = activeSubscriptions * avgSubValue;
    279    const arr = mrr * 12;
    280    const prevMrr = mrr * (0.9 + Math.random() * 0.1);
    281    const newSubs = Math.floor(activeSubscriptions * 0.12);
    282    const canceledSubs = Math.floor(activeSubscriptions * 0.08);
    
  • L287

    ts
    285    const churnRate = canceledSubs / activeSubscriptions;
    286    const retentionRate = 1 - churnRate;
    287    const avgLifetime = 4.5 + Math.random() * 2;
    288    const ltv = avgSubValue * avgLifetime;
    289
    
  • L302

    ts
    300      subscribers: Math.floor(activeSubscriptions * t.share),
    301      revenue: Math.floor(activeSubscriptions * t.share) * t.price,
    302      churnRate: churnRate * (0.8 + Math.random() * 0.4),
    303      avgLifetime: avgLifetime * (0.9 + Math.random() * 0.2),
    304    }));
    
  • L303

    ts
    301      revenue: Math.floor(activeSubscriptions * t.share) * t.price,
    302      churnRate: churnRate * (0.8 + Math.random() * 0.4),
    303      avgLifetime: avgLifetime * (0.9 + Math.random() * 0.2),
    304    }));
    305
    
  • L311

    ts
    309      return {
    310        cohort: new Date(Date.now() - (i + 1) * 30 * 24 * 60 * 60 * 1000).toISOString().slice(0, 7),
    311        month1: Math.pow(baseRetention, 1) * (0.95 + Math.random() * 0.1),
    312        month2: Math.pow(baseRetention - decay, 2) * (0.95 + Math.random() * 0.1),
    313        month3: Math.pow(baseRetention - decay * 2, 3) * (0.95 + Math.random() * 0.1),
    
  • L312

    ts
    310        cohort: new Date(Date.now() - (i + 1) * 30 * 24 * 60 * 60 * 1000).toISOString().slice(0, 7),
    311        month1: Math.pow(baseRetention, 1) * (0.95 + Math.random() * 0.1),
    312        month2: Math.pow(baseRetention - decay, 2) * (0.95 + Math.random() * 0.1),
    313        month3: Math.pow(baseRetention - decay * 2, 3) * (0.95 + Math.random() * 0.1),
    314        month6: Math.pow(baseRetention - decay * 3, 6) * (0.95 + Math.random() * 0.1),
    
  • L313

    ts
    311        month1: Math.pow(baseRetention, 1) * (0.95 + Math.random() * 0.1),
    312        month2: Math.pow(baseRetention - decay, 2) * (0.95 + Math.random() * 0.1),
    313        month3: Math.pow(baseRetention - decay * 2, 3) * (0.95 + Math.random() * 0.1),
    314        month6: Math.pow(baseRetention - decay * 3, 6) * (0.95 + Math.random() * 0.1),
    315        month12: Math.pow(baseRetention - decay * 4, 12) * (0.95 + Math.random() * 0.1),
    
  • L314

    ts
    312        month2: Math.pow(baseRetention - decay, 2) * (0.95 + Math.random() * 0.1),
    313        month3: Math.pow(baseRetention - decay * 2, 3) * (0.95 + Math.random() * 0.1),
    314        month6: Math.pow(baseRetention - decay * 3, 6) * (0.95 + Math.random() * 0.1),
    315        month12: Math.pow(baseRetention - decay * 4, 12) * (0.95 + Math.random() * 0.1),
    316      };
    
  • L315

    ts
    313        month3: Math.pow(baseRetention - decay * 2, 3) * (0.95 + Math.random() * 0.1),
    314        month6: Math.pow(baseRetention - decay * 3, 6) * (0.95 + Math.random() * 0.1),
    315        month12: Math.pow(baseRetention - decay * 4, 12) * (0.95 + Math.random() * 0.1),
    316      };
    317    });
    
  • L389

    ts
    387      const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    388
    389      const totalTransactions = 50000 + Math.floor(Math.random() * 30000);
    390      const totalVolume = 500000 + Math.random() * 500000;
    391      const successRate = 0.97 + Math.random() * 0.02;
    
  • L390

    ts
    388
    389      const totalTransactions = 50000 + Math.floor(Math.random() * 30000);
    390      const totalVolume = 500000 + Math.random() * 500000;
    391      const successRate = 0.97 + Math.random() * 0.02;
    392      const avgTransactionValue = totalVolume / totalTransactions;
    
  • L391

    ts
    389      const totalTransactions = 50000 + Math.floor(Math.random() * 30000);
    390      const totalVolume = 500000 + Math.random() * 500000;
    391      const successRate = 0.97 + Math.random() * 0.02;
    392      const avgTransactionValue = totalVolume / totalTransactions;
    393      const uniquePayers = Math.floor(totalTransactions * 0.4);
    
  • L414

    ts
    412        const peakMultiplier = hour >= 18 || hour <= 2 ? 1.5 : hour >= 10 && hour <= 14 ? 1.2 : 0.8;
    413        const hourTx = Math.floor(
    414          (totalTransactions / 24) * peakMultiplier * (0.9 + Math.random() * 0.2)
    415        );
    416        return {
    
  • L426

    ts
    424      const topTransactions = Array.from({ length: Math.min(query.limit, 20) }, () => ({
    425        id: `txn-${crypto.randomUUID().slice(0, 8)}`,
    426        type: types[Math.floor(Math.random() * types.length)],
    427        amount: 100 + Math.random() * 500,
    428        currency: 'USD',
    
  • L427

    ts
    425        id: `txn-${crypto.randomUUID().slice(0, 8)}`,
    426        type: types[Math.floor(Math.random() * types.length)],
    427        amount: 100 + Math.random() * 500,
    428        currency: 'USD',
    429        userId: `user-${Math.floor(Math.random() * 10000)}`,
    
  • L429

    ts
    427        amount: 100 + Math.random() * 500,
    428        currency: 'USD',
    429        userId: `user-${Math.floor(Math.random() * 10000)}`,
    430        creatorId: `creator-${Math.floor(Math.random() * 1000)}`,
    431        timestamp: new Date(
    
  • L430

    ts
    428        currency: 'USD',
    429        userId: `user-${Math.floor(Math.random() * 10000)}`,
    430        creatorId: `creator-${Math.floor(Math.random() * 1000)}`,
    431        timestamp: new Date(
    432          start.getTime() + Math.random() * (end.getTime() - start.getTime())
    
  • L432

    ts
    430        creatorId: `creator-${Math.floor(Math.random() * 1000)}`,
    431        timestamp: new Date(
    432          start.getTime() + Math.random() * (end.getTime() - start.getTime())
    433        ).toISOString(),
    434        status: Math.random() > 0.03 ? 'completed' : 'pending',
    
  • L434

    ts
    432          start.getTime() + Math.random() * (end.getTime() - start.getTime())
    433        ).toISOString(),
    434        status: Math.random() > 0.03 ? 'completed' : 'pending',
    435      })).sort((a, b) => b.amount - a.amount);
    436
    
  • L503

    ts
    501      }
    502
    503      const currentMrr = 150000 + Math.random() * 50000;
    504      const growthRate = 0.05 + Math.random() * 0.05;
    505
    
  • L504

    ts
    502
    503      const currentMrr = 150000 + Math.random() * 50000;
    504      const growthRate = 0.05 + Math.random() * 0.05;
    505
    506      const projections = [];
    
  • L510

    ts
    508
    509      for (let month = 1; month <= Math.ceil(query.horizon / 30); month++) {
    510        projectedMrr *= 1 + growthRate * (0.8 + Math.random() * 0.4);
    511        const confidence = Math.max(0.5, 0.95 - month * 0.03);
    512
    

apps/aphrodite/admin-bi-dashboard/src/routes/users.ts#

  • L55

    ts
    53
    54    // Generate user growth metrics
    55    const totalUsers = 200000 + Math.floor(Math.random() * 50000);
    56    const activeUsers = Math.floor(totalUsers * (0.35 + Math.random() * 0.15));
    57    const newUsers = Math.floor(totalUsers * 0.05 * (0.8 + Math.random() * 0.4));
    
  • L56

    ts
    54    // Generate user growth metrics
    55    const totalUsers = 200000 + Math.floor(Math.random() * 50000);
    56    const activeUsers = Math.floor(totalUsers * (0.35 + Math.random() * 0.15));
    57    const newUsers = Math.floor(totalUsers * 0.05 * (0.8 + Math.random() * 0.4));
    58    const churned = Math.floor(newUsers * (0.2 + Math.random() * 0.1));
    
  • L57

    ts
    55    const totalUsers = 200000 + Math.floor(Math.random() * 50000);
    56    const activeUsers = Math.floor(totalUsers * (0.35 + Math.random() * 0.15));
    57    const newUsers = Math.floor(totalUsers * 0.05 * (0.8 + Math.random() * 0.4));
    58    const churned = Math.floor(newUsers * (0.2 + Math.random() * 0.1));
    59    const reactivated = Math.floor(churned * (0.15 + Math.random() * 0.1));
    
  • L58

    ts
    56    const activeUsers = Math.floor(totalUsers * (0.35 + Math.random() * 0.15));
    57    const newUsers = Math.floor(totalUsers * 0.05 * (0.8 + Math.random() * 0.4));
    58    const churned = Math.floor(newUsers * (0.2 + Math.random() * 0.1));
    59    const reactivated = Math.floor(churned * (0.15 + Math.random() * 0.1));
    60    const verified = Math.floor(totalUsers * (0.6 + Math.random() * 0.2));
    
  • L59

    ts
    57    const newUsers = Math.floor(totalUsers * 0.05 * (0.8 + Math.random() * 0.4));
    58    const churned = Math.floor(newUsers * (0.2 + Math.random() * 0.1));
    59    const reactivated = Math.floor(churned * (0.15 + Math.random() * 0.1));
    60    const verified = Math.floor(totalUsers * (0.6 + Math.random() * 0.2));
    61    const premium = Math.floor(totalUsers * (0.08 + Math.random() * 0.04));
    
  • L60

    ts
    58    const churned = Math.floor(newUsers * (0.2 + Math.random() * 0.1));
    59    const reactivated = Math.floor(churned * (0.15 + Math.random() * 0.1));
    60    const verified = Math.floor(totalUsers * (0.6 + Math.random() * 0.2));
    61    const premium = Math.floor(totalUsers * (0.08 + Math.random() * 0.04));
    62
    
  • L61

    ts
    59    const reactivated = Math.floor(churned * (0.15 + Math.random() * 0.1));
    60    const verified = Math.floor(totalUsers * (0.6 + Math.random() * 0.2));
    61    const premium = Math.floor(totalUsers * (0.08 + Math.random() * 0.04));
    62
    63    // Previous period for comparison
    
  • L64

    ts
    62
    63    // Previous period for comparison
    64    const prevActiveUsers = activeUsers * (0.88 + Math.random() * 0.08);
    65    const prevNewUsers = newUsers * (0.85 + Math.random() * 0.1);
    66    const retentionRate = 0.75 + Math.random() * 0.1;
    
  • L65

    ts
    63    // Previous period for comparison
    64    const prevActiveUsers = activeUsers * (0.88 + Math.random() * 0.08);
    65    const prevNewUsers = newUsers * (0.85 + Math.random() * 0.1);
    66    const retentionRate = 0.75 + Math.random() * 0.1;
    67    const prevRetention = retentionRate * (0.95 + Math.random() * 0.08);
    
  • L66

    ts
    64    const prevActiveUsers = activeUsers * (0.88 + Math.random() * 0.08);
    65    const prevNewUsers = newUsers * (0.85 + Math.random() * 0.1);
    66    const retentionRate = 0.75 + Math.random() * 0.1;
    67    const prevRetention = retentionRate * (0.95 + Math.random() * 0.08);
    68
    
  • L67

    ts
    65    const prevNewUsers = newUsers * (0.85 + Math.random() * 0.1);
    66    const retentionRate = 0.75 + Math.random() * 0.1;
    67    const prevRetention = retentionRate * (0.95 + Math.random() * 0.08);
    68
    69    // Calculate rates
    
  • L71

    ts
    69    // Calculate rates
    70    const signupRate = newUsers / activeUsers;
    71    const activationRate = 0.65 + Math.random() * 0.2;
    72    const churnRate = churned / activeUsers;
    73    const conversionRate = premium / activeUsers;
    
  • L144

    ts
    142
    143    const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    144    const totalNewUsers = 8000 + Math.floor(Math.random() * 4000);
    145
    146    // Channel acquisition data
    
  • L159

    ts
    157
    158    const byChannel = channels.map((ch) => {
    159      const users = Math.floor(totalNewUsers * ch.share * (0.9 + Math.random() * 0.2));
    160      const conversionRate = 0.02 + Math.random() * 0.08;
    161      const cac = ch.cac * (0.8 + Math.random() * 0.4);
    
  • L160

    ts
    158    const byChannel = channels.map((ch) => {
    159      const users = Math.floor(totalNewUsers * ch.share * (0.9 + Math.random() * 0.2));
    160      const conversionRate = 0.02 + Math.random() * 0.08;
    161      const cac = ch.cac * (0.8 + Math.random() * 0.4);
    162      const ltv = 50 + Math.random() * 150;
    
  • L161

    ts
    159      const users = Math.floor(totalNewUsers * ch.share * (0.9 + Math.random() * 0.2));
    160      const conversionRate = 0.02 + Math.random() * 0.08;
    161      const cac = ch.cac * (0.8 + Math.random() * 0.4);
    162      const ltv = 50 + Math.random() * 150;
    163      return {
    
  • L162

    ts
    160      const conversionRate = 0.02 + Math.random() * 0.08;
    161      const cac = ch.cac * (0.8 + Math.random() * 0.4);
    162      const ltv = 50 + Math.random() * 150;
    163      return {
    164        channel: ch.channel,
    
  • L188

    ts
    186    const byCampaign = campaignNames.slice(0, 6).map((campaign, index) => {
    187      const channelIndex = index % channels.length;
    188      const users = Math.floor(((totalNewUsers * 0.05) / (index + 1)) * (0.8 + Math.random() * 0.4));
    189      const spend = users * (20 + Math.random() * 30);
    190      return {
    
  • L189

    ts
    187      const channelIndex = index % channels.length;
    188      const users = Math.floor(((totalNewUsers * 0.05) / (index + 1)) * (0.8 + Math.random() * 0.4));
    189      const spend = users * (20 + Math.random() * 30);
    190      return {
    191        campaign,
    
  • L196

    ts
    194        spend,
    195        cpa: spend / users,
    196        conversionRate: 0.02 + Math.random() * 0.06,
    197      };
    198    });
    
  • L202

    ts
    200    // Referral data
    201    const byReferral = Array.from({ length: 10 }, (_, i) => {
    202      const referrals = Math.floor((50 / (i + 1)) * (0.8 + Math.random() * 0.4));
    203      return {
    204        referrerId: `user_${100000 + i}`,
    
  • L207

    ts
    205        referrerUsername: `top_referrer_${i + 1}`,
    206        referrals,
    207        conversionRate: 0.4 + Math.random() * 0.4,
    208        rewardsPaid: referrals * 10,
    209      };
    
  • L290

    ts
    288
    289    // Core engagement metrics
    290    const mau = 150000 + Math.floor(Math.random() * 30000);
    291    const wau = Math.floor(mau * (0.45 + Math.random() * 0.15));
    292    const dau = Math.floor(wau * (0.35 + Math.random() * 0.1));
    
  • L291

    ts
    289    // Core engagement metrics
    290    const mau = 150000 + Math.floor(Math.random() * 30000);
    291    const wau = Math.floor(mau * (0.45 + Math.random() * 0.15));
    292    const dau = Math.floor(wau * (0.35 + Math.random() * 0.1));
    293    const dauMauRatio = dau / mau;
    
  • L292

    ts
    290    const mau = 150000 + Math.floor(Math.random() * 30000);
    291    const wau = Math.floor(mau * (0.45 + Math.random() * 0.15));
    292    const dau = Math.floor(wau * (0.35 + Math.random() * 0.1));
    293    const dauMauRatio = dau / mau;
    294    const avgSessionDuration = 15 + Math.random() * 25; // minutes
    
  • L294

    ts
    292    const dau = Math.floor(wau * (0.35 + Math.random() * 0.1));
    293    const dauMauRatio = dau / mau;
    294    const avgSessionDuration = 15 + Math.random() * 25; // minutes
    295    const avgSessionsPerUser = 2 + Math.random() * 3;
    296    const avgViewingTime = 45 + Math.random() * 60; // minutes per day
    
  • L295

    ts
    293    const dauMauRatio = dau / mau;
    294    const avgSessionDuration = 15 + Math.random() * 25; // minutes
    295    const avgSessionsPerUser = 2 + Math.random() * 3;
    296    const avgViewingTime = 45 + Math.random() * 60; // minutes per day
    297    const avgInteractions = 10 + Math.floor(Math.random() * 20);
    
  • L296

    ts
    294    const avgSessionDuration = 15 + Math.random() * 25; // minutes
    295    const avgSessionsPerUser = 2 + Math.random() * 3;
    296    const avgViewingTime = 45 + Math.random() * 60; // minutes per day
    297    const avgInteractions = 10 + Math.floor(Math.random() * 20);
    298
    
  • L297

    ts
    295    const avgSessionsPerUser = 2 + Math.random() * 3;
    296    const avgViewingTime = 45 + Math.random() * 60; // minutes per day
    297    const avgInteractions = 10 + Math.floor(Math.random() * 20);
    298
    299    // Activity breakdown
    
  • L312

    ts
    310
    311    const byActivity = activities.map((act) => {
    312      const users = Math.floor(dau * act.share * (0.85 + Math.random() * 0.3));
    313      const count = users * (1 + Math.floor(Math.random() * 5));
    314      return {
    
  • L313

    ts
    311    const byActivity = activities.map((act) => {
    312      const users = Math.floor(dau * act.share * (0.85 + Math.random() * 0.3));
    313      const count = users * (1 + Math.floor(Math.random() * 5));
    314      return {
    315        activity: act.activity,
    
  • L333

    ts
    331
    332    const bySegment = segments.map((seg) => {
    333      const users = Math.floor(mau * seg.share * (0.9 + Math.random() * 0.2));
    334      return {
    335        segment: seg.segment,
    
  • L337

    ts
    335        segment: seg.segment,
    336        users,
    337        avgEngagement: seg.avgEngagement * (0.9 + Math.random() * 0.2),
    338        retention: 0.5 + seg.avgEngagement * 0.4 + Math.random() * 0.1,
    339      };
    
  • L338

    ts
    336        users,
    337        avgEngagement: seg.avgEngagement * (0.9 + Math.random() * 0.2),
    338        retention: 0.5 + seg.avgEngagement * 0.4 + Math.random() * 0.1,
    339      };
    340    });
    
  • L350

    ts
    348      return {
    349        cohort,
    350        week1: baseEngagement * (0.95 + Math.random() * 0.1),
    351        week2: baseEngagement * 0.85 * (0.95 + Math.random() * 0.1),
    352        week3: baseEngagement * 0.75 * (0.95 + Math.random() * 0.1),
    
  • L351

    ts
    349        cohort,
    350        week1: baseEngagement * (0.95 + Math.random() * 0.1),
    351        week2: baseEngagement * 0.85 * (0.95 + Math.random() * 0.1),
    352        week3: baseEngagement * 0.75 * (0.95 + Math.random() * 0.1),
    353        week4: baseEngagement * 0.65 * (0.95 + Math.random() * 0.1),
    
  • L352

    ts
    350        week1: baseEngagement * (0.95 + Math.random() * 0.1),
    351        week2: baseEngagement * 0.85 * (0.95 + Math.random() * 0.1),
    352        week3: baseEngagement * 0.75 * (0.95 + Math.random() * 0.1),
    353        week4: baseEngagement * 0.65 * (0.95 + Math.random() * 0.1),
    354      };
    
  • L353

    ts
    351        week2: baseEngagement * 0.85 * (0.95 + Math.random() * 0.1),
    352        week3: baseEngagement * 0.75 * (0.95 + Math.random() * 0.1),
    353        week4: baseEngagement * 0.65 * (0.95 + Math.random() * 0.1),
    354      };
    355    });
    
  • L420

    ts
    418
    419    // Creator totals
    420    const totalCreators = 12000 + Math.floor(Math.random() * 3000);
    421    const activeCreators = Math.floor(totalCreators * (0.4 + Math.random() * 0.15));
    422    const newCreators = Math.floor(totalCreators * 0.04 * (0.8 + Math.random() * 0.4));
    
  • L421

    ts
    419    // Creator totals
    420    const totalCreators = 12000 + Math.floor(Math.random() * 3000);
    421    const activeCreators = Math.floor(totalCreators * (0.4 + Math.random() * 0.15));
    422    const newCreators = Math.floor(totalCreators * 0.04 * (0.8 + Math.random() * 0.4));
    423    const verifiedCreators = Math.floor(totalCreators * (0.25 + Math.random() * 0.1));
    
  • L422

    ts
    420    const totalCreators = 12000 + Math.floor(Math.random() * 3000);
    421    const activeCreators = Math.floor(totalCreators * (0.4 + Math.random() * 0.15));
    422    const newCreators = Math.floor(totalCreators * 0.04 * (0.8 + Math.random() * 0.4));
    423    const verifiedCreators = Math.floor(totalCreators * (0.25 + Math.random() * 0.1));
    424    const topTierCreators = Math.floor(totalCreators * (0.02 + Math.random() * 0.01));
    
  • L423

    ts
    421    const activeCreators = Math.floor(totalCreators * (0.4 + Math.random() * 0.15));
    422    const newCreators = Math.floor(totalCreators * 0.04 * (0.8 + Math.random() * 0.4));
    423    const verifiedCreators = Math.floor(totalCreators * (0.25 + Math.random() * 0.1));
    424    const topTierCreators = Math.floor(totalCreators * (0.02 + Math.random() * 0.01));
    425
    
  • L424

    ts
    422    const newCreators = Math.floor(totalCreators * 0.04 * (0.8 + Math.random() * 0.4));
    423    const verifiedCreators = Math.floor(totalCreators * (0.25 + Math.random() * 0.1));
    424    const topTierCreators = Math.floor(totalCreators * (0.02 + Math.random() * 0.01));
    425
    426    // Previous period for comparison
    
  • L427

    ts
    425
    426    // Previous period for comparison
    427    const prevActiveCreators = activeCreators * (0.9 + Math.random() * 0.08);
    428    const prevNewCreators = newCreators * (0.85 + Math.random() * 0.15);
    429    const prevVerified = verifiedCreators * (0.92 + Math.random() * 0.06);
    
  • L428

    ts
    426    // Previous period for comparison
    427    const prevActiveCreators = activeCreators * (0.9 + Math.random() * 0.08);
    428    const prevNewCreators = newCreators * (0.85 + Math.random() * 0.15);
    429    const prevVerified = verifiedCreators * (0.92 + Math.random() * 0.06);
    430
    
  • L429

    ts
    427    const prevActiveCreators = activeCreators * (0.9 + Math.random() * 0.08);
    428    const prevNewCreators = newCreators * (0.85 + Math.random() * 0.15);
    429    const prevVerified = verifiedCreators * (0.92 + Math.random() * 0.06);
    430
    431    // Creators by category
    
  • L444

    ts
    442
    443    const byCategory = categories.map((cat) => {
    444      const creators = Math.floor(totalCreators * cat.share * (0.85 + Math.random() * 0.3));
    445      return {
    446        category: cat.category,
    
  • L448

    ts
    446        category: cat.category,
    447        creators,
    448        avgRevenue: 500 + Math.random() * 2000,
    449        avgViewers: 20 + Math.floor(Math.random() * 100),
    450        growth: -5 + Math.random() * 25,
    
  • L449

    ts
    447        creators,
    448        avgRevenue: 500 + Math.random() * 2000,
    449        avgViewers: 20 + Math.floor(Math.random() * 100),
    450        growth: -5 + Math.random() * 25,
    451      };
    
  • L450

    ts
    448        avgRevenue: 500 + Math.random() * 2000,
    449        avgViewers: 20 + Math.floor(Math.random() * 100),
    450        growth: -5 + Math.random() * 25,
    451      };
    452    });
    
  • L467

    ts
    465
    466    const onboarding = onboardingStages.map((stage, index) => {
    467      const count = Math.floor(onboardingBase * stage.conversionRate * (0.9 + Math.random() * 0.2));
    468      const prevConversion = index > 0 ? (onboardingStages[index - 1]?.conversionRate ?? 1) : 1;
    469      return {
    
  • L473

    ts
    471        count,
    472        conversionRate: stage.conversionRate / prevConversion,
    473        avgTimeInStage: stage.avgTime * (0.8 + Math.random() * 0.4),
    474      };
    475    });
    
  • L561

    ts
    559        }
    560
    561        const cohortUsers = 500 + Math.floor(Math.random() * 500);
    562        const retention = Array.from({ length: retentionPeriods }, (_, j) => {
    563          // Retention typically follows a decay curve
    
  • L565

    ts
    563          // Retention typically follows a decay curve
    564          const baseRetention = Math.pow(0.85, j + 1);
    565          return Math.min(1, baseRetention * (0.9 + Math.random() * 0.2));
    566        });
    567
    
  • L588

    ts
    586      // Overall retention metrics
    587      const overallMetrics = {
    588        d1Retention: 0.45 + Math.random() * 0.15,
    589        d7Retention: 0.25 + Math.random() * 0.1,
    590        d30Retention: 0.12 + Math.random() * 0.08,
    
  • L589

    ts
    587      const overallMetrics = {
    588        d1Retention: 0.45 + Math.random() * 0.15,
    589        d7Retention: 0.25 + Math.random() * 0.1,
    590        d30Retention: 0.12 + Math.random() * 0.08,
    591        d90Retention: 0.06 + Math.random() * 0.04,
    
  • L590

    ts
    588        d1Retention: 0.45 + Math.random() * 0.15,
    589        d7Retention: 0.25 + Math.random() * 0.1,
    590        d30Retention: 0.12 + Math.random() * 0.08,
    591        d90Retention: 0.06 + Math.random() * 0.04,
    592        avgLifetimeDays: 45 + Math.random() * 30,
    
  • L591

    ts
    589        d7Retention: 0.25 + Math.random() * 0.1,
    590        d30Retention: 0.12 + Math.random() * 0.08,
    591        d90Retention: 0.06 + Math.random() * 0.04,
    592        avgLifetimeDays: 45 + Math.random() * 30,
    593        churnPredictionAccuracy: 0.75 + Math.random() * 0.15,
    
  • L592

    ts
    590        d30Retention: 0.12 + Math.random() * 0.08,
    591        d90Retention: 0.06 + Math.random() * 0.04,
    592        avgLifetimeDays: 45 + Math.random() * 30,
    593        churnPredictionAccuracy: 0.75 + Math.random() * 0.15,
    594      };
    
  • L593

    ts
    591        d90Retention: 0.06 + Math.random() * 0.04,
    592        avgLifetimeDays: 45 + Math.random() * 30,
    593        churnPredictionAccuracy: 0.75 + Math.random() * 0.15,
    594      };
    595
    
  • L648

    ts
    646
    647    const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    648    const totalUsers = 200000 + Math.floor(Math.random() * 50000);
    649
    650    // Age distribution
    
  • L660

    ts
    658    ].map((age) => ({
    659      ageRange: age.range,
    660      users: Math.floor(totalUsers * age.share * (0.9 + Math.random() * 0.2)),
    661      percentage: age.share * 100,
    662      avgWatchTime: 30 + Math.random() * 60,
    
  • L662

    ts
    660      users: Math.floor(totalUsers * age.share * (0.9 + Math.random() * 0.2)),
    661      percentage: age.share * 100,
    662      avgWatchTime: 30 + Math.random() * 60,
    663      avgSpend: 5 + Math.random() * 25,
    664    }));
    
  • L663

    ts
    661      percentage: age.share * 100,
    662      avgWatchTime: 30 + Math.random() * 60,
    663      avgSpend: 5 + Math.random() * 25,
    664    }));
    665
    
  • L674

    ts
    672    ].map((g) => ({
    673      gender: g.gender,
    674      users: Math.floor(totalUsers * g.share * (0.95 + Math.random() * 0.1)),
    675      percentage: g.share * 100,
    676      avgEngagement: 0.3 + Math.random() * 0.4,
    
  • L676

    ts
    674      users: Math.floor(totalUsers * g.share * (0.95 + Math.random() * 0.1)),
    675      percentage: g.share * 100,
    676      avgEngagement: 0.3 + Math.random() * 0.4,
    677    }));
    678
    
  • L688

    ts
    686    ].map((d) => ({
    687      device: d.device,
    688      users: Math.floor(totalUsers * d.share * (0.9 + Math.random() * 0.2)),
    689      percentage: d.share * 100,
    690      avgSessionDuration: 15 + Math.random() * 30,
    
  • L690

    ts
    688      users: Math.floor(totalUsers * d.share * (0.9 + Math.random() * 0.2)),
    689      percentage: d.share * 100,
    690      avgSessionDuration: 15 + Math.random() * 30,
    691    }));
    692
    
  • L703

    ts
    701    ].map((p) => ({
    702      platform: p.platform,
    703      users: Math.floor(totalUsers * p.share * (0.9 + Math.random() * 0.2)),
    704      percentage: p.share * 100,
    705      conversionRate: 0.02 + Math.random() * 0.06,
    
  • L705

    ts
    703      users: Math.floor(totalUsers * p.share * (0.9 + Math.random() * 0.2)),
    704      percentage: p.share * 100,
    705      conversionRate: 0.02 + Math.random() * 0.06,
    706    }));
    707
    
  • L720

    ts
    718    ].map((l) => ({
    719      language: l.language,
    720      users: Math.floor(totalUsers * l.share * (0.9 + Math.random() * 0.2)),
    721      percentage: l.share * 100,
    722    }));
    
  • L776

    ts
    774
    775    const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    776    const totalUsers = 200000 + Math.floor(Math.random() * 50000);
    777
    778    // Lifecycle stages
    
  • L792

    ts
    790    const byStage = stages.map((s) => ({
    791      stage: s.stage,
    792      users: Math.floor(totalUsers * s.share * (0.9 + Math.random() * 0.2)),
    793      percentage: s.share * 100,
    794      avgLifetimeValue: s.avgValue * (0.8 + Math.random() * 0.4),
    
  • L794

    ts
    792      users: Math.floor(totalUsers * s.share * (0.9 + Math.random() * 0.2)),
    793      percentage: s.share * 100,
    794      avgLifetimeValue: s.avgValue * (0.8 + Math.random() * 0.4),
    795      avgDaysInStage: 5 + Math.floor(Math.random() * 25),
    796    }));
    
  • L795

    ts
    793      percentage: s.share * 100,
    794      avgLifetimeValue: s.avgValue * (0.8 + Math.random() * 0.4),
    795      avgDaysInStage: 5 + Math.floor(Math.random() * 25),
    796    }));
    797
    
  • L819

    ts
    817      from: t.from,
    818      to: t.to,
    819      rate: t.rate * (0.9 + Math.random() * 0.2),
    820      users: Math.floor(1000 * t.rate * (0.8 + Math.random() * 0.4)),
    821    }));
    
  • L820

    ts
    818      to: t.to,
    819      rate: t.rate * (0.9 + Math.random() * 0.2),
    820      users: Math.floor(1000 * t.rate * (0.8 + Math.random() * 0.4)),
    821    }));
    822
    
  • L825

    ts
    823    // Lifecycle health score
    824    const healthScore = {
    825      overall: 0.65 + Math.random() * 0.2,
    826      growth: 0.7 + Math.random() * 0.2,
    827      engagement: 0.6 + Math.random() * 0.25,
    
  • L826

    ts
    824    const healthScore = {
    825      overall: 0.65 + Math.random() * 0.2,
    826      growth: 0.7 + Math.random() * 0.2,
    827      engagement: 0.6 + Math.random() * 0.25,
    828      retention: 0.55 + Math.random() * 0.3,
    
  • L827

    ts
    825      overall: 0.65 + Math.random() * 0.2,
    826      growth: 0.7 + Math.random() * 0.2,
    827      engagement: 0.6 + Math.random() * 0.25,
    828      retention: 0.55 + Math.random() * 0.3,
    829      monetization: 0.5 + Math.random() * 0.3,
    
  • L828

    ts
    826      growth: 0.7 + Math.random() * 0.2,
    827      engagement: 0.6 + Math.random() * 0.25,
    828      retention: 0.55 + Math.random() * 0.3,
    829      monetization: 0.5 + Math.random() * 0.3,
    830    };
    
  • L829

    ts
    827      engagement: 0.6 + Math.random() * 0.25,
    828      retention: 0.55 + Math.random() * 0.3,
    829      monetization: 0.5 + Math.random() * 0.3,
    830    };
    831
    

apps/aphrodite/admin-bi-dashboard/src/types.ts#

  • L1139

    ts
    1137
    1138    while (current <= endDate) {
    1139      const change = (Math.random() - 0.5) * 2 * volatility * baseValue;
    1140      value = Math.max(0, value + change);
    1141
    

apps/aphrodite/analytics-dashboard/src/routes/alerts.ts#

  • L249

    ts
    247        configId: `alert-config-${(i % 4) + 1}`,
    248        triggeredAt: new Date(
    249          end.getTime() - Math.random() * (end.getTime() - start.getTime())
    250        ).toISOString(),
    251        resolvedAt:
    
  • L252

    ts
    250        ).toISOString(),
    251        resolvedAt:
    252          Math.random() > 0.3
    253            ? new Date(
    254                end.getTime() - Math.random() * (end.getTime() - start.getTime()) * 0.5
    
  • L254

    ts
    252          Math.random() > 0.3
    253            ? new Date(
    254                end.getTime() - Math.random() * (end.getTime() - start.getTime()) * 0.5
    255              ).toISOString()
    256            : undefined,
    
  • L259

    ts
    257        severity: (['low', 'medium', 'high', 'critical'] as const)[i % 4],
    258        metric: ['revenue', 'viewers', 'cpu_usage', 'churn_rate'][i % 4],
    259        value: 50 + Math.random() * 100,
    260        threshold: 40,
    261        message: `Alert triggered: ${['Revenue drop detected', 'Viewer surge', 'High CPU usage', 'Churn rate increase'][i % 4]}`,
    
  • L262

    ts
    260        threshold: 40,
    261        message: `Alert triggered: ${['Revenue drop detected', 'Viewer surge', 'High CPU usage', 'Churn rate increase'][i % 4]}`,
    262        acknowledged: Math.random() > 0.5,
    263        acknowledgedBy: Math.random() > 0.5 ? 'admin@example.com' : undefined,
    264        acknowledgedAt: Math.random() > 0.5 ? new Date().toISOString() : undefined,
    
  • L263

    ts
    261        message: `Alert triggered: ${['Revenue drop detected', 'Viewer surge', 'High CPU usage', 'Churn rate increase'][i % 4]}`,
    262        acknowledged: Math.random() > 0.5,
    263        acknowledgedBy: Math.random() > 0.5 ? 'admin@example.com' : undefined,
    264        acknowledgedAt: Math.random() > 0.5 ? new Date().toISOString() : undefined,
    265      })
    
  • L264

    ts
    262        acknowledged: Math.random() > 0.5,
    263        acknowledgedBy: Math.random() > 0.5 ? 'admin@example.com' : undefined,
    264        acknowledgedAt: Math.random() > 0.5 ? new Date().toISOString() : undefined,
    265      })
    266    );
    
  • L292

    ts
    290      id: `active-alert-${i + 1}`,
    291      configId: `alert-config-${i + 1}`,
    292      triggeredAt: new Date(Date.now() - Math.random() * 3600000).toISOString(),
    293      severity: (['low', 'medium', 'high'] as const)[i],
    294      metric: ['viewers', 'latency', 'error_rate'][i],
    
  • L295

    ts
    293      severity: (['low', 'medium', 'high'] as const)[i],
    294      metric: ['viewers', 'latency', 'error_rate'][i],
    295      value: 50 + Math.random() * 50,
    296      threshold: 40,
    297      message: `Active alert: ${['High viewer count', 'Elevated latency', 'Error rate increase'][i]}`,
    
  • L581

    ts
    579    const members = Array.from({ length: Math.min(limit, total - offset) }, (_, i) => {
    580      const metrics = {
    581        totalSpending: 100 + Math.random() * 400,
    582        watchTime: 5000 + Math.random() * 10000,
    583        messageCount: 50 + Math.floor(Math.random() * 200),
    
  • L582

    ts
    580      const metrics = {
    581        totalSpending: 100 + Math.random() * 400,
    582        watchTime: 5000 + Math.random() * 10000,
    583        messageCount: 50 + Math.floor(Math.random() * 200),
    584      };
    
  • L583

    ts
    581        totalSpending: 100 + Math.random() * 400,
    582        watchTime: 5000 + Math.random() * 10000,
    583        messageCount: 50 + Math.floor(Math.random() * 200),
    584      };
    585      const fit = fitModel.score({ segmentId, metrics });
    
  • L589

    ts
    587        userId: `user-${offset + i + 1}`,
    588        username: `User${offset + i + 1}`,
    589        addedAt: new Date(Date.now() - Math.random() * 90 * 24 * 60 * 60 * 1000).toISOString(),
    590        score: fit.score,
    591        contributions: fit.contributions,
    
  • L706

    ts
    704    const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    705
    706    const totalUsers = 10000 + Math.floor(Math.random() * 5000);
    707
    708    const analysis: FunnelAnalysisResponse = {
    

apps/aphrodite/analytics-dashboard/src/routes/dashboards.ts#

  • L113

    ts
    111      const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    112
    113      const totalRevenue = 15000 + Math.random() * 10000;
    114      const totalViewers = 25000 + Math.floor(Math.random() * 15000);
    115      const totalFollowers = 12000 + Math.floor(Math.random() * 5000);
    
  • L114

    ts
    112
    113      const totalRevenue = 15000 + Math.random() * 10000;
    114      const totalViewers = 25000 + Math.floor(Math.random() * 15000);
    115      const totalFollowers = 12000 + Math.floor(Math.random() * 5000);
    116      const totalStreams = 15 + Math.floor(Math.random() * 10);
    
  • L115

    ts
    113      const totalRevenue = 15000 + Math.random() * 10000;
    114      const totalViewers = 25000 + Math.floor(Math.random() * 15000);
    115      const totalFollowers = 12000 + Math.floor(Math.random() * 5000);
    116      const totalStreams = 15 + Math.floor(Math.random() * 10);
    117
    
  • L116

    ts
    114      const totalViewers = 25000 + Math.floor(Math.random() * 15000);
    115      const totalFollowers = 12000 + Math.floor(Math.random() * 5000);
    116      const totalStreams = 15 + Math.floor(Math.random() * 10);
    117
    118      const dashboard = {
    
  • L130

    ts
    128          totalStreams,
    129          streamChange: calculateGrowth(totalStreams, totalStreams * 0.9),
    130          avgStreamDuration: 120 + Math.floor(Math.random() * 60),
    131          avgViewersPerStream: Math.floor(totalViewers / totalStreams),
    132          engagementRate: 0.35 + Math.random() * 0.15,
    
  • L132

    ts
    130          avgStreamDuration: 120 + Math.floor(Math.random() * 60),
    131          avgViewersPerStream: Math.floor(totalViewers / totalStreams),
    132          engagementRate: 0.35 + Math.random() * 0.15,
    133        },
    134        revenueBreakdown: {
    
  • L145

    ts
    143          title: `Stream ${i + 1}`,
    144          startedAt: new Date(end.getTime() - (i + 1) * 24 * 60 * 60 * 1000).toISOString(),
    145          duration: 90 + Math.floor(Math.random() * 90),
    146          viewers: { total: 2000 - i * 200, peak: 3000 - i * 250, unique: 1500 - i * 150 },
    147          revenue: 800 - i * 100 + Math.random() * 200,
    
  • L147

    ts
    145          duration: 90 + Math.floor(Math.random() * 90),
    146          viewers: { total: 2000 - i * 200, peak: 3000 - i * 250, unique: 1500 - i * 150 },
    147          revenue: 800 - i * 100 + Math.random() * 200,
    148          engagement: 0.35 + Math.random() * 0.15,
    149        })),
    
  • L148

    ts
    146          viewers: { total: 2000 - i * 200, peak: 3000 - i * 250, unique: 1500 - i * 150 },
    147          revenue: 800 - i * 100 + Math.random() * 200,
    148          engagement: 0.35 + Math.random() * 0.15,
    149        })),
    150        topSupporters: Array.from({ length: 10 }, (_, i) => ({
    
  • L159

    ts
    157        viewerTrend: Array.from({ length: 30 }, (_, i) => ({
    158          date: new Date(start.getTime() + i * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
    159          viewers: Math.floor((totalViewers / 30) * (0.8 + Math.random() * 0.4)),
    160          unique: Math.floor((totalViewers / 30) * 0.6 * (0.8 + Math.random() * 0.4)),
    161        })),
    
  • L160

    ts
    158          date: new Date(start.getTime() + i * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
    159          viewers: Math.floor((totalViewers / 30) * (0.8 + Math.random() * 0.4)),
    160          unique: Math.floor((totalViewers / 30) * 0.6 * (0.8 + Math.random() * 0.4)),
    161        })),
    162        revenueTrend: Array.from({ length: 30 }, (_, i) => ({
    
  • L164

    ts
    162        revenueTrend: Array.from({ length: 30 }, (_, i) => ({
    163          date: new Date(start.getTime() + i * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
    164          amount: (totalRevenue / 30) * (0.7 + Math.random() * 0.6),
    165        })),
    166        peakHours: Array.from({ length: 24 }, (_, hour) => ({
    
  • L241

    ts
    239    const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    240
    241    const totalWatchTime = 5000 + Math.floor(Math.random() * 3000);
    242    const totalSpending = 200 + Math.floor(Math.random() * 300);
    243
    
  • L242

    ts
    240
    241    const totalWatchTime = 5000 + Math.floor(Math.random() * 3000);
    242    const totalSpending = 200 + Math.floor(Math.random() * 300);
    243
    244    const dashboard = {
    
  • L260

    ts
    258      },
    259      activity: {
    260        streamsWatched: 45 + Math.floor(Math.random() * 20),
    261        creatorsFollowed: 12 + Math.floor(Math.random() * 8),
    262        messagesSent: 150 + Math.floor(Math.random() * 100),
    
  • L261

    ts
    259      activity: {
    260        streamsWatched: 45 + Math.floor(Math.random() * 20),
    261        creatorsFollowed: 12 + Math.floor(Math.random() * 8),
    262        messagesSent: 150 + Math.floor(Math.random() * 100),
    263        reactionsGiven: 300 + Math.floor(Math.random() * 200),
    
  • L262

    ts
    260        streamsWatched: 45 + Math.floor(Math.random() * 20),
    261        creatorsFollowed: 12 + Math.floor(Math.random() * 8),
    262        messagesSent: 150 + Math.floor(Math.random() * 100),
    263        reactionsGiven: 300 + Math.floor(Math.random() * 200),
    264      },
    
  • L263

    ts
    261        creatorsFollowed: 12 + Math.floor(Math.random() * 8),
    262        messagesSent: 150 + Math.floor(Math.random() * 100),
    263        reactionsGiven: 300 + Math.floor(Math.random() * 200),
    264      },
    265      favoriteCreators: Array.from({ length: 5 }, (_, i) => ({
    
  • L277

    ts
    275        timestamp: new Date(end.getTime() - i * 3600000).toISOString(),
    276        details: {
    277          creatorUsername: `Creator${Math.floor(Math.random() * 10)}`,
    278          streamId: `stream-${Math.floor(Math.random() * 100)}`,
    279        },
    
  • L278

    ts
    276        details: {
    277          creatorUsername: `Creator${Math.floor(Math.random() * 10)}`,
    278          streamId: `stream-${Math.floor(Math.random() * 100)}`,
    279        },
    280      })),
    
  • L343

    ts
    341    const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    342
    343    const totalRevenue = 500000 + Math.random() * 200000;
    344    const activeUsers = 75000 + Math.floor(Math.random() * 25000);
    345    const activeCreators = 1500 + Math.floor(Math.random() * 500);
    
  • L344

    ts
    342
    343    const totalRevenue = 500000 + Math.random() * 200000;
    344    const activeUsers = 75000 + Math.floor(Math.random() * 25000);
    345    const activeCreators = 1500 + Math.floor(Math.random() * 500);
    346    const liveStreams = 150 + Math.floor(Math.random() * 50);
    
  • L345

    ts
    343    const totalRevenue = 500000 + Math.random() * 200000;
    344    const activeUsers = 75000 + Math.floor(Math.random() * 25000);
    345    const activeCreators = 1500 + Math.floor(Math.random() * 500);
    346    const liveStreams = 150 + Math.floor(Math.random() * 50);
    347
    
  • L346

    ts
    344    const activeUsers = 75000 + Math.floor(Math.random() * 25000);
    345    const activeCreators = 1500 + Math.floor(Math.random() * 500);
    346    const liveStreams = 150 + Math.floor(Math.random() * 50);
    347
    348    const dashboard = {
    
  • L388

    ts
    386      systemHealth: {
    387        timestamp: new Date().toISOString(),
    388        cpu: { usage: 45 + Math.random() * 20, load: [2.1, 2.3, 2.5] },
    389        memory: {
    390          used: 32 * 1024 * 1024 * 1024,
    
  • L392

    ts
    390          used: 32 * 1024 * 1024 * 1024,
    391          total: 64 * 1024 * 1024 * 1024,
    392          percentage: 50 + Math.random() * 10,
    393        },
    394        disk: {
    
  • L397

    ts
    395          used: 500 * 1024 * 1024 * 1024,
    396          total: 1000 * 1024 * 1024 * 1024,
    397          percentage: 50 + Math.random() * 10,
    398        },
    399        network: {
    
  • L425

    ts
    423        arpu: totalRevenue / activeUsers,
    424        ltv: (totalRevenue / activeUsers) * 6,
    425        churnRate: 0.06 + Math.random() * 0.02,
    426        conversionRate: 0.12 + Math.random() * 0.03,
    427        avgSessionDuration: 35 * 60,
    
  • L426

    ts
    424        ltv: (totalRevenue / activeUsers) * 6,
    425        churnRate: 0.06 + Math.random() * 0.02,
    426        conversionRate: 0.12 + Math.random() * 0.03,
    427        avgSessionDuration: 35 * 60,
    428      },
    
  • L461

    ts
    459      timestamp: new Date().toISOString(),
    460      live: {
    461        activeStreams: 150 + Math.floor(Math.random() * 50),
    462        totalViewers: 25000 + Math.floor(Math.random() * 10000),
    463        activeConnections: 35000 + Math.floor(Math.random() * 15000),
    
  • L462

    ts
    460      live: {
    461        activeStreams: 150 + Math.floor(Math.random() * 50),
    462        totalViewers: 25000 + Math.floor(Math.random() * 10000),
    463        activeConnections: 35000 + Math.floor(Math.random() * 15000),
    464        messagesPerMinute: 500 + Math.floor(Math.random() * 200),
    
  • L463

    ts
    461        activeStreams: 150 + Math.floor(Math.random() * 50),
    462        totalViewers: 25000 + Math.floor(Math.random() * 10000),
    463        activeConnections: 35000 + Math.floor(Math.random() * 15000),
    464        messagesPerMinute: 500 + Math.floor(Math.random() * 200),
    465        tipsPerMinute: 50 + Math.floor(Math.random() * 30),
    
  • L464

    ts
    462        totalViewers: 25000 + Math.floor(Math.random() * 10000),
    463        activeConnections: 35000 + Math.floor(Math.random() * 15000),
    464        messagesPerMinute: 500 + Math.floor(Math.random() * 200),
    465        tipsPerMinute: 50 + Math.floor(Math.random() * 30),
    466        revenuePerMinute: 800 + Math.floor(Math.random() * 400),
    
  • L465

    ts
    463        activeConnections: 35000 + Math.floor(Math.random() * 15000),
    464        messagesPerMinute: 500 + Math.floor(Math.random() * 200),
    465        tipsPerMinute: 50 + Math.floor(Math.random() * 30),
    466        revenuePerMinute: 800 + Math.floor(Math.random() * 400),
    467      },
    
  • L466

    ts
    464        messagesPerMinute: 500 + Math.floor(Math.random() * 200),
    465        tipsPerMinute: 50 + Math.floor(Math.random() * 30),
    466        revenuePerMinute: 800 + Math.floor(Math.random() * 400),
    467      },
    468      trending: {
    
  • L486

    ts
    484        timestamp: new Date(Date.now() - i * 5000).toISOString(),
    485        data: {
    486          amount: i % 4 === 0 ? 10 + Math.floor(Math.random() * 50) : undefined,
    487          username: `User${Math.floor(Math.random() * 1000)}`,
    488        },
    
  • L487

    ts
    485        data: {
    486          amount: i % 4 === 0 ? 10 + Math.floor(Math.random() * 50) : undefined,
    487          username: `User${Math.floor(Math.random() * 1000)}`,
    488        },
    489      })),
    

apps/aphrodite/analytics-dashboard/src/routes/engagement.ts#

  • L79

    ts
    77
    78    // Generate chat engagement
    79    const totalMessages = 500000 + Math.floor(Math.random() * 200000);
    80    const uniqueChatters = Math.floor(totalMessages / 15);
    81    const chat: ChatEngagement = {
    
  • L85

    ts
    83      uniqueChatters,
    84      messagesPerViewer: totalMessages / uniqueChatters,
    85      avgMessageLength: 25 + Math.floor(Math.random() * 20),
    86      peakMessagesPerMinute: 150 + Math.floor(Math.random() * 100),
    87      emoticonUsage: 0.35 + Math.random() * 0.2,
    
  • L86

    ts
    84      messagesPerViewer: totalMessages / uniqueChatters,
    85      avgMessageLength: 25 + Math.floor(Math.random() * 20),
    86      peakMessagesPerMinute: 150 + Math.floor(Math.random() * 100),
    87      emoticonUsage: 0.35 + Math.random() * 0.2,
    88      mentionCount: Math.floor(totalMessages * 0.08),
    
  • L87

    ts
    85      avgMessageLength: 25 + Math.floor(Math.random() * 20),
    86      peakMessagesPerMinute: 150 + Math.floor(Math.random() * 100),
    87      emoticonUsage: 0.35 + Math.random() * 0.2,
    88      mentionCount: Math.floor(totalMessages * 0.08),
    89      moderationActions: Math.floor(totalMessages * 0.002),
    
  • L94

    ts
    92        username: `Chatter${i + 1}`,
    93        messageCount: Math.floor(1000 - i * 80),
    94        avgLength: 20 + Math.floor(Math.random() * 30),
    95      })),
    96    };
    
  • L99

    ts
    97
    98    // Generate tip engagement
    99    const totalTipAmount = 150000 + Math.floor(Math.random() * 50000);
    100    const tipCount = Math.floor(totalTipAmount / 25);
    101    const uniqueTippers = Math.floor(tipCount * 0.4);
    
  • L108

    ts
    106      avgTipAmount: totalTipAmount / tipCount,
    107      medianTipAmount: 15,
    108      maxTipAmount: 500 + Math.floor(Math.random() * 500),
    109      tipperRate: uniqueTippers / (uniqueChatters * 2),
    110      distribution: [
    
  • L123

    ts
    121        totalAmount: Math.floor(totalTipAmount * 0.15 * (1 - i * 0.08)),
    122        tipCount: Math.floor(50 - i * 4),
    123        avgTip: 25 + Math.floor(Math.random() * 50),
    124      })),
    125      hourlyPattern: Array.from({ length: 24 }, (_, hour) => ({
    
  • L138

    ts
    136    // Generate social engagement
    137    const social: SocialEngagement = {
    138      newFollowers: 5000 + Math.floor(Math.random() * 2000),
    139      unfollowers: 500 + Math.floor(Math.random() * 200),
    140      netFollowerChange: 4500 + Math.floor(Math.random() * 1800),
    
  • L139

    ts
    137    const social: SocialEngagement = {
    138      newFollowers: 5000 + Math.floor(Math.random() * 2000),
    139      unfollowers: 500 + Math.floor(Math.random() * 200),
    140      netFollowerChange: 4500 + Math.floor(Math.random() * 1800),
    141      followRate: 0.12 + Math.random() * 0.05,
    
  • L140

    ts
    138      newFollowers: 5000 + Math.floor(Math.random() * 2000),
    139      unfollowers: 500 + Math.floor(Math.random() * 200),
    140      netFollowerChange: 4500 + Math.floor(Math.random() * 1800),
    141      followRate: 0.12 + Math.random() * 0.05,
    142      totalReactions: totalMessages * 1.5,
    
  • L141

    ts
    139      unfollowers: 500 + Math.floor(Math.random() * 200),
    140      netFollowerChange: 4500 + Math.floor(Math.random() * 1800),
    141      followRate: 0.12 + Math.random() * 0.05,
    142      totalReactions: totalMessages * 1.5,
    143      reactionsByType: {
    
  • L157

    ts
    155    // Generate device engagement
    156    const devices: DeviceEngagement = {
    157      activeDeviceSessions: 2000 + Math.floor(Math.random() * 1000),
    158      uniqueDeviceUsers: 1500 + Math.floor(Math.random() * 500),
    159      avgSessionDuration: 25 * 60 + Math.floor(Math.random() * 15 * 60),
    
  • L158

    ts
    156    const devices: DeviceEngagement = {
    157      activeDeviceSessions: 2000 + Math.floor(Math.random() * 1000),
    158      uniqueDeviceUsers: 1500 + Math.floor(Math.random() * 500),
    159      avgSessionDuration: 25 * 60 + Math.floor(Math.random() * 15 * 60),
    160      tipTriggeredCommands: tipCount * 0.6,
    
  • L159

    ts
    157      activeDeviceSessions: 2000 + Math.floor(Math.random() * 1000),
    158      uniqueDeviceUsers: 1500 + Math.floor(Math.random() * 500),
    159      avgSessionDuration: 25 * 60 + Math.floor(Math.random() * 15 * 60),
    160      tipTriggeredCommands: tipCount * 0.6,
    161      manualCommands: Math.floor(tipCount * 0.4),
    
  • L178

    ts
    176    const trend = Array.from({ length: pointCount }, (_, i) => {
    177      const pointTime = new Date(start.getTime() + i * intervalMs);
    178      const multiplier = 0.8 + Math.random() * 0.4;
    179      return {
    180        timestamp: pointTime.toISOString(),
    
  • L181

    ts
    179      return {
    180        timestamp: pointTime.toISOString(),
    181        engagementRate: (0.3 + Math.random() * 0.2) * multiplier,
    182        messages: Math.floor((totalMessages / pointCount) * multiplier),
    183        tips: Math.floor((tipCount / pointCount) * multiplier),
    
  • L194

    ts
    192      },
    193      summary: {
    194        overallEngagementRate: 0.35 + Math.random() * 0.1,
    195        interactionsPerViewer:
    196          (totalMessages + tipCount + social.totalReactions) / (uniqueChatters * 2),
    
  • L197

    ts
    195        interactionsPerViewer:
    196          (totalMessages + tipCount + social.totalReactions) / (uniqueChatters * 2),
    197        avgSessionEngagement: 0.45 + Math.random() * 0.15,
    198        topEngagementHour: 21,
    199      },
    
  • L237

    ts
    235    const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    236
    237    const totalMessages = 500000 + Math.floor(Math.random() * 200000);
    238    const uniqueChatters = Math.floor(totalMessages / 15);
    239
    
  • L318

    ts
    316        username: `ActiveChatter${i + 1}`,
    317        messageCount: Math.floor(1500 - i * 65),
    318        avgLength: 20 + Math.floor(Math.random() * 25),
    319        emoticonRate: 0.3 + Math.random() * 0.3,
    320        engagementScore: 0.9 - i * 0.03,
    
  • L319

    ts
    317        messageCount: Math.floor(1500 - i * 65),
    318        avgLength: 20 + Math.floor(Math.random() * 25),
    319        emoticonRate: 0.3 + Math.random() * 0.3,
    320        engagementScore: 0.9 - i * 0.03,
    321      })),
    
  • L351

    ts
    349    const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    350
    351    const totalAmount = 150000 + Math.floor(Math.random() * 50000);
    352    const tipCount = Math.floor(totalAmount / 25);
    353    const uniqueTippers = Math.floor(tipCount * 0.4);
    
  • L476

    ts
    474        totalAmount: Math.floor(totalAmount * 0.4 * (0.15 - i * 0.006)),
    475        tipCount: Math.floor(100 - i * 4),
    476        avgTip: 35 + Math.random() * 40,
    477        maxTip: 100 + Math.floor(Math.random() * 500),
    478        lastTip: new Date(end.getTime() - Math.random() * 7 * 24 * 60 * 60 * 1000).toISOString(),
    
  • L477

    ts
    475        tipCount: Math.floor(100 - i * 4),
    476        avgTip: 35 + Math.random() * 40,
    477        maxTip: 100 + Math.floor(Math.random() * 500),
    478        lastTip: new Date(end.getTime() - Math.random() * 7 * 24 * 60 * 60 * 1000).toISOString(),
    479        isMember: Math.random() > 0.3,
    
  • L478

    ts
    476        avgTip: 35 + Math.random() * 40,
    477        maxTip: 100 + Math.floor(Math.random() * 500),
    478        lastTip: new Date(end.getTime() - Math.random() * 7 * 24 * 60 * 60 * 1000).toISOString(),
    479        isMember: Math.random() > 0.3,
    480      })),
    
  • L479

    ts
    477        maxTip: 100 + Math.floor(Math.random() * 500),
    478        lastTip: new Date(end.getTime() - Math.random() * 7 * 24 * 60 * 60 * 1000).toISOString(),
    479        isMember: Math.random() > 0.3,
    480      })),
    481      triggers: {
    
  • L532

    ts
    530    const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    531
    532    const newFollowers = 5000 + Math.floor(Math.random() * 2000);
    533    const unfollowers = 500 + Math.floor(Math.random() * 200);
    534    const totalReactions = 750000 + Math.floor(Math.random() * 250000);
    
  • L533

    ts
    531
    532    const newFollowers = 5000 + Math.floor(Math.random() * 2000);
    533    const unfollowers = 500 + Math.floor(Math.random() * 200);
    534    const totalReactions = 750000 + Math.floor(Math.random() * 250000);
    535
    
  • L534

    ts
    532    const newFollowers = 5000 + Math.floor(Math.random() * 2000);
    533    const unfollowers = 500 + Math.floor(Math.random() * 200);
    534    const totalReactions = 750000 + Math.floor(Math.random() * 250000);
    535
    536    const socialAnalytics = {
    
  • L542

    ts
    540      },
    541      followers: {
    542        total: 150000 + Math.floor(Math.random() * 50000),
    543        new: newFollowers,
    544        lost: unfollowers,
    
  • L555

    ts
    553        trend: Array.from({ length: 30 }, (_, i) => ({
    554          date: new Date(start.getTime() + i * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
    555          new: Math.floor((newFollowers / 30) * (0.8 + Math.random() * 0.4)),
    556          lost: Math.floor((unfollowers / 30) * (0.8 + Math.random() * 0.4)),
    557        })),
    
  • L556

    ts
    554          date: new Date(start.getTime() + i * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
    555          new: Math.floor((newFollowers / 30) * (0.8 + Math.random() * 0.4)),
    556          lost: Math.floor((unfollowers / 30) * (0.8 + Math.random() * 0.4)),
    557        })),
    558      },
    
  • L573

    ts
    571      },
    572      shares: {
    573        total: 8000 + Math.floor(Math.random() * 3000),
    574        byPlatform: {
    575          twitter: 0.35,
    
  • L584

    ts
    582      },
    583      mentions: {
    584        total: 15000 + Math.floor(Math.random() * 5000),
    585        positive: 0.75,
    586        neutral: 0.2,
    
  • L633

    ts
    631    const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    632
    633    const activeSessions = 2500 + Math.floor(Math.random() * 1000);
    634    const uniqueUsers = Math.floor(activeSessions * 0.6);
    635    const totalRevenue = 75000 + Math.floor(Math.random() * 25000);
    
  • L635

    ts
    633    const activeSessions = 2500 + Math.floor(Math.random() * 1000);
    634    const uniqueUsers = Math.floor(activeSessions * 0.6);
    635    const totalRevenue = 75000 + Math.floor(Math.random() * 25000);
    636
    637    const deviceAnalytics = {
    
  • L719

    ts
    717        sessions: Math.floor(activeSessions * (0.1 - i * 0.008)),
    718        revenue: Math.floor(totalRevenue * (0.12 - i * 0.01)),
    719        avgSessionDuration: 25 + Math.floor(Math.random() * 15),
    720        deviceType: ['Lovense', 'Kiiroo', 'OhMiBod'][i % 3],
    721      })),
    
  • L751

    ts
    749      timestamp: new Date().toISOString(),
    750      current: {
    751        activeViewers: 15000 + Math.floor(Math.random() * 5000),
    752        activeChatters: 3000 + Math.floor(Math.random() * 1000),
    753        messagesPerMinute: 150 + Math.floor(Math.random() * 50),
    
  • L752

    ts
    750      current: {
    751        activeViewers: 15000 + Math.floor(Math.random() * 5000),
    752        activeChatters: 3000 + Math.floor(Math.random() * 1000),
    753        messagesPerMinute: 150 + Math.floor(Math.random() * 50),
    754        tipsPerMinute: 25 + Math.floor(Math.random() * 15),
    
  • L753

    ts
    751        activeViewers: 15000 + Math.floor(Math.random() * 5000),
    752        activeChatters: 3000 + Math.floor(Math.random() * 1000),
    753        messagesPerMinute: 150 + Math.floor(Math.random() * 50),
    754        tipsPerMinute: 25 + Math.floor(Math.random() * 15),
    755        revenuePerMinute: 450 + Math.floor(Math.random() * 200),
    
  • L754

    ts
    752        activeChatters: 3000 + Math.floor(Math.random() * 1000),
    753        messagesPerMinute: 150 + Math.floor(Math.random() * 50),
    754        tipsPerMinute: 25 + Math.floor(Math.random() * 15),
    755        revenuePerMinute: 450 + Math.floor(Math.random() * 200),
    756        activeDeviceSessions: 500 + Math.floor(Math.random() * 200),
    
  • L755

    ts
    753        messagesPerMinute: 150 + Math.floor(Math.random() * 50),
    754        tipsPerMinute: 25 + Math.floor(Math.random() * 15),
    755        revenuePerMinute: 450 + Math.floor(Math.random() * 200),
    756        activeDeviceSessions: 500 + Math.floor(Math.random() * 200),
    757      },
    
  • L756

    ts
    754        tipsPerMinute: 25 + Math.floor(Math.random() * 15),
    755        revenuePerMinute: 450 + Math.floor(Math.random() * 200),
    756        activeDeviceSessions: 500 + Math.floor(Math.random() * 200),
    757      },
    758      trends: {
    
  • L761

    ts
    759        viewersTrend: Array.from({ length: 60 }, (_, i) => ({
    760          minute: i,
    761          count: 14000 + Math.floor(Math.random() * 2000),
    762        })),
    763        messagesTrend: Array.from({ length: 60 }, (_, i) => ({
    
  • L765

    ts
    763        messagesTrend: Array.from({ length: 60 }, (_, i) => ({
    764          minute: i,
    765          count: 140 + Math.floor(Math.random() * 30),
    766        })),
    767        tipsTrend: Array.from({ length: 60 }, (_, i) => ({
    
  • L769

    ts
    767        tipsTrend: Array.from({ length: 60 }, (_, i) => ({
    768          minute: i,
    769          count: 20 + Math.floor(Math.random() * 15),
    770          amount: 350 + Math.floor(Math.random() * 200),
    771        })),
    
  • L770

    ts
    768          minute: i,
    769          count: 20 + Math.floor(Math.random() * 15),
    770          amount: 350 + Math.floor(Math.random() * 200),
    771        })),
    772      },
    
  • L783

    ts
    781      recentTips: Array.from({ length: 20 }, (_, i) => ({
    782        id: `tip-${i + 1}`,
    783        amount: 5 + Math.floor(Math.random() * 100),
    784        username: `Tipper${i + 1}`,
    785        creatorUsername: `Creator${Math.floor(Math.random() * 10) + 1}`,
    
  • L785

    ts
    783        amount: 5 + Math.floor(Math.random() * 100),
    784        username: `Tipper${i + 1}`,
    785        creatorUsername: `Creator${Math.floor(Math.random() * 10) + 1}`,
    786        timestamp: new Date(Date.now() - i * 15000).toISOString(),
    787        message: Math.random() > 0.5 ? 'Great stream!' : undefined,
    
  • L787

    ts
    785        creatorUsername: `Creator${Math.floor(Math.random() * 10) + 1}`,
    786        timestamp: new Date(Date.now() - i * 15000).toISOString(),
    787        message: Math.random() > 0.5 ? 'Great stream!' : undefined,
    788      })),
    789      alerts: [],
    

apps/aphrodite/analytics-dashboard/src/routes/exports.ts#

  • L49

    ts
    47      exportRequest.expiresAt = new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString();
    48      exportRequest.metadata = {
    49        rowCount: 1500 + Math.floor(Math.random() * 1000),
    50        fileSize: 1024 * 1024 * (1 + Math.random() * 5),
    51      };
    
  • L50

    ts
    48      exportRequest.metadata = {
    49        rowCount: 1500 + Math.floor(Math.random() * 1000),
    50        fileSize: 1024 * 1024 * (1 + Math.random() * 5),
    51      };
    52    }, 2000);
    
  • L110

    ts
    108            status === 'completed'
    109              ? {
    110                  rowCount: 1000 + Math.floor(Math.random() * 2000),
    111                  fileSize: 1024 * 1024 * (0.5 + Math.random() * 5),
    112                }
    
  • L111

    ts
    109              ? {
    110                  rowCount: 1000 + Math.floor(Math.random() * 2000),
    111                  fileSize: 1024 * 1024 * (0.5 + Math.random() * 5),
    112                }
    113              : {},
    
  • L205

    ts
    203    const data = Array.from({ length: 100 }, (_, i) => ({
    204      date: new Date(Date.now() - i * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
    205      total: 5000 + Math.random() * 3000,
    206      tips: 2000 + Math.random() * 1500,
    207      subscriptions: 1500 + Math.random() * 1000,
    
  • L206

    ts
    204      date: new Date(Date.now() - i * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
    205      total: 5000 + Math.random() * 3000,
    206      tips: 2000 + Math.random() * 1500,
    207      subscriptions: 1500 + Math.random() * 1000,
    208      contentSales: 500 + Math.random() * 500,
    
  • L207

    ts
    205      total: 5000 + Math.random() * 3000,
    206      tips: 2000 + Math.random() * 1500,
    207      subscriptions: 1500 + Math.random() * 1000,
    208      contentSales: 500 + Math.random() * 500,
    209      privateShows: 300 + Math.random() * 300,
    
  • L208

    ts
    206      tips: 2000 + Math.random() * 1500,
    207      subscriptions: 1500 + Math.random() * 1000,
    208      contentSales: 500 + Math.random() * 500,
    209      privateShows: 300 + Math.random() * 300,
    210      tokens: 200 + Math.random() * 200,
    
  • L209

    ts
    207      subscriptions: 1500 + Math.random() * 1000,
    208      contentSales: 500 + Math.random() * 500,
    209      privateShows: 300 + Math.random() * 300,
    210      tokens: 200 + Math.random() * 200,
    211    }));
    
  • L210

    ts
    208      contentSales: 500 + Math.random() * 500,
    209      privateShows: 300 + Math.random() * 300,
    210      tokens: 200 + Math.random() * 200,
    211    }));
    212
    
  • L241

    ts
    239    const data = Array.from({ length: 100 }, (_, i) => ({
    240      date: new Date(Date.now() - i * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
    241      total: 3000 + Math.floor(Math.random() * 2000),
    242      unique: 2000 + Math.floor(Math.random() * 1500),
    243      new: 300 + Math.floor(Math.random() * 200),
    
  • L242

    ts
    240      date: new Date(Date.now() - i * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
    241      total: 3000 + Math.floor(Math.random() * 2000),
    242      unique: 2000 + Math.floor(Math.random() * 1500),
    243      new: 300 + Math.floor(Math.random() * 200),
    244      returning: 1700 + Math.floor(Math.random() * 1300),
    
  • L243

    ts
    241      total: 3000 + Math.floor(Math.random() * 2000),
    242      unique: 2000 + Math.floor(Math.random() * 1500),
    243      new: 300 + Math.floor(Math.random() * 200),
    244      returning: 1700 + Math.floor(Math.random() * 1300),
    245      avgWatchTime: 30 + Math.floor(Math.random() * 30),
    
  • L244

    ts
    242      unique: 2000 + Math.floor(Math.random() * 1500),
    243      new: 300 + Math.floor(Math.random() * 200),
    244      returning: 1700 + Math.floor(Math.random() * 1300),
    245      avgWatchTime: 30 + Math.floor(Math.random() * 30),
    246      peakConcurrent: 500 + Math.floor(Math.random() * 400),
    
  • L245

    ts
    243      new: 300 + Math.floor(Math.random() * 200),
    244      returning: 1700 + Math.floor(Math.random() * 1300),
    245      avgWatchTime: 30 + Math.floor(Math.random() * 30),
    246      peakConcurrent: 500 + Math.floor(Math.random() * 400),
    247    }));
    
  • L246

    ts
    244      returning: 1700 + Math.floor(Math.random() * 1300),
    245      avgWatchTime: 30 + Math.floor(Math.random() * 30),
    246      peakConcurrent: 500 + Math.floor(Math.random() * 400),
    247    }));
    248
    
  • L276

    ts
    274    const data = Array.from({ length: 100 }, (_, i) => ({
    275      date: new Date(Date.now() - i * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
    276      messages: 15000 + Math.floor(Math.random() * 10000),
    277      chatters: 2000 + Math.floor(Math.random() * 1500),
    278      tips: 500 + Math.floor(Math.random() * 400),
    
  • L277

    ts
    275      date: new Date(Date.now() - i * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
    276      messages: 15000 + Math.floor(Math.random() * 10000),
    277      chatters: 2000 + Math.floor(Math.random() * 1500),
    278      tips: 500 + Math.floor(Math.random() * 400),
    279      tippers: 150 + Math.floor(Math.random() * 100),
    
  • L278

    ts
    276      messages: 15000 + Math.floor(Math.random() * 10000),
    277      chatters: 2000 + Math.floor(Math.random() * 1500),
    278      tips: 500 + Math.floor(Math.random() * 400),
    279      tippers: 150 + Math.floor(Math.random() * 100),
    280      reactions: 8000 + Math.floor(Math.random() * 5000),
    
  • L279

    ts
    277      chatters: 2000 + Math.floor(Math.random() * 1500),
    278      tips: 500 + Math.floor(Math.random() * 400),
    279      tippers: 150 + Math.floor(Math.random() * 100),
    280      reactions: 8000 + Math.floor(Math.random() * 5000),
    281      follows: 200 + Math.floor(Math.random() * 150),
    
  • L280

    ts
    278      tips: 500 + Math.floor(Math.random() * 400),
    279      tippers: 150 + Math.floor(Math.random() * 100),
    280      reactions: 8000 + Math.floor(Math.random() * 5000),
    281      follows: 200 + Math.floor(Math.random() * 150),
    282      engagementRate: 0.3 + Math.random() * 0.2,
    
  • L281

    ts
    279      tippers: 150 + Math.floor(Math.random() * 100),
    280      reactions: 8000 + Math.floor(Math.random() * 5000),
    281      follows: 200 + Math.floor(Math.random() * 150),
    282      engagementRate: 0.3 + Math.random() * 0.2,
    283    }));
    
  • L282

    ts
    280      reactions: 8000 + Math.floor(Math.random() * 5000),
    281      follows: 200 + Math.floor(Math.random() * 150),
    282      engagementRate: 0.3 + Math.random() * 0.2,
    283    }));
    284
    

apps/aphrodite/analytics-dashboard/src/routes/health.ts#

  • L84

    ts
    82      database: {
    83        status: 'healthy',
    84        latency: 5 + Math.random() * 10,
    85        connections: {
    86          active: 10,
    
  • L93

    ts
    91      cache: {
    92        status: 'healthy',
    93        latency: 1 + Math.random() * 3,
    94        hitRate: 0.85 + Math.random() * 0.1,
    95      },
    
  • L94

    ts
    92        status: 'healthy',
    93        latency: 1 + Math.random() * 3,
    94        hitRate: 0.85 + Math.random() * 0.1,
    95      },
    96      analyticsEngine: {
    
  • L98

    ts
    96      analyticsEngine: {
    97        status: 'healthy',
    98        latency: 10 + Math.random() * 20,
    99        queueSize: Math.floor(Math.random() * 100),
    100      },
    
  • L99

    ts
    97        status: 'healthy',
    98        latency: 10 + Math.random() * 20,
    99        queueSize: Math.floor(Math.random() * 100),
    100      },
    101      websocket: {
    
  • L103

    ts
    101      websocket: {
    102        status: 'healthy',
    103        connections: 500 + Math.floor(Math.random() * 200),
    104      },
    105    };
    
  • L116

    ts
    114      metrics: {
    115        requests: {
    116          total: 1000000 + Math.floor(Math.random() * 500000),
    117          perSecond: 150 + Math.floor(Math.random() * 50),
    118          errorRate: 0.001 + Math.random() * 0.002,
    
  • L117

    ts
    115        requests: {
    116          total: 1000000 + Math.floor(Math.random() * 500000),
    117          perSecond: 150 + Math.floor(Math.random() * 50),
    118          errorRate: 0.001 + Math.random() * 0.002,
    119        },
    
  • L118

    ts
    116          total: 1000000 + Math.floor(Math.random() * 500000),
    117          perSecond: 150 + Math.floor(Math.random() * 50),
    118          errorRate: 0.001 + Math.random() * 0.002,
    119        },
    120        memory: {
    

apps/aphrodite/analytics-dashboard/src/routes/predictions.ts#

  • L584

    ts
    582
    583    const count = Math.floor((days * 24 * 60 * 60 * 1000) / intervalMs);
    584    const baseValue = 1000 + Math.random() * 2000;
    585    const trend = 1 + Math.random() * 0.001;
    586    const seasonalAmplitude = 0.3;
    
  • L585

    ts
    583    const count = Math.floor((days * 24 * 60 * 60 * 1000) / intervalMs);
    584    const baseValue = 1000 + Math.random() * 2000;
    585    const trend = 1 + Math.random() * 0.001;
    586    const seasonalAmplitude = 0.3;
    587
    
  • L592

    ts
    590      const trendFactor = Math.pow(trend, i);
    591      const seasonalFactor = 1 + seasonalAmplitude * Math.sin((2 * Math.PI * i) / (count / 4));
    592      const noise = 0.9 + Math.random() * 0.2;
    593      const value = baseValue * trendFactor * seasonalFactor * noise;
    594
    
  • L611

    ts
    609
    610    for (let i = 0; i < streamCount; i++) {
    611      const startTime = new Date(now.getTime() - Math.random() * days * 24 * 60 * 60 * 1000);
    612      const duration = 1 + Math.floor(Math.random() * 4);
    613      const endTime = new Date(startTime.getTime() + duration * 60 * 60 * 1000);
    
  • L612

    ts
    610    for (let i = 0; i < streamCount; i++) {
    611      const startTime = new Date(now.getTime() - Math.random() * days * 24 * 60 * 60 * 1000);
    612      const duration = 1 + Math.floor(Math.random() * 4);
    613      const endTime = new Date(startTime.getTime() + duration * 60 * 60 * 1000);
    614      const peakViewers = 50 + Math.floor(Math.random() * 500);
    
  • L614

    ts
    612      const duration = 1 + Math.floor(Math.random() * 4);
    613      const endTime = new Date(startTime.getTime() + duration * 60 * 60 * 1000);
    614      const peakViewers = 50 + Math.floor(Math.random() * 500);
    615      const averageViewers = Math.floor(peakViewers * (0.4 + Math.random() * 0.3));
    616
    
  • L615

    ts
    613      const endTime = new Date(startTime.getTime() + duration * 60 * 60 * 1000);
    614      const peakViewers = 50 + Math.floor(Math.random() * 500);
    615      const averageViewers = Math.floor(peakViewers * (0.4 + Math.random() * 0.3));
    616
    617      streams.push({
    
  • L623

    ts
    621        peakViewers,
    622        averageViewers,
    623        totalRevenue: averageViewers * (0.5 + Math.random() * 1.5),
    624        category: ['gaming', 'irl', 'creative', 'music'][Math.floor(Math.random() * 4)],
    625      });
    
  • L624

    ts
    622        averageViewers,
    623        totalRevenue: averageViewers * (0.5 + Math.random() * 1.5),
    624        category: ['gaming', 'irl', 'creative', 'music'][Math.floor(Math.random() * 4)],
    625      });
    626    }
    
  • L633

    ts
    631  function generateCompetitorSchedules(slotQualityModel: ISlotQualityModel) {
    632    return Array.from({ length: 5 }, (_, i) => {
    633      const category = ['gaming', 'irl', 'creative'][Math.floor(Math.random() * 3)] ?? 'gaming';
    634      return {
    635        creatorId: `competitor-${i + 1}`,
    
  • L638

    ts
    636        category,
    637        typicalSlots: Array.from({ length: 3 }, () => {
    638          const dayOfWeek = Math.floor(Math.random() * 7);
    639          const hour = Math.floor(Math.random() * 24);
    640          const prediction = slotQualityModel.score({ dayOfWeek, hour, category });
    
  • L639

    ts
    637        typicalSlots: Array.from({ length: 3 }, () => {
    638          const dayOfWeek = Math.floor(Math.random() * 7);
    639          const hour = Math.floor(Math.random() * 24);
    640          const prediction = slotQualityModel.score({ dayOfWeek, hour, category });
    641          return {
    
  • L650

    ts
    648          };
    649        }),
    650        viewerOverlap: 0.2 + Math.random() * 0.3,
    651      };
    652    });
    
  • L659

    ts
    657
    658    return Array.from({ length: count }, (_, i) => {
    659      const publishedAt = new Date(now.getTime() - Math.random() * 180 * 24 * 60 * 60 * 1000);
    660      const views = 100 + Math.floor(Math.random() * 10000);
    661      const engagement = 5 + Math.random() * 25;
    
  • L660

    ts
    658    return Array.from({ length: count }, (_, i) => {
    659      const publishedAt = new Date(now.getTime() - Math.random() * 180 * 24 * 60 * 60 * 1000);
    660      const views = 100 + Math.floor(Math.random() * 10000);
    661      const engagement = 5 + Math.random() * 25;
    662      const revenue = views * (0.01 + Math.random() * 0.05);
    
  • L661

    ts
    659      const publishedAt = new Date(now.getTime() - Math.random() * 180 * 24 * 60 * 60 * 1000);
    660      const views = 100 + Math.floor(Math.random() * 10000);
    661      const engagement = 5 + Math.random() * 25;
    662      const revenue = views * (0.01 + Math.random() * 0.05);
    663
    
  • L662

    ts
    660      const views = 100 + Math.floor(Math.random() * 10000);
    661      const engagement = 5 + Math.random() * 25;
    662      const revenue = views * (0.01 + Math.random() * 0.05);
    663
    664      return {
    
  • L669

    ts
    667        publishedAt,
    668        views,
    669        peakViewers: type === 'stream' ? Math.floor(views * (0.1 + Math.random() * 0.2)) : undefined,
    670        averageViewers:
    671          type === 'stream' ? Math.floor(views * (0.05 + Math.random() * 0.1)) : undefined,
    
  • L671

    ts
    669        peakViewers: type === 'stream' ? Math.floor(views * (0.1 + Math.random() * 0.2)) : undefined,
    670        averageViewers:
    671          type === 'stream' ? Math.floor(views * (0.05 + Math.random() * 0.1)) : undefined,
    672        engagement,
    673        revenue,
    
  • L674

    ts
    672        engagement,
    673        revenue,
    674        duration: type === 'stream' ? 60 + Math.floor(Math.random() * 180) : undefined,
    675        title: `Content ${i + 1} - ${['Amazing', 'Epic', 'Special', 'New'][Math.floor(Math.random() * 4)]} ${type}`,
    676        tags: Array.from({ length: 3 + Math.floor(Math.random() * 5) }, (_, j) => `tag${j + 1}`),
    
  • L675

    ts
    673        revenue,
    674        duration: type === 'stream' ? 60 + Math.floor(Math.random() * 180) : undefined,
    675        title: `Content ${i + 1} - ${['Amazing', 'Epic', 'Special', 'New'][Math.floor(Math.random() * 4)]} ${type}`,
    676        tags: Array.from({ length: 3 + Math.floor(Math.random() * 5) }, (_, j) => `tag${j + 1}`),
    677        category: ['gaming', 'irl', 'creative', 'music'][Math.floor(Math.random() * 4)],
    
  • L676

    ts
    674        duration: type === 'stream' ? 60 + Math.floor(Math.random() * 180) : undefined,
    675        title: `Content ${i + 1} - ${['Amazing', 'Epic', 'Special', 'New'][Math.floor(Math.random() * 4)]} ${type}`,
    676        tags: Array.from({ length: 3 + Math.floor(Math.random() * 5) }, (_, j) => `tag${j + 1}`),
    677        category: ['gaming', 'irl', 'creative', 'music'][Math.floor(Math.random() * 4)],
    678        retentionRate: 0.3 + Math.random() * 0.5,
    
  • L677

    ts
    675        title: `Content ${i + 1} - ${['Amazing', 'Epic', 'Special', 'New'][Math.floor(Math.random() * 4)]} ${type}`,
    676        tags: Array.from({ length: 3 + Math.floor(Math.random() * 5) }, (_, j) => `tag${j + 1}`),
    677        category: ['gaming', 'irl', 'creative', 'music'][Math.floor(Math.random() * 4)],
    678        retentionRate: 0.3 + Math.random() * 0.5,
    679      };
    
  • L678

    ts
    676        tags: Array.from({ length: 3 + Math.floor(Math.random() * 5) }, (_, j) => `tag${j + 1}`),
    677        category: ['gaming', 'irl', 'creative', 'music'][Math.floor(Math.random() * 4)],
    678        retentionRate: 0.3 + Math.random() * 0.5,
    679      };
    680    });
    
  • L685

    ts
    683  function generateAudienceData() {
    684    return {
    685      totalFollowers: 5000 + Math.floor(Math.random() * 50000),
    686      activeFollowers: 1000 + Math.floor(Math.random() * 10000),
    687      averageAge: 22 + Math.floor(Math.random() * 10),
    
  • L686

    ts
    684    return {
    685      totalFollowers: 5000 + Math.floor(Math.random() * 50000),
    686      activeFollowers: 1000 + Math.floor(Math.random() * 10000),
    687      averageAge: 22 + Math.floor(Math.random() * 10),
    688      topCountries: [
    
  • L687

    ts
    685      totalFollowers: 5000 + Math.floor(Math.random() * 50000),
    686      activeFollowers: 1000 + Math.floor(Math.random() * 10000),
    687      averageAge: 22 + Math.floor(Math.random() * 10),
    688      topCountries: [
    689        { country: 'US', percentage: 0.4 },
    

apps/aphrodite/analytics-dashboard/src/routes/revenue.ts#

  • L113

    ts
    111      trendPoints.push({
    112        timestamp: pointTime.toISOString(),
    113        total: Math.random() * 10000,
    114        tips: Math.random() * 4000,
    115        subscriptions: Math.random() * 3000,
    
  • L114

    ts
    112        timestamp: pointTime.toISOString(),
    113        total: Math.random() * 10000,
    114        tips: Math.random() * 4000,
    115        subscriptions: Math.random() * 3000,
    116        contentSales: Math.random() * 1500,
    
  • L115

    ts
    113        total: Math.random() * 10000,
    114        tips: Math.random() * 4000,
    115        subscriptions: Math.random() * 3000,
    116        contentSales: Math.random() * 1500,
    117        privateShows: Math.random() * 1000,
    
  • L116

    ts
    114        tips: Math.random() * 4000,
    115        subscriptions: Math.random() * 3000,
    116        contentSales: Math.random() * 1500,
    117        privateShows: Math.random() * 1000,
    118        tokens: Math.random() * 500,
    
  • L117

    ts
    115        subscriptions: Math.random() * 3000,
    116        contentSales: Math.random() * 1500,
    117        privateShows: Math.random() * 1000,
    118        tokens: Math.random() * 500,
    119      });
    
  • L118

    ts
    116        contentSales: Math.random() * 1500,
    117        privateShows: Math.random() * 1000,
    118        tokens: Math.random() * 500,
    119      });
    120    }
    
  • L139

    ts
    137
    138    // Previous period comparison
    139    const previousRevenue = totalRevenue * (0.8 + Math.random() * 0.4);
    140    const previousTransactions = transactionCount * (0.8 + Math.random() * 0.4);
    141
    
  • L140

    ts
    138    // Previous period comparison
    139    const previousRevenue = totalRevenue * (0.8 + Math.random() * 0.4);
    140    const previousTransactions = transactionCount * (0.8 + Math.random() * 0.4);
    141
    142    const response: RevenueAnalyticsResponse = {
    
  • L164

    ts
    162          previousRevenue / previousTransactions
    163        ),
    164        payers: calculateGrowth(uniquePayers, uniquePayers * (0.85 + Math.random() * 0.3)),
    165      },
    166      breakdown: {
    
  • L295

    ts
    293        trendPoints.push({
    294          timestamp: pointTime.toISOString(),
    295          total: Math.random() * 1000,
    296          tips: Math.random() * 400,
    297          subscriptions: Math.random() * 300,
    
  • L296

    ts
    294          timestamp: pointTime.toISOString(),
    295          total: Math.random() * 1000,
    296          tips: Math.random() * 400,
    297          subscriptions: Math.random() * 300,
    298          contentSales: Math.random() * 150,
    
  • L297

    ts
    295          total: Math.random() * 1000,
    296          tips: Math.random() * 400,
    297          subscriptions: Math.random() * 300,
    298          contentSales: Math.random() * 150,
    299          privateShows: Math.random() * 100,
    
  • L298

    ts
    296          tips: Math.random() * 400,
    297          subscriptions: Math.random() * 300,
    298          contentSales: Math.random() * 150,
    299          privateShows: Math.random() * 100,
    300          tokens: Math.random() * 50,
    
  • L299

    ts
    297          subscriptions: Math.random() * 300,
    298          contentSales: Math.random() * 150,
    299          privateShows: Math.random() * 100,
    300          tokens: Math.random() * 50,
    301        });
    
  • L300

    ts
    298          contentSales: Math.random() * 150,
    299          privateShows: Math.random() * 100,
    300          tokens: Math.random() * 50,
    301        });
    302      }
    
  • L367

    ts
    365            amount: totalTips * 0.15,
    366            transactions: 45,
    367            lastTransaction: new Date(end.getTime() - Math.random() * 86400000).toISOString(),
    368          },
    369          {
    
  • L375

    ts
    373            amount: totalTips * 0.12,
    374            transactions: 38,
    375            lastTransaction: new Date(end.getTime() - Math.random() * 86400000).toISOString(),
    376          },
    377          {
    
  • L383

    ts
    381            amount: totalTips * 0.1,
    382            transactions: 32,
    383            lastTransaction: new Date(end.getTime() - Math.random() * 86400000).toISOString(),
    384          },
    385          {
    
  • L391

    ts
    389            amount: totalTips * 0.08,
    390            transactions: 25,
    391            lastTransaction: new Date(end.getTime() - Math.random() * 86400000).toISOString(),
    392          },
    393          {
    
  • L399

    ts
    397            amount: totalTips * 0.06,
    398            transactions: 20,
    399            lastTransaction: new Date(end.getTime() - Math.random() * 86400000).toISOString(),
    400          },
    401        ],
    
  • L407

    ts
    405          nextWeek: (net / pointCount) * 7,
    406          nextMonth: (net / pointCount) * 30,
    407          confidence: 0.75 + Math.random() * 0.2,
    408        },
    409      };
    
  • L448

    ts
    446    const sources = ['tips', 'subscriptions', 'content_sales', 'private_shows', 'tokens'] as const;
    447    const breakdown = sources.map((source) => {
    448      const amount = Math.random() * 50000;
    449      const previousAmount = amount * (0.8 + Math.random() * 0.4);
    450      return {
    
  • L449

    ts
    447    const breakdown = sources.map((source) => {
    448      const amount = Math.random() * 50000;
    449      const previousAmount = amount * (0.8 + Math.random() * 0.4);
    450      return {
    451        source,
    
  • L509

    ts
    507    const transactions = Array.from({ length: Math.min(limit, total - offset) }, (_, i) => {
    508      const sources = ['tips', 'subscriptions', 'content_sales', 'private_shows', 'tokens'] as const;
    509      const source = sources[Math.floor(Math.random() * sources.length)];
    510      const amount = source === 'tips' ? 5 + Math.random() * 100 : 10 + Math.random() * 200;
    511      const platformFee = amount * 0.2;
    
  • L510

    ts
    508      const sources = ['tips', 'subscriptions', 'content_sales', 'private_shows', 'tokens'] as const;
    509      const source = sources[Math.floor(Math.random() * sources.length)];
    510      const amount = source === 'tips' ? 5 + Math.random() * 100 : 10 + Math.random() * 200;
    511      const platformFee = amount * 0.2;
    512
    
  • L520

    ts
    518        platformFee,
    519        netAmount: amount - platformFee,
    520        creatorId: `creator-${Math.floor(Math.random() * 50) + 1}`,
    521        creatorUsername: `Creator${Math.floor(Math.random() * 50) + 1}`,
    522        userId: `user-${Math.floor(Math.random() * 1000) + 1}`,
    
  • L521

    ts
    519        netAmount: amount - platformFee,
    520        creatorId: `creator-${Math.floor(Math.random() * 50) + 1}`,
    521        creatorUsername: `Creator${Math.floor(Math.random() * 50) + 1}`,
    522        userId: `user-${Math.floor(Math.random() * 1000) + 1}`,
    523        username: `User${Math.floor(Math.random() * 1000) + 1}`,
    
  • L522

    ts
    520        creatorId: `creator-${Math.floor(Math.random() * 50) + 1}`,
    521        creatorUsername: `Creator${Math.floor(Math.random() * 50) + 1}`,
    522        userId: `user-${Math.floor(Math.random() * 1000) + 1}`,
    523        username: `User${Math.floor(Math.random() * 1000) + 1}`,
    524        streamId:
    
  • L523

    ts
    521        creatorUsername: `Creator${Math.floor(Math.random() * 50) + 1}`,
    522        userId: `user-${Math.floor(Math.random() * 1000) + 1}`,
    523        username: `User${Math.floor(Math.random() * 1000) + 1}`,
    524        streamId:
    525          source !== 'subscriptions' ? `stream-${Math.floor(Math.random() * 200) + 1}` : undefined,
    
  • L525

    ts
    523        username: `User${Math.floor(Math.random() * 1000) + 1}`,
    524        streamId:
    525          source !== 'subscriptions' ? `stream-${Math.floor(Math.random() * 200) + 1}` : undefined,
    526        status: 'completed' as const,
    527        timestamp: new Date(
    
  • L528

    ts
    526        status: 'completed' as const,
    527        timestamp: new Date(
    528          start.getTime() + Math.random() * (end.getTime() - start.getTime())
    529        ).toISOString(),
    530        metadata: {},
    
  • L583

    ts
    581    const daysInPeriod = periodMs / (24 * 60 * 60 * 1000);
    582
    583    const currentRevenue = 50000 + Math.random() * 100000;
    584    const dailyAverage = currentRevenue / daysInPeriod;
    585
    
  • L673

    ts
    671    const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    672
    673    const totalVolume = 500000 + Math.random() * 1000000;
    674    const platformRevenue = totalVolume * 0.2;
    675    const creatorPayouts = totalVolume - platformRevenue;
    
  • L686

    ts
    684        platformRevenue,
    685        creatorPayouts,
    686        activeCreators: Math.floor(1000 + Math.random() * 500),
    687        activeUsers: Math.floor(50000 + Math.random() * 25000),
    688        transactionCount: Math.floor(totalVolume / 25),
    
  • L687

    ts
    685        creatorPayouts,
    686        activeCreators: Math.floor(1000 + Math.random() * 500),
    687        activeUsers: Math.floor(50000 + Math.random() * 25000),
    688        transactionCount: Math.floor(totalVolume / 25),
    689      },
    
  • L752

    ts
    750    const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    751
    752    const activeSubscriptions = 5000 + Math.floor(Math.random() * 2000);
    753    const mrr = activeSubscriptions * 15;
    754    const arr = mrr * 12;
    

apps/aphrodite/analytics-dashboard/src/routes/trends.ts#

  • L103

    ts
    101        metric: 'revenue',
    102        currentPeriod: {
    103          value: 150000 + Math.random() * 50000,
    104          start: start.toISOString(),
    105          end: end.toISOString(),
    
  • L108

    ts
    106        },
    107        previousPeriod: {
    108          value: 140000 + Math.random() * 40000,
    109          start: new Date(start.getTime() - periodMs).toISOString(),
    110          end: start.toISOString(),
    
  • L120

    ts
    118        metric: 'viewers',
    119        currentPeriod: {
    120          value: 75000 + Math.random() * 25000,
    121          start: start.toISOString(),
    122          end: end.toISOString(),
    
  • L125

    ts
    123        },
    124        previousPeriod: {
    125          value: 70000 + Math.random() * 20000,
    126          start: new Date(start.getTime() - periodMs).toISOString(),
    127          end: start.toISOString(),
    
  • L137

    ts
    135        metric: 'engagement',
    136        currentPeriod: {
    137          value: 0.42 + Math.random() * 0.1,
    138          start: start.toISOString(),
    139          end: end.toISOString(),
    
  • L142

    ts
    140        },
    141        previousPeriod: {
    142          value: 0.38 + Math.random() * 0.08,
    143          start: new Date(start.getTime() - periodMs).toISOString(),
    144          end: start.toISOString(),
    
  • L154

    ts
    152        metric: 'tips',
    153        currentPeriod: {
    154          value: 85000 + Math.random() * 30000,
    155          start: start.toISOString(),
    156          end: end.toISOString(),
    
  • L159

    ts
    157        },
    158        previousPeriod: {
    159          value: 80000 + Math.random() * 25000,
    160          start: new Date(start.getTime() - periodMs).toISOString(),
    161          end: start.toISOString(),
    
  • L171

    ts
    169        metric: 'subscriptions',
    170        currentPeriod: {
    171          value: 5500 + Math.random() * 1000,
    172          start: start.toISOString(),
    173          end: end.toISOString(),
    
  • L176

    ts
    174        },
    175        previousPeriod: {
    176          value: 5000 + Math.random() * 800,
    177          start: new Date(start.getTime() - periodMs).toISOString(),
    178          end: start.toISOString(),
    
  • L188

    ts
    186        metric: 'followers',
    187        currentPeriod: {
    188          value: 8000 + Math.random() * 2000,
    189          start: start.toISOString(),
    190          end: end.toISOString(),
    
  • L193

    ts
    191        },
    192        previousPeriod: {
    193          value: 7200 + Math.random() * 1500,
    194          start: new Date(start.getTime() - periodMs).toISOString(),
    195          end: start.toISOString(),
    
  • L354

    ts
    352        factor:
    353          hour >= 20 || hour <= 2
    354            ? 1.5 + Math.random() * 0.5
    355            : hour >= 8 && hour <= 17
    356              ? 0.5 + Math.random() * 0.2
    
  • L356

    ts
    354            ? 1.5 + Math.random() * 0.5
    355            : hour >= 8 && hour <= 17
    356              ? 0.5 + Math.random() * 0.2
    357              : 1 + Math.random() * 0.2,
    358      })),
    
  • L357

    ts
    355            : hour >= 8 && hour <= 17
    356              ? 0.5 + Math.random() * 0.2
    357              : 1 + Math.random() * 0.2,
    358      })),
    359      weekly: [
    
  • L423

    ts
    421
    422    const generateMetricData = (base: number, variance: number) => ({
    423      period1: base + Math.random() * variance,
    424      period2: base * 0.9 + Math.random() * variance * 0.8,
    425    });
    
  • L424

    ts
    422    const generateMetricData = (base: number, variance: number) => ({
    423      period1: base + Math.random() * variance,
    424      period2: base * 0.9 + Math.random() * variance * 0.8,
    425    });
    426
    
  • L517

    ts
    515      const baseValue = metric === 'revenue' ? 150000 : metric === 'viewers' ? 75000 : 0.42;
    516      const volatility = metric === 'revenue' ? 0.15 : metric === 'viewers' ? 0.12 : 0.08;
    517      const growthRate = 0.02 + Math.random() * 0.03;
    518
    519      const historical = Array.from({ length: 30 }, (_, i) => ({
    
  • L521

    ts
    519      const historical = Array.from({ length: 30 }, (_, i) => ({
    520        date: new Date(start.getTime() - (30 - i) * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
    521        value: baseValue * (0.9 + Math.random() * 0.2) * (1 + (i * growthRate) / 30),
    522      }));
    523
    
  • L599

    ts
    597      const metric = metrics[i % metrics.length];
    598      const severities = ['low', 'medium', 'high', 'critical'] as const;
    599      const severity = severities[Math.floor(Math.random() * 3)];
    600      const isPositive = Math.random() > 0.3;
    601
    
  • L600

    ts
    598      const severities = ['low', 'medium', 'high', 'critical'] as const;
    599      const severity = severities[Math.floor(Math.random() * 3)];
    600      const isPositive = Math.random() > 0.3;
    601
    602      return {
    
  • L605

    ts
    603        id: `anomaly-${i + 1}`,
    604        metric,
    605        timestamp: new Date(start.getTime() + Math.random() * periodMs).toISOString(),
    606        value: 100 * (isPositive ? 1.2 + Math.random() * 0.5 : 0.5 + Math.random() * 0.3),
    607        expectedValue: 100,
    
  • L606

    ts
    604        metric,
    605        timestamp: new Date(start.getTime() + Math.random() * periodMs).toISOString(),
    606        value: 100 * (isPositive ? 1.2 + Math.random() * 0.5 : 0.5 + Math.random() * 0.3),
    607        expectedValue: 100,
    608        deviation: isPositive ? 0.2 + Math.random() * 0.5 : -(0.2 + Math.random() * 0.3),
    
  • L608

    ts
    606        value: 100 * (isPositive ? 1.2 + Math.random() * 0.5 : 0.5 + Math.random() * 0.3),
    607        expectedValue: 100,
    608        deviation: isPositive ? 0.2 + Math.random() * 0.5 : -(0.2 + Math.random() * 0.3),
    609        severity,
    610        description: `${isPositive ? 'Unusual spike' : 'Unexpected drop'} in ${metric} detected`,
    
  • L842

    ts
    840          factor:
    841            h >= 20 || h <= 2
    842              ? 1.8 + Math.random() * 0.4
    843              : h >= 8 && h <= 17
    844                ? 0.4 + Math.random() * 0.2
    
  • L844

    ts
    842              ? 1.8 + Math.random() * 0.4
    843              : h >= 8 && h <= 17
    844                ? 0.4 + Math.random() * 0.2
    845                : 1.0 + Math.random() * 0.2,
    846          confidence: 0.9,
    
  • L845

    ts
    843              : h >= 8 && h <= 17
    844                ? 0.4 + Math.random() * 0.2
    845                : 1.0 + Math.random() * 0.2,
    846          confidence: 0.9,
    847        })),
    
  • L852

    ts
    850          factor:
    851            h >= 20 || h <= 2
    852              ? 1.6 + Math.random() * 0.3
    853              : h >= 8 && h <= 17
    854                ? 0.5 + Math.random() * 0.2
    
  • L854

    ts
    852              ? 1.6 + Math.random() * 0.3
    853              : h >= 8 && h <= 17
    854                ? 0.5 + Math.random() * 0.2
    855                : 1.0 + Math.random() * 0.2,
    856          confidence: 0.92,
    
  • L855

    ts
    853              : h >= 8 && h <= 17
    854                ? 0.5 + Math.random() * 0.2
    855                : 1.0 + Math.random() * 0.2,
    856          confidence: 0.92,
    857        })),
    
  • L862

    ts
    860          factor:
    861            h >= 20 || h <= 2
    862              ? 1.4 + Math.random() * 0.3
    863              : h >= 8 && h <= 17
    864                ? 0.7 + Math.random() * 0.15
    
  • L864

    ts
    862              ? 1.4 + Math.random() * 0.3
    863              : h >= 8 && h <= 17
    864                ? 0.7 + Math.random() * 0.15
    865                : 1.0 + Math.random() * 0.15,
    866          confidence: 0.88,
    
  • L865

    ts
    863              : h >= 8 && h <= 17
    864                ? 0.7 + Math.random() * 0.15
    865                : 1.0 + Math.random() * 0.15,
    866          confidence: 0.88,
    867        })),
    

apps/aphrodite/analytics-dashboard/src/routes/viewers.ts#

  • L83

    ts
    81
    82    // Generate viewer metrics
    83    const totalViewers = 100000 + Math.floor(Math.random() * 50000);
    84    const uniqueViewers = Math.floor(totalViewers * 0.65);
    85    const newViewers = Math.floor(uniqueViewers * 0.25);
    
  • L193

    ts
    191    const cohorts: ViewerCohort[] = Array.from({ length: 8 }, (_, weekIndex) => {
    192      const cohortDate = new Date(start.getTime() - weekIndex * 7 * 24 * 60 * 60 * 1000);
    193      const initialSize = Math.floor(1000 + Math.random() * 500);
    194      const retentionWeeks = Array.from({ length: Math.min(8 - weekIndex, 8) }, (_, week) => ({
    195        week: week + 1,
    
  • L217

    ts
    215    const trend = Array.from({ length: pointCount }, (_, i) => {
    216      const pointTime = new Date(start.getTime() + i * intervalMs);
    217      const multiplier = 0.8 + Math.random() * 0.4;
    218      return {
    219        timestamp: pointTime.toISOString(),
    
  • L285

    ts
    283
    284    const { start, end } = parsePeriodToDateRange(query.period, query.timezone);
    285    const uniqueViewers = 50000 + Math.floor(Math.random() * 25000);
    286
    287    const demographics = {
    
  • L331

    ts
    329          count: Math.floor(uniqueViewers * (0.35 - i * 0.015)),
    330          percentage: 0.35 - i * 0.015,
    331          avgWatchTime: 30 + Math.random() * 30,
    332          avgSpending: 15 + Math.random() * 20,
    333        })),
    
  • L332

    ts
    330          percentage: 0.35 - i * 0.015,
    331          avgWatchTime: 30 + Math.random() * 30,
    332          avgSpending: 15 + Math.random() * 20,
    333        })),
    334        regions: [
    
  • L466

    ts
    464      },
    465      sessions: {
    466        total: 150000 + Math.floor(Math.random() * 50000),
    467        avgDuration: 45 * 60,
    468        medianDuration: 35 * 60,
    
  • L560

    ts
    558    const cohorts = Array.from({ length: 12 }, (_, weekIndex) => {
    559      const cohortDate = new Date(start.getTime() - weekIndex * 7 * 24 * 60 * 60 * 1000);
    560      const initialSize = Math.floor(800 + Math.random() * 400);
    561      const retentionWeeks = Array.from({ length: Math.min(12 - weekIndex, 12) }, (_, week) => {
    562        const baseRetention = Math.pow(0.72, week + 1);
    
  • L563

    ts
    561      const retentionWeeks = Array.from({ length: Math.min(12 - weekIndex, 12) }, (_, week) => {
    562        const baseRetention = Math.pow(0.72, week + 1);
    563        const variance = (Math.random() - 0.5) * 0.1;
    564        const retained = Math.max(0, Math.min(1, baseRetention + variance));
    565        return {
    
  • L569

    ts
    567          retained: Math.floor(initialSize * retained),
    568          percentage: retained,
    569          revenue: initialSize * retained * (15 + Math.random() * 10),
    570        };
    571      });
    
  • L585

    ts
    583        ltv: totalRevenue / initialSize,
    584        characteristics: {
    585          avgAge: 25 + Math.floor(Math.random() * 15),
    586          topCountry: ['US', 'GB', 'DE', 'CA'][Math.floor(Math.random() * 4)],
    587          acquisitionChannel: ['organic', 'paid', 'referral', 'social'][
    
  • L586

    ts
    584        characteristics: {
    585          avgAge: 25 + Math.floor(Math.random() * 15),
    586          topCountry: ['US', 'GB', 'DE', 'CA'][Math.floor(Math.random() * 4)],
    587          acquisitionChannel: ['organic', 'paid', 'referral', 'social'][
    588            Math.floor(Math.random() * 4)
    
  • L588

    ts
    586          topCountry: ['US', 'GB', 'DE', 'CA'][Math.floor(Math.random() * 4)],
    587          acquisitionChannel: ['organic', 'paid', 'referral', 'social'][
    588            Math.floor(Math.random() * 4)
    589          ],
    590        },
    
  • L654

    ts
    652      username: `User${offset + i + 1}`,
    653      avatar: `https://api.dicebear.com/7.x/avataaars/svg?seed=${offset + i}`,
    654      status: ['active', 'inactive', 'new', 'returning'][Math.floor(Math.random() * 4)] as
    655        | 'active'
    656        | 'inactive'
    
  • L660

    ts
    658        | 'returning',
    659      metrics: {
    660        totalWatchTime: Math.floor(Math.random() * 10000) * 60,
    661        sessionsCount: Math.floor(Math.random() * 100),
    662        avgSessionDuration: Math.floor(30 + Math.random() * 60) * 60,
    
  • L661

    ts
    659      metrics: {
    660        totalWatchTime: Math.floor(Math.random() * 10000) * 60,
    661        sessionsCount: Math.floor(Math.random() * 100),
    662        avgSessionDuration: Math.floor(30 + Math.random() * 60) * 60,
    663        totalSpending: Math.floor(Math.random() * 500),
    
  • L662

    ts
    660        totalWatchTime: Math.floor(Math.random() * 10000) * 60,
    661        sessionsCount: Math.floor(Math.random() * 100),
    662        avgSessionDuration: Math.floor(30 + Math.random() * 60) * 60,
    663        totalSpending: Math.floor(Math.random() * 500),
    664        tipsGiven: Math.floor(Math.random() * 50),
    
  • L663

    ts
    661        sessionsCount: Math.floor(Math.random() * 100),
    662        avgSessionDuration: Math.floor(30 + Math.random() * 60) * 60,
    663        totalSpending: Math.floor(Math.random() * 500),
    664        tipsGiven: Math.floor(Math.random() * 50),
    665        subscriptions: Math.floor(Math.random() * 5),
    
  • L664

    ts
    662        avgSessionDuration: Math.floor(30 + Math.random() * 60) * 60,
    663        totalSpending: Math.floor(Math.random() * 500),
    664        tipsGiven: Math.floor(Math.random() * 50),
    665        subscriptions: Math.floor(Math.random() * 5),
    666        messagesCount: Math.floor(Math.random() * 200),
    
  • L665

    ts
    663        totalSpending: Math.floor(Math.random() * 500),
    664        tipsGiven: Math.floor(Math.random() * 50),
    665        subscriptions: Math.floor(Math.random() * 5),
    666        messagesCount: Math.floor(Math.random() * 200),
    667        followedCreators: Math.floor(Math.random() * 20),
    
  • L666

    ts
    664        tipsGiven: Math.floor(Math.random() * 50),
    665        subscriptions: Math.floor(Math.random() * 5),
    666        messagesCount: Math.floor(Math.random() * 200),
    667        followedCreators: Math.floor(Math.random() * 20),
    668      },
    
  • L667

    ts
    665        subscriptions: Math.floor(Math.random() * 5),
    666        messagesCount: Math.floor(Math.random() * 200),
    667        followedCreators: Math.floor(Math.random() * 20),
    668      },
    669      engagement: {
    
  • L670

    ts
    668      },
    669      engagement: {
    670        rate: Math.random() * 0.5,
    671        lastActive: new Date(
    672          end.getTime() - Math.random() * (end.getTime() - start.getTime())
    
  • L672

    ts
    670        rate: Math.random() * 0.5,
    671        lastActive: new Date(
    672          end.getTime() - Math.random() * (end.getTime() - start.getTime())
    673        ).toISOString(),
    674        favoriteCreator: `Creator${Math.floor(Math.random() * 100)}`,
    
  • L674

    ts
    672          end.getTime() - Math.random() * (end.getTime() - start.getTime())
    673        ).toISOString(),
    674        favoriteCreator: `Creator${Math.floor(Math.random() * 100)}`,
    675      },
    676      demographics: {
    
  • L677

    ts
    675      },
    676      demographics: {
    677        country: ['US', 'GB', 'DE', 'CA', 'FR'][Math.floor(Math.random() * 5)],
    678        platform: ['web', 'ios', 'android'][Math.floor(Math.random() * 3)],
    679        device: ['desktop', 'mobile', 'tablet'][Math.floor(Math.random() * 3)],
    
  • L678

    ts
    676      demographics: {
    677        country: ['US', 'GB', 'DE', 'CA', 'FR'][Math.floor(Math.random() * 5)],
    678        platform: ['web', 'ios', 'android'][Math.floor(Math.random() * 3)],
    679        device: ['desktop', 'mobile', 'tablet'][Math.floor(Math.random() * 3)],
    680      },
    
  • L679

    ts
    677        country: ['US', 'GB', 'DE', 'CA', 'FR'][Math.floor(Math.random() * 5)],
    678        platform: ['web', 'ios', 'android'][Math.floor(Math.random() * 3)],
    679        device: ['desktop', 'mobile', 'tablet'][Math.floor(Math.random() * 3)],
    680      },
    681      joinedAt: new Date(Date.now() - Math.random() * 365 * 24 * 60 * 60 * 1000).toISOString(),
    
  • L681

    ts
    679        device: ['desktop', 'mobile', 'tablet'][Math.floor(Math.random() * 3)],
    680      },
    681      joinedAt: new Date(Date.now() - Math.random() * 365 * 24 * 60 * 60 * 1000).toISOString(),
    682    }));
    683
    
  • L722

    ts
    720      username: `User_${viewerId}`,
    721      avatar: `https://api.dicebear.com/7.x/avataaars/svg?seed=${viewerId}`,
    722      joinedAt: new Date(Date.now() - Math.random() * 730 * 24 * 60 * 60 * 1000).toISOString(),
    723      lastActive: new Date().toISOString(),
    724      period: {
    
  • L750

    ts
    748        byMonth: Array.from({ length: 6 }, (_, i) => ({
    749          month: new Date(Date.now() - i * 30 * 24 * 60 * 60 * 1000).toISOString().slice(0, 7),
    750          amount: 50 + Math.random() * 100,
    751        })),
    752      },
    
  • L762

    ts
    760      recentSessions: Array.from({ length: 10 }, (_, i) => ({
    761        id: `session-${i + 1}`,
    762        streamId: `stream-${Math.floor(Math.random() * 100)}`,
    763        creatorUsername: `Creator${Math.floor(Math.random() * 50)}`,
    764        startedAt: new Date(Date.now() - i * 24 * 60 * 60 * 1000).toISOString(),
    
  • L763

    ts
    761        id: `session-${i + 1}`,
    762        streamId: `stream-${Math.floor(Math.random() * 100)}`,
    763        creatorUsername: `Creator${Math.floor(Math.random() * 50)}`,
    764        startedAt: new Date(Date.now() - i * 24 * 60 * 60 * 1000).toISOString(),
    765        duration: Math.floor(20 + Math.random() * 60) * 60,
    
  • L765

    ts
    763        creatorUsername: `Creator${Math.floor(Math.random() * 50)}`,
    764        startedAt: new Date(Date.now() - i * 24 * 60 * 60 * 1000).toISOString(),
    765        duration: Math.floor(20 + Math.random() * 60) * 60,
    766        messages: Math.floor(Math.random() * 20),
    767        tips: Math.floor(Math.random() * 3),
    
  • L766

    ts
    764        startedAt: new Date(Date.now() - i * 24 * 60 * 60 * 1000).toISOString(),
    765        duration: Math.floor(20 + Math.random() * 60) * 60,
    766        messages: Math.floor(Math.random() * 20),
    767        tips: Math.floor(Math.random() * 3),
    768      })),
    
  • L767

    ts
    765        duration: Math.floor(20 + Math.random() * 60) * 60,
    766        messages: Math.floor(Math.random() * 20),
    767        tips: Math.floor(Math.random() * 3),
    768      })),
    769      demographics: {
    

apps/aphrodite/analytics-dashboard/src/websocket/handler.ts#

  • L279

    ts
    277          return {
    278            timestamp,
    279            activeStreams: 150 + Math.floor(Math.random() * 20),
    280            totalViewers: 25000 + Math.floor(Math.random() * 2000),
    281            messagesPerMinute: 500 + Math.floor(Math.random() * 100),
    
  • L280

    ts
    278            timestamp,
    279            activeStreams: 150 + Math.floor(Math.random() * 20),
    280            totalViewers: 25000 + Math.floor(Math.random() * 2000),
    281            messagesPerMinute: 500 + Math.floor(Math.random() * 100),
    282            tipsPerMinute: 50 + Math.floor(Math.random() * 20),
    
  • L281

    ts
    279            activeStreams: 150 + Math.floor(Math.random() * 20),
    280            totalViewers: 25000 + Math.floor(Math.random() * 2000),
    281            messagesPerMinute: 500 + Math.floor(Math.random() * 100),
    282            tipsPerMinute: 50 + Math.floor(Math.random() * 20),
    283            revenuePerMinute: 800 + Math.floor(Math.random() * 200),
    
  • L282

    ts
    280            totalViewers: 25000 + Math.floor(Math.random() * 2000),
    281            messagesPerMinute: 500 + Math.floor(Math.random() * 100),
    282            tipsPerMinute: 50 + Math.floor(Math.random() * 20),
    283            revenuePerMinute: 800 + Math.floor(Math.random() * 200),
    284          };
    
  • L283

    ts
    281            messagesPerMinute: 500 + Math.floor(Math.random() * 100),
    282            tipsPerMinute: 50 + Math.floor(Math.random() * 20),
    283            revenuePerMinute: 800 + Math.floor(Math.random() * 200),
    284          };
    285
    
  • L289

    ts
    287          return {
    288            timestamp,
    289            current: 800 + Math.floor(Math.random() * 400),
    290            tips: 400 + Math.floor(Math.random() * 200),
    291            subscriptions: 300 + Math.floor(Math.random() * 150),
    
  • L290

    ts
    288            timestamp,
    289            current: 800 + Math.floor(Math.random() * 400),
    290            tips: 400 + Math.floor(Math.random() * 200),
    291            subscriptions: 300 + Math.floor(Math.random() * 150),
    292            other: 100 + Math.floor(Math.random() * 50),
    
  • L291

    ts
    289            current: 800 + Math.floor(Math.random() * 400),
    290            tips: 400 + Math.floor(Math.random() * 200),
    291            subscriptions: 300 + Math.floor(Math.random() * 150),
    292            other: 100 + Math.floor(Math.random() * 50),
    293            trend: Array.from({ length: 10 }, (_, i) => ({
    
  • L292

    ts
    290            tips: 400 + Math.floor(Math.random() * 200),
    291            subscriptions: 300 + Math.floor(Math.random() * 150),
    292            other: 100 + Math.floor(Math.random() * 50),
    293            trend: Array.from({ length: 10 }, (_, i) => ({
    294              minute: i,
    
  • L295

    ts
    293            trend: Array.from({ length: 10 }, (_, i) => ({
    294              minute: i,
    295              value: 700 + Math.floor(Math.random() * 300),
    296            })),
    297          };
    
  • L302

    ts
    300          return {
    301            timestamp,
    302            total: 25000 + Math.floor(Math.random() * 2000),
    303            concurrent: 15000 + Math.floor(Math.random() * 1500),
    304            new: 500 + Math.floor(Math.random() * 200),
    
  • L303

    ts
    301            timestamp,
    302            total: 25000 + Math.floor(Math.random() * 2000),
    303            concurrent: 15000 + Math.floor(Math.random() * 1500),
    304            new: 500 + Math.floor(Math.random() * 200),
    305            returning: 14500 + Math.floor(Math.random() * 1300),
    
  • L304

    ts
    302            total: 25000 + Math.floor(Math.random() * 2000),
    303            concurrent: 15000 + Math.floor(Math.random() * 1500),
    304            new: 500 + Math.floor(Math.random() * 200),
    305            returning: 14500 + Math.floor(Math.random() * 1300),
    306            trend: Array.from({ length: 10 }, (_, i) => ({
    
  • L305

    ts
    303            concurrent: 15000 + Math.floor(Math.random() * 1500),
    304            new: 500 + Math.floor(Math.random() * 200),
    305            returning: 14500 + Math.floor(Math.random() * 1300),
    306            trend: Array.from({ length: 10 }, (_, i) => ({
    307              minute: i,
    
  • L308

    ts
    306            trend: Array.from({ length: 10 }, (_, i) => ({
    307              minute: i,
    308              value: 14500 + Math.floor(Math.random() * 1000),
    309            })),
    310          };
    
  • L315

    ts
    313          return {
    314            timestamp,
    315            messagesPerMinute: 500 + Math.floor(Math.random() * 100),
    316            activeChatters: 3000 + Math.floor(Math.random() * 500),
    317            tipsPerMinute: 50 + Math.floor(Math.random() * 20),
    
  • L316

    ts
    314            timestamp,
    315            messagesPerMinute: 500 + Math.floor(Math.random() * 100),
    316            activeChatters: 3000 + Math.floor(Math.random() * 500),
    317            tipsPerMinute: 50 + Math.floor(Math.random() * 20),
    318            reactionsPerMinute: 200 + Math.floor(Math.random() * 50),
    
  • L317

    ts
    315            messagesPerMinute: 500 + Math.floor(Math.random() * 100),
    316            activeChatters: 3000 + Math.floor(Math.random() * 500),
    317            tipsPerMinute: 50 + Math.floor(Math.random() * 20),
    318            reactionsPerMinute: 200 + Math.floor(Math.random() * 50),
    319            engagementRate: 0.35 + Math.random() * 0.1,
    
  • L318

    ts
    316            activeChatters: 3000 + Math.floor(Math.random() * 500),
    317            tipsPerMinute: 50 + Math.floor(Math.random() * 20),
    318            reactionsPerMinute: 200 + Math.floor(Math.random() * 50),
    319            engagementRate: 0.35 + Math.random() * 0.1,
    320          };
    
  • L319

    ts
    317            tipsPerMinute: 50 + Math.floor(Math.random() * 20),
    318            reactionsPerMinute: 200 + Math.floor(Math.random() * 50),
    319            engagementRate: 0.35 + Math.random() * 0.1,
    320          };
    321
    
  • L325

    ts
    323          return {
    324            timestamp,
    325            active: Math.floor(Math.random() * 5),
    326            recent: [],
    327          };
    
  • L332

    ts
    330          return {
    331            timestamp,
    332            live: 150 + Math.floor(Math.random() * 20),
    333            starting: Math.floor(Math.random() * 10),
    334            ending: Math.floor(Math.random() * 10),
    
  • L333

    ts
    331            timestamp,
    332            live: 150 + Math.floor(Math.random() * 20),
    333            starting: Math.floor(Math.random() * 10),
    334            ending: Math.floor(Math.random() * 10),
    335            topStreams: Array.from({ length: 5 }, (_, i) => ({
    
  • L334

    ts
    332            live: 150 + Math.floor(Math.random() * 20),
    333            starting: Math.floor(Math.random() * 10),
    334            ending: Math.floor(Math.random() * 10),
    335            topStreams: Array.from({ length: 5 }, (_, i) => ({
    336              id: `stream-${i + 1}`,
    
  • L337

    ts
    335            topStreams: Array.from({ length: 5 }, (_, i) => ({
    336              id: `stream-${i + 1}`,
    337              viewers: 2000 - i * 300 + Math.floor(Math.random() * 200),
    338              tips: 100 - i * 15 + Math.floor(Math.random() * 20),
    339            })),
    
  • L338

    ts
    336              id: `stream-${i + 1}`,
    337              viewers: 2000 - i * 300 + Math.floor(Math.random() * 200),
    338              tips: 100 - i * 15 + Math.floor(Math.random() * 20),
    339            })),
    340          };
    
  • L345

    ts
    343          return {
    344            timestamp,
    345            viewers: 500 + Math.floor(Math.random() * 200),
    346            tips: 50 + Math.floor(Math.random() * 30),
    347            messages: 100 + Math.floor(Math.random() * 50),
    
  • L346

    ts
    344            timestamp,
    345            viewers: 500 + Math.floor(Math.random() * 200),
    346            tips: 50 + Math.floor(Math.random() * 30),
    347            messages: 100 + Math.floor(Math.random() * 50),
    348            followers: Math.floor(Math.random() * 5),
    
  • L347

    ts
    345            viewers: 500 + Math.floor(Math.random() * 200),
    346            tips: 50 + Math.floor(Math.random() * 30),
    347            messages: 100 + Math.floor(Math.random() * 50),
    348            followers: Math.floor(Math.random() * 5),
    349          };
    
  • L348

    ts
    346            tips: 50 + Math.floor(Math.random() * 30),
    347            messages: 100 + Math.floor(Math.random() * 50),
    348            followers: Math.floor(Math.random() * 5),
    349          };
    350
    
  • L355

    ts
    353            timestamp,
    354            systemHealth: {
    355              cpu: 40 + Math.random() * 20,
    356              memory: 50 + Math.random() * 15,
    357              activeConnections: 35000 + Math.floor(Math.random() * 5000),
    
  • L356

    ts
    354            systemHealth: {
    355              cpu: 40 + Math.random() * 20,
    356              memory: 50 + Math.random() * 15,
    357              activeConnections: 35000 + Math.floor(Math.random() * 5000),
    358            },
    
  • L357

    ts
    355              cpu: 40 + Math.random() * 20,
    356              memory: 50 + Math.random() * 15,
    357              activeConnections: 35000 + Math.floor(Math.random() * 5000),
    358            },
    359            revenue: 800 + Math.floor(Math.random() * 200),
    
  • L359

    ts
    357              activeConnections: 35000 + Math.floor(Math.random() * 5000),
    358            },
    359            revenue: 800 + Math.floor(Math.random() * 200),
    360            viewers: 25000 + Math.floor(Math.random() * 2000),
    361            alerts: [],
    
  • L360

    ts
    358            },
    359            revenue: 800 + Math.floor(Math.random() * 200),
    360            viewers: 25000 + Math.floor(Math.random() * 2000),
    361            alerts: [],
    362          };
    

apps/aphrodite/auth/src/routes/oauth.ts#

  • L47

    ts
    45
    46  function generateState(provider: OAuthProvider, returnUrl?: string): string {
    47    const nonce = Math.random().toString(36).substring(2);
    48    const state = Buffer.from(JSON.stringify({ provider, returnUrl, nonce })).toString('base64url');
    49
    

apps/aphrodite/mobile-broadcaster/src/services/ChatService.ts#

  • L647

    ts
    645
    646    private generateId(): string {
    647      return `${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    648    }
    649
    

apps/aphrodite/mobile-broadcaster/src/services/NotificationService.ts#

  • L905

    ts
    903
    904    private generateNotificationId(): string {
    905      return `notif_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    906    }
    907
    

apps/aphrodite/mobile-broadcaster/src/services/StreamingService.ts#

  • L564

    ts
    562
    563    private generateSessionId(): string {
    564      return `stream_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    565    }
    566
    

apps/aphrodite/mobile-viewer/src/services/OfflineService.ts#

  • L484

    ts
    482      const metadata = await this.fetchMediaMetadata(mediaType, mediaId);
    483
    484      const downloadId = `download_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    485
    486      const download: DownloadItem = {
    
  • L800

    ts
    798      }
    799
    800      const messageId = `msg_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    801
    802      const message: QueuedMessage = {
    

apps/aphrodite/notifications/src/push/service.ts#

  • L306

    ts
    304      // Create new subscription
    305      const subscription: DevicePushSubscription = {
    306        id: `push_${Date.now()}_${Math.random().toString(36).substring(7)}`,
    307        userId,
    308        platform,
    

apps/aphrodite/streaming/src/routes/streams.ts#

  • L368

    ts
    366    let key = 'sk_live_';
    367    for (let i = 0; i < 32; i++) {
    368      key += chars.charAt(Math.floor(Math.random() * chars.length));
    369    }
    370    return key;
    

apps/arete/mobile/src/screens/coach/__tests__/setup.ts#

  • L408

    ts
    406        ],
    407        dataPoints: [
    408          { label: 'Mon', value: 50 + Math.round(Math.random() * 50) },
    409          { label: 'Tue', value: 50 + Math.round(Math.random() * 50) },
    410          { label: 'Wed', value: 50 + Math.round(Math.random() * 50) },
    
  • L409

    ts
    407        dataPoints: [
    408          { label: 'Mon', value: 50 + Math.round(Math.random() * 50) },
    409          { label: 'Tue', value: 50 + Math.round(Math.random() * 50) },
    410          { label: 'Wed', value: 50 + Math.round(Math.random() * 50) },
    411          { label: 'Thu', value: 50 + Math.round(Math.random() * 50) },
    
  • L410

    ts
    408          { label: 'Mon', value: 50 + Math.round(Math.random() * 50) },
    409          { label: 'Tue', value: 50 + Math.round(Math.random() * 50) },
    410          { label: 'Wed', value: 50 + Math.round(Math.random() * 50) },
    411          { label: 'Thu', value: 50 + Math.round(Math.random() * 50) },
    412          { label: 'Fri', value: 50 + Math.round(Math.random() * 50) },
    
  • L411

    ts
    409          { label: 'Tue', value: 50 + Math.round(Math.random() * 50) },
    410          { label: 'Wed', value: 50 + Math.round(Math.random() * 50) },
    411          { label: 'Thu', value: 50 + Math.round(Math.random() * 50) },
    412          { label: 'Fri', value: 50 + Math.round(Math.random() * 50) },
    413        ],
    
  • L412

    ts
    410          { label: 'Wed', value: 50 + Math.round(Math.random() * 50) },
    411          { label: 'Thu', value: 50 + Math.round(Math.random() * 50) },
    412          { label: 'Fri', value: 50 + Math.round(Math.random() * 50) },
    413        ],
    414        createdAt: date.toISOString(),
    

apps/arete/mobile/src/screens/gamification/__tests__/setup.ts#

  • L735

    ts
    733      earnedAt:
    734        i < 15 ? `2025-${String(7 + Math.floor(i / 3)).padStart(2, '0')}-01T00:00:00.000Z` : null,
    735      progress: i < 15 ? 1 : Math.random() * 0.9,
    736    }));
    737  }
    
  • L783

    ts
    781      name: names[i % names.length],
    782      avatarUrl: null,
    783      points: Math.max(100, 5000 - i * 200 + Math.floor(Math.random() * 100)),
    784      isCurrentUser: i === 4, // 5th place is current user
    785    }));
    
  • L830

    ts
    828    return Array.from({ length: count }, (_, i) => {
    829      const startDate = new Date();
    830      startDate.setDate(startDate.getDate() - Math.floor(Math.random() * 14));
    831      const endDate = new Date(startDate);
    832      const daysOffset =
    
  • L838

    ts
    836      const targetValue =
    837        types[i % types.length] === 'daily' ? 1 : types[i % types.length] === 'weekly' ? 7 : 30;
    838      const progress = i < 2 ? targetValue : Math.floor(Math.random() * targetValue);
    839
    840      return createMockChallenge({
    

apps/arete/mobile/src/screens/gamification/components/CelebrationAnimations.tsx#

  • L95

    ts
    93
    94    useEffect(() => {
    95      const angle = Math.random() * Math.PI * 2;
    96      const distance = 80 + Math.random() * 120;
    97      const targetX = Math.cos(angle) * distance;
    
  • L96

    ts
    94    useEffect(() => {
    95      const angle = Math.random() * Math.PI * 2;
    96      const distance = 80 + Math.random() * 120;
    97      const targetX = Math.cos(angle) * distance;
    98      const targetY = Math.sin(angle) * distance;
    
  • L167

    ts
    165
    166    useEffect(() => {
    167      const drift = (Math.random() - 0.5) * 100;
    168      const rotations = 2 + Math.random() * 4;
    169
    
  • L168

    ts
    166    useEffect(() => {
    167      const drift = (Math.random() - 0.5) * 100;
    168      const rotations = 2 + Math.random() * 4;
    169
    170      Animated.sequence([
    
  • L180

    ts
    178          Animated.timing(translateY, {
    179            toValue: SCREEN_HEIGHT * 0.6,
    180            duration: 2000 + Math.random() * 1000,
    181            useNativeDriver: true,
    182          }),
    
  • L185

    ts
    183          Animated.timing(translateX, {
    184            toValue: drift,
    185            duration: 2000 + Math.random() * 1000,
    186            useNativeDriver: true,
    187          }),
    
  • L190

    ts
    188          Animated.timing(rotate, {
    189            toValue: rotations,
    190            duration: 2000 + Math.random() * 1000,
    191            useNativeDriver: true,
    192          }),
    
  • L207

    ts
    205    });
    206
    207    const width = 6 + Math.random() * 8;
    208    const height = 10 + Math.random() * 12;
    209
    
  • L208

    ts
    206
    207    const width = 6 + Math.random() * 8;
    208    const height = 10 + Math.random() * 12;
    209
    210    return (
    
  • L301

    ts
    299              delay={200 + i * 50}
    300              color={particleColors[i % particleColors.length]}
    301              size={6 + Math.random() * 8}
    302              startX={centerX}
    303              startY={centerY}
    

apps/arete/mobile/src/screens/goals/__tests__/setup.ts#

  • L245

    ts
    243        category: categories[i % categories.length],
    244        status: statuses[i % statuses.length],
    245        progress: Math.round(Math.random() * 100),
    246        milestones:
    247          i % 2 === 0
    

apps/arete/mobile/src/screens/habits/__tests__/setup.ts#

  • L219

    ts
    217      date.setDate(now.getDate() - i);
    218      // Vary the hour to test time-of-day distribution
    219      date.setHours(6 + (i % 4) * 4, Math.floor(Math.random() * 60), 0, 0);
    220      completions.push({
    221        id: `comp-${i}`,
    

apps/arete/mobile/src/services/OfflineSyncService.ts#

  • L221

    ts
    219    ): Promise<string> {
    220      const queue = await this.getSyncQueue();
    221      const id = `${type}-${operation}-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    222
    223      const item: PendingSyncItem = {
    

apps/arete/web/src/pages/habits/HabitDetailPage.tsx#

  • L62

    ts
    60      const dateStr = date.toISOString().split('T')[0];
    61      // Simulate completion pattern: higher recent, some gaps
    62      const rand = Math.random();
    63      const recencyBoost = i < 30 ? 0.3 : i < 60 ? 0.15 : 0;
    64      data.push({ date: dateStr, value: rand > 0.25 - recencyBoost ? 1 : 0 });
    

apps/arete/web/src/pages/vision/VisionPage.tsx#

  • L363

    ts
    361              <div className="space-y-3">
    362                {selectedValues.slice(0, 5).map((value) => {
    363                  const score = 60 + Math.floor(Math.random() * 35);
    364                  return (
    365                    <div key={value}>
    

apps/arete/web/src/pages/wellness/WellnessPage.tsx#

  • L71

    ts
    69      date.setDate(date.getDate() - i);
    70      const moods = [0, 1, 2, 3, 4, 5];
    71      const mood = moods[Math.floor(Math.random() * 5) + 1];
    72      data.push({ date: date.toISOString().split('T')[0], value: mood });
    73    }
    

apps/asase/api/src/api-auth.ts#

  • L154

    ts
    152    let result = '';
    153    for (let i = 0; i < length; i++) {
    154      result += chars[Math.floor(Math.random() * 16)];
    155    }
    156    return result;
    

apps/asase/dashboard/src/alert-center.ts#

  • L118

    ts
    116    _alertCounter += 1;
    117    const ts = Date.now().toString(36);
    118    const rnd = Math.random().toString(36).slice(2, 7);
    119    return `alert_${ts}_${rnd}_${_alertCounter}`;
    120  }
    

apps/asase/dashboard/src/dashboard-shell.ts#

  • L137

    ts
    135    _sessionCounter += 1;
    136    const ts = Date.now().toString(36);
    137    const rnd = Math.random().toString(36).slice(2, 8);
    138    return `sess_${ts}_${rnd}_${_sessionCounter}`;
    139  }
    

apps/asase/dashboard/src/reporting-engine.ts#

  • L145

    ts
    143    _reportCounter += 1;
    144    const ts = Date.now().toString(36);
    145    const rnd = Math.random().toString(36).slice(2, 7);
    146    return `rpt_${ts}_${rnd}_${_reportCounter}`;
    147  }
    
  • L152

    ts
    150    _scheduleCounter += 1;
    151    const ts = Date.now().toString(36);
    152    const rnd = Math.random().toString(36).slice(2, 7);
    153    return `sched_${ts}_${rnd}_${_scheduleCounter}`;
    154  }
    

apps/asase/marketplace/src/b2b-portal.ts#

  • L349

    ts
    347
    348  function generateOrderId(): string {
    349    return `ORD-B2B-${Date.now()}-${Math.floor(Math.random() * 10000)
    350      .toString()
    351      .padStart(4, '0')}`;
    
  • L355

    ts
    353
    354  function generateScheduleId(): string {
    355    return `SCH-${Date.now()}-${Math.floor(Math.random() * 10000)
    356      .toString()
    357      .padStart(4, '0')}`;
    

apps/asase/marketplace/src/farmer-input-store.ts#

  • L469

    ts
    467
    468  function generateInputOrderId(): string {
    469    return `IORD-${Date.now()}-${Math.floor(Math.random() * 10000)
    470      .toString()
    471      .padStart(4, '0')}`;
    

apps/bellona/build-api/src/main.ts#

  • L210

    ts
    208  function generateJobId(prefix: string): string {
    209    const timestamp = Date.now().toString(36);
    210    const random = Math.random().toString(36).slice(2, 10);
    211    return `${prefix}-${timestamp}-${random}`;
    212  }
    

apps/bellona/remote-host/src/blender-adapter.ts#

  • L916

    ts
    914
    915  function bridgeMessageId(prefix: string): string {
    916    return `${prefix}:${Date.now()}:${Math.random().toString(36).slice(2, 10)}`;
    917  }
    918
    

apps/brigid/api/src/routes/ai.ts#

  • L143

    ts
    141    const start = Date.now();
    142    const result: VisionInspectionResult = {
    143      requestId: `vis-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    144      assetId: body.assetId,
    145      inspectionType: body.inspectionType,
    
  • L208

    ts
    206
    207    const result: OptimizationRecommendation = {
    208      requestId: `opt-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    209      processId: body.processId,
    210      currentEfficiency: 72.5,
    

apps/brigid/api/src/routes/cross-domain.ts#

  • L57

    ts
    55    }
    56
    57    const id = body.requestId ?? `prov-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    58    const record = {
    59      ...body,
    
  • L94

    ts
    92    }
    93
    94    const id = body.requestId ?? `maint-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    95    const record = {
    96      ...body,
    

apps/brigid/api/src/routes/equipment.ts#

  • L34

    ts
    32
    33  function generateId(): string {
    34    return `eq-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    35  }
    36
    

apps/brigid/energy/src/carbon-tracker.ts#

  • L172

    ts
    170      certificateNumber?: string;
    171    }): RECRecord {
    172      const id = `REC-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    173      const recCount = params.generationKWh / 1000; // 1 REC per MWh
    174
    

apps/brigid/energy/src/energy-audit.ts#

  • L143

    ts
    141
    142    addFinding(finding: Omit<AuditFinding, 'id'>): AuditFinding {
    143      const id = `AF-${Date.now()}-${Math.random().toString(36).slice(2, 5).toUpperCase()}`;
    144      const full: AuditFinding = { id, ...finding };
    145      this.findings.push(full);
    

apps/brigid/factory-os/src/alarm-management.ts#

  • L60

    ts
    58
    59    raiseAlarm(params: Omit<Alarm, 'id' | 'state'>): Alarm {
    60      const id = `ALM-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    61      const alarm: Alarm = {
    62        id,
    

apps/brigid/factory-os/src/batch-management.ts#

  • L124

    ts
    122      if (!recipe.isActive) throw new Error(`Recipe ${params.recipeId} is not active`);
    123
    124      const batchId = `BATCH-${Date.now()}-${Math.random().toString(36).slice(2, 7).toUpperCase()}`;
    125
    126      const phases: PhaseExecution[] = recipe.steps.map((step) => ({
    

apps/brigid/factory-os/src/digital-twin.ts#

  • L209

    ts
    207      workstationIds: string[]; // ordered flow sequence
    208    }): VirtualCommissioningResult {
    209      const simulationId = `SIM-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    210
    211      const workstations = params.workstationIds
    

apps/brigid/factory-os/src/production-monitor.ts#

  • L164

    ts
    162      const durationMinutes = (end.getTime() - start.getTime()) / 60000;
    163      const event: DowntimeEvent = {
    164        id: `DT-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    165        start,
    166        end,
    

apps/brigid/factory-os/src/quality-management.ts#

  • L167

    ts
    165
    166    recordDefect(params: Omit<DefectRecord, 'id'>): DefectRecord {
    167      const id = `DEF-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    168      const defect: DefectRecord = { id, ...params };
    169      this.defects.push(defect);
    
  • L209

    ts
    207
    208    recordInspection(params: Omit<InspectionResult, 'id' | 'passPct' | 'verdict'>): InspectionResult {
    209      const id = `INSP-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    210      const total = params.passCount + params.failCount;
    211      const passPct = total > 0 ? (params.passCount / total) * 100 : 0;
    

apps/brigid/factory-os/src/scada-overview.ts#

  • L92

    ts
    90
    91    raiseAlarm(alarm: Omit<SCADAAlarm, 'id'>): SCADAAlarm {
    92      const id = `ALM-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    93      const fullAlarm: SCADAAlarm = { id, ...alarm };
    94      this.alarms.set(id, fullAlarm);
    

apps/brigid/factory-os/src/scheduler.ts#

  • L51

    ts
    49      familyCode?: string;
    50    }): { job: ProductionJob; conflicts: ConflictResult[] } {
    51      const id = `JOB-${Date.now()}-${Math.random().toString(36).slice(2, 7).toUpperCase()}`;
    52      const setupTimeMinutes = params.setupTimeMinutes ?? 0;
    53      const endTime = new Date(
    

apps/brigid/factory-os/src/shift-handover.ts#

  • L79

    ts
    77
    78    createShiftLog(params: Omit<ShiftLog, 'id'>): ShiftLog {
    79      const id = `SHIFT-${params.date}-${params.shift.toUpperCase()}-${Math.random().toString(36).slice(2, 5).toUpperCase()}`;
    80      const log: ShiftLog = { id, ...params };
    81      this.logs.push(log);
    
  • L88

    ts
    86      const log = this.logs.find((l) => l.id === logId);
    87      if (!log) throw new Error(`Shift log not found: ${logId}`);
    88      const id = `ISSUE-${Date.now()}-${Math.random().toString(36).slice(2, 5).toUpperCase()}`;
    89      const fullIssue: OpenIssue = { id, ...issue };
    90      log.openIssues.push(fullIssue);
    
  • L97

    ts
    95      const log = this.logs.find((l) => l.id === logId);
    96      if (!log) throw new Error(`Shift log not found: ${logId}`);
    97      const id = `INC-${Date.now()}-${Math.random().toString(36).slice(2, 5).toUpperCase()}`;
    98      const fullIncident: Incident = { id, ...incident };
    99      log.incidents.push(fullIncident);
    

apps/brigid/maintenance/src/architecture.ts#

  • L158

    ts
    156    ): OfflineSyncQueueItem {
    157      return {
    158        id: `sync-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    159        entityType,
    160        entityId,
    

apps/brigid/maintenance/src/asset-management.ts#

  • L94

    ts
    92
    93    addAsset(params: Omit<Asset, 'id' | 'createdAt' | 'updatedAt' | 'healthScore'>): Asset {
    94      const id = `ast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    95      const now = new Date().toISOString();
    96      const asset: Asset = {
    

apps/brigid/maintenance/src/maintenance-kpi.ts#

  • L108

    ts
    106
    107    recordFailure(assetId: string, event: Omit<FailureEvent, 'id'>): FailureEvent {
    108      const id = `fe-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    109      const fe: FailureEvent = { id, ...event };
    110      const events = this.failureEvents.get(assetId) ?? [];
    
  • L120

    ts
    118      event: Omit<PlannedMaintenanceEvent, 'id'>
    119    ): PlannedMaintenanceEvent {
    120      const id = `pm-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    121      const pe: PlannedMaintenanceEvent = { id, ...event };
    122      const events = this.plannedEvents.get(assetId) ?? [];
    

apps/brigid/maintenance/src/mobile-api.ts#

  • L287

    ts
    285
    286      const record: PhotoRecord = {
    287        id: `photo-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    288        woId,
    289        capturedAt: new Date().toISOString(),
    
  • L331

    ts
    329
    330      return {
    331        packageId: `pkg-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    332        technicianId,
    333        downloadedAt: downloadedAt.toISOString(),
    

apps/brigid/maintenance/src/spare-parts.ts#

  • L89

    ts
    87      >
    88    ): SparePartSKU {
    89      const id = `sku-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    90      const now = new Date().toISOString();
    91      const safetyStock = calculateSafetyStock(params.avgDailyDemand, params.leadTimeDays);
    

apps/brigid/maintenance/src/work-order.ts#

  • L116

    ts
    114
    115    createWorkOrder(params: WorkOrderParams): WorkOrder {
    116      const id = `wo-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    117      const now = new Date();
    118      const wo: WorkOrder = {
    

apps/brigid/training/src/architecture.ts#

  • L222

    ts
    220
    221      return {
    222        id: `stmt-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    223        actor,
    224        verb,
    

apps/brigid/training/src/assessment.ts#

  • L125

    ts
    123
    124    addAssessment(params: Omit<Assessment, 'id'>): Assessment {
    125      const id = `asmt-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    126      const assessment: Assessment = { id, ...params };
    127      this.assessments.set(id, assessment);
    
  • L142

    ts
    140    startAssessment(learnerId: string, assessmentId: string): AssessmentAttempt {
    141      this.getAssessment(assessmentId); // validate
    142      const id = `att-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    143      const attempt: AssessmentAttempt = {
    144        id,
    

apps/brigid/training/src/certification.ts#

  • L95

    ts
    93      issuedDate?: string;
    94    }): Certification {
    95      const id = `cert-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    96      const issuedDate = params.issuedDate ?? new Date().toISOString();
    97      const expiryDate = computeExpiryDate(issuedDate, params.type);
    
  • L178

    ts
    176      const courseId = refresherCourseId ?? defaultCourse;
    177
    178      const id = `rwo-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    179      const dueDate = cert.expiryDate
    180        ? new Date(cert.expiryDate).toISOString()
    

apps/brigid/training/src/corporate-training.ts#

  • L116

    ts
    114
    115    addCorporateClient(params: Omit<CorporateClient, 'id' | 'createdAt'>): CorporateClient {
    116      const id = `corp-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    117      const client: CorporateClient = {
    118        ...params,
    
  • L158

    ts
    156
    157      const delegateRecords: Delegate[] = delegates.map((d) => ({
    158        id: `del-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    159        name: d.name,
    160        email: d.email,
    
  • L165

    ts
    163      }));
    164
    165      const enrollmentId = `cenr-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    166
    167      // Generate invoice
    
  • L174

    ts
    172
    173      const invoice: Invoice = {
    174        id: `inv-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    175        invoiceNumber,
    176        corporateId,
    

apps/brigid/training/src/course-catalog.ts#

  • L73

    ts
    71
    72    addCourse(params: Omit<Course, 'id' | 'createdAt' | 'updatedAt'>): Course {
    73      const id = `crs-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    74      const now = new Date().toISOString();
    75      const course: Course = { ...params, id, createdAt: now, updatedAt: now };
    
  • L183

    ts
    181      }
    182
    183      const id = `enr-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    184      const enrollment: Enrollment = {
    185        id,
    

apps/brigid/training/src/instructor-management.ts#

  • L84

    ts
    82
    83    addInstructor(params: Omit<Instructor, 'id' | 'createdAt'>): Instructor {
    84      const id = `instr-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    85      const instructor: Instructor = {
    86        ...params,
    
  • L134

    ts
    132      }
    133
    134      const id = `sched-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    135      const schedule: InstructorSchedule = {
    136        id,
    
  • L186

    ts
    184
    185    submitFeedback(feedbackData: Omit<LearnerFeedback, 'id' | 'submittedAt'>): LearnerFeedback {
    186      const id = `fb-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    187      const fb: LearnerFeedback = {
    188        ...feedbackData,
    

apps/brigid/training/src/virtual-lab.ts#

  • L371

    ts
    369
    370        // Add small process noise
    371        tag.value += (Math.random() - 0.5) * 0.02 * (tag.maxValue - tag.minValue);
    372        tag.value = Math.max(tag.minValue, Math.min(tag.maxValue, tag.value));
    373
    

apps/cybele/api/src/routes/gateway.ts#

  • L380

    ts
    378    if (!svc) return c.json({ error: 'Service not found' }, 404);
    379    // Simulate health check (in production would HTTP GET baseUrl/health)
    380    const latencyMs = Math.floor(Math.random() * 30) + 5;
    381    const updated = {
    382      ...svc,
    
  • L492

    ts
    490    const webhookId = `WHK-${++webhookSeq}`;
    491    // Generate a random signing secret
    492    const secret = Math.random().toString(36).substring(2) + Math.random().toString(36).substring(2);
    493    const webhook: WebhookSubscription = {
    494      webhookId,
    

apps/demeter/api/src/routes/weather.ts#

  • L156

    ts
    154      feelsLikeCelsius: Math.round((temperature - 2) * 10) / 10,
    155      humidity,
    156      windSpeedKmh: Math.round(Math.random() * 20 + 5),
    157      windDirection: ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'][Math.floor(Math.random() * 8)],
    158      uvIndex: hour >= 10 && hour <= 15 ? Math.min(isSummer ? 8 : 3, 11) : 0,
    
  • L157

    ts
    155      humidity,
    156      windSpeedKmh: Math.round(Math.random() * 20 + 5),
    157      windDirection: ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'][Math.floor(Math.random() * 8)],
    158      uvIndex: hour >= 10 && hour <= 15 ? Math.min(isSummer ? 8 : 3, 11) : 0,
    159      rainfallMm: Math.random() > 0.7 ? Math.round(Math.random() * 5 * 10) / 10 : 0,
    
  • L159

    ts
    157      windDirection: ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'][Math.floor(Math.random() * 8)],
    158      uvIndex: hour >= 10 && hour <= 15 ? Math.min(isSummer ? 8 : 3, 11) : 0,
    159      rainfallMm: Math.random() > 0.7 ? Math.round(Math.random() * 5 * 10) / 10 : 0,
    160      conditions: frostRisk
    161        ? 'Frost Warning'
    
  • L188

    ts
    186      const baseHigh = isWinter ? 5 : isSummer ? 32 : 20;
    187      const baseLow = isWinter ? -2 : isSummer ? 18 : 8;
    188      const variation = Math.round((Math.random() * 6 - 3) * 10) / 10;
    189
    190      const highCelsius = Math.round((baseHigh + variation) * 10) / 10;
    
  • L198

    ts
    196        highCelsius,
    197        lowCelsius,
    198        humidity: Math.round(50 + Math.random() * 40),
    199        rainfallMm: Math.random() > 0.6 ? Math.round(Math.random() * 15 * 10) / 10 : 0,
    200        windSpeedKmh: Math.round(Math.random() * 25 + 3),
    
  • L199

    ts
    197        lowCelsius,
    198        humidity: Math.round(50 + Math.random() * 40),
    199        rainfallMm: Math.random() > 0.6 ? Math.round(Math.random() * 15 * 10) / 10 : 0,
    200        windSpeedKmh: Math.round(Math.random() * 25 + 3),
    201        uvIndex: isSummer ? Math.round(Math.random() * 4 + 5) : Math.round(Math.random() * 3 + 1),
    
  • L200

    ts
    198        humidity: Math.round(50 + Math.random() * 40),
    199        rainfallMm: Math.random() > 0.6 ? Math.round(Math.random() * 15 * 10) / 10 : 0,
    200        windSpeedKmh: Math.round(Math.random() * 25 + 3),
    201        uvIndex: isSummer ? Math.round(Math.random() * 4 + 5) : Math.round(Math.random() * 3 + 1),
    202        conditions: frostRisk
    
  • L201

    ts
    199        rainfallMm: Math.random() > 0.6 ? Math.round(Math.random() * 15 * 10) / 10 : 0,
    200        windSpeedKmh: Math.round(Math.random() * 25 + 3),
    201        uvIndex: isSummer ? Math.round(Math.random() * 4 + 5) : Math.round(Math.random() * 3 + 1),
    202        conditions: frostRisk
    203          ? 'Frost Expected'
    
  • L206

    ts
    204          : highCelsius > 28
    205            ? 'Sunny'
    206            : Math.random() > 0.5
    207              ? 'Partly Cloudy'
    208              : 'Cloudy',
    
  • L619

    ts
    617          const isSummer = month >= 5 && month <= 7;
    618          const baseTemp = isWinter ? 3 : isSummer ? 27 : 15;
    619          const variation = Math.round((Math.sin(i * 0.3) * 4 + Math.random() * 3 - 1.5) * 10) / 10;
    620
    621          const high = Math.round((baseTemp + 6 + variation) * 10) / 10;
    
  • L630

    ts
    628            lowCelsius: low,
    629            avgCelsius: avg,
    630            humidity: Math.round(50 + Math.sin(i * 0.5) * 20 + Math.random() * 10),
    631            rainfallMm: Math.random() > 0.65 ? Math.round(Math.random() * 12 * 10) / 10 : 0,
    632            windSpeedKmh: Math.round(8 + Math.random() * 15),
    
  • L631

    ts
    629            avgCelsius: avg,
    630            humidity: Math.round(50 + Math.sin(i * 0.5) * 20 + Math.random() * 10),
    631            rainfallMm: Math.random() > 0.65 ? Math.round(Math.random() * 12 * 10) / 10 : 0,
    632            windSpeedKmh: Math.round(8 + Math.random() * 15),
    633            conditions:
    
  • L632

    ts
    630            humidity: Math.round(50 + Math.sin(i * 0.5) * 20 + Math.random() * 10),
    631            rainfallMm: Math.random() > 0.65 ? Math.round(Math.random() * 12 * 10) / 10 : 0,
    632            windSpeedKmh: Math.round(8 + Math.random() * 15),
    633            conditions:
    634              high > 28
    
  • L638

    ts
    636                : low < 0
    637                  ? 'Frost'
    638                  : Math.random() > 0.5
    639                    ? 'Partly Cloudy'
    640                    : 'Cloudy',
    

apps/demeter/mobile/src/services/offline/ActionQueue.ts#

  • L483

    ts
    481    private generateId(): string {
    482      this.idCounter++;
    483      return `action_${Date.now()}_${this.idCounter}_${Math.random().toString(36).slice(2, 6)}`;
    484    }
    485
    

apps/demeter/mobile/src/services/offline/OfflinePhotoManager.ts#

  • L532

    ts
    530    private generateId(): string {
    531      this.idCounter++;
    532      return `photo_${Date.now()}_${this.idCounter}_${Math.random().toString(36).slice(2, 6)}`;
    533    }
    534
    

apps/demeter/mobile/src/services/offline/SyncEngine.ts#

  • L490

    ts
    488    private generateId(): string {
    489      this.idCounter++;
    490      return `sync_${Date.now()}_${this.idCounter}_${Math.random().toString(36).slice(2, 8)}`;
    491    }
    492
    

apps/demeter/web/src/pages/gardens/BulkEditPage.tsx#

  • L272

    ts
    270        const appliedResults = previewChanges.map((change) => {
    271          // Simulate a small chance of error for demo
    272          const isError = Math.random() < 0.05;
    273          return {
    274            ...change,
    

apps/demeter/web/src/pages/sensors/RealTimeMonitorPage.tsx#

  • L386

    ts
    384      setSensors((prev) =>
    385        prev.map((sensor) => {
    386          const delta = (Math.random() - 0.5) * 2;
    387          const newValue = Math.max(sensor.min, Math.min(sensor.max, sensor.value + delta));
    388          const rounded =
    

apps/demeter/web/src/pages/sensors/SensorVisualizationPage.tsx#

  • L84

    ts
    82      for (let h = 6; h <= 17; h++) {
    83        const base = si < 2 ? 35 + Math.sin(h / 3) * 10 : si === 2 ? 55 + h * 2 : 85 - h * 0.5;
    84        const value = Math.round(base + Math.random() * 5);
    85        const isAnomaly = si === 0 && h === 14 ? true : si === 2 && h === 13 ? true : false;
    86        cells.push({ sensorId: sensorIds[si], sensorName: sensors[si], hour: h, value, isAnomaly });
    
  • L93

    ts
    91
    92  const correlationData = Array.from({ length: 20 }, () => ({
    93    moisture: 30 + Math.round(Math.random() * 30),
    94    temperature: 60 + Math.round(Math.random() * 25),
    95  }));
    
  • L94

    ts
    92  const correlationData = Array.from({ length: 20 }, () => ({
    93    moisture: 30 + Math.round(Math.random() * 30),
    94    temperature: 60 + Math.round(Math.random() * 25),
    95  }));
    96
    

apps/demeter/web/src/pages/tasks/CalendarPage.tsx#

  • L345

    ts
    343          id: String(id++),
    344          date: dateStr,
    345          isCompleted: isBeforeToday && Math.random() > 0.3,
    346        });
    347      }
    

apps/freya/api/src/event-bus.ts#

  • L262

    ts
    260    const ts = Date.now().toString(36);
    261    const seq = (++eventCounter).toString(36).padStart(4, '0');
    262    const rand = Math.random().toString(36).slice(2, 6);
    263    return `freya-${ts}-${seq}-${rand}`;
    264  }
    

apps/freya/api/src/other-routes.ts#

  • L232

    ts
    230    if (!parsed.success)
    231      return { success: false, error: 'Validation failed', validationErrors: parsed.error.issues };
    232    const qty = Math.floor(Math.random() * 30);
    233    const stockLevel = qty === 0 ? 'OUT_OF_STOCK' : qty < 5 ? 'LOW' : qty <= 20 ? 'ADEQUATE' : 'HIGH';
    234    return {
    

apps/freya/shop/src/customer-account.ts#

  • L60

    ts
    58        throw new Error(`Email already registered: ${params.email}`);
    59      }
    60      const id = `cust-${Date.now()}-${Math.random().toString(36).substring(2, 7)}`;
    61      const profile: CustomerProfile = {
    62        id,
    

apps/hathor/narrative-api/src/services/dialogue.service.ts#

  • L965

    ts
    963              const totalWeight = weights.reduce((sum, w) => sum + w, 0);
    964              if (totalWeight > 0) {
    965                let roll = Math.random() * totalWeight;
    966                let selectedIndex = targets.length - 1;
    967                for (let i = 0; i < weights.length; i++) {
    
  • L977

    ts
    975              } else {
    976                // All weights zero — fall back to uniform
    977                nextNodeId = targets[Math.floor(Math.random() * targets.length)];
    978              }
    979            } else {
    
  • L981

    ts
    979            } else {
    980              // No weights or length mismatch — uniform random selection
    981              nextNodeId = targets[Math.floor(Math.random() * targets.length)];
    982            }
    983          }
    

apps/hathor/narrative-api/src/services/validation.service.ts#

  • L1769

    ts
    1767      // Publish validation event
    1768      if (this.eventPublisher) {
    1769        const validationId = `val-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    1770
    1771        const checks = batchResult.results.flatMap((r) =>
    

apps/hathor/simulation-worker/src/workers/culture-worker.ts#

  • L298

    ts
    296
    297      return {
    298        id: `culture-snapshot-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    299        date: date.toISOString(),
    300        totalCultures: cultures.length,
    

apps/hathor/simulation-worker/src/workers/economy-worker.ts#

  • L297

    ts
    295
    296      return {
    297        id: `snapshot-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    298        date,
    299        gdp,
    

apps/hathor/svc-veilborn-core/src/abilities.ts#

  • L1188

    ts
    1186    _currentRound: number
    1187  ): EnvironmentalEffect {
    1188    if (!effect.spreads || Math.random() * 100 > (effect.spreadChance ?? 50)) {
    1189      return effect;
    1190    }
    
  • L1215

    ts
    1213
    1214    // Pick random candidate
    1215    const newHex = candidates[Math.floor(Math.random() * candidates.length)];
    1216
    1217    return {
    

apps/hathor/svc-veilborn-core/src/asset-gen.ts#

  • L92

    ts
    90    async generate(prompt: string, params: GenerationParams): Promise<GeneratedImage> {
    91      const id = `mock-img-${++this.imageCounter}-${Date.now()}`;
    92      const seed = params.seed || Math.floor(Math.random() * 1000000);
    93
    94      return {
    
  • L104

    ts
    102        metadata: {
    103          provider: 'mock',
    104          processingTime: 50 + Math.random() * 50,
    105        },
    106      };
    

apps/hathor/svc-veilborn-core/src/beta-program.ts#

  • L444

    ts
    442      let code = 'VB-';
    443      for (let i = 0; i < 8; i++) {
    444        code += chars.charAt(Math.floor(Math.random() * chars.length));
    445      }
    446      return code;
    

apps/hathor/svc-veilborn-core/src/cards.ts#

  • L406

    ts
    404   */
    405  export function generateCardInstanceId(): string {
    406    return `card-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    407  }
    408
    
  • L594

    ts
    592    const shuffled = [...array];
    593    for (let i = shuffled.length - 1; i > 0; i--) {
    594      const j = Math.floor(Math.random() * (i + 1));
    595      [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
    596    }
    
  • L1040

    ts
    1038
    1039        case 'random':
    1040          value = Math.random() * 100;
    1041          checkValue = typeof condition.value === 'number' ? condition.value : 50;
    1042          break;
    
  • L1782

    ts
    1780    packType: PackType,
    1781    availableCards: { id: string; rarity: CardRarity; setId?: string }[],
    1782    randomFn: () => number = Math.random
    1783  ): { collection: CardCollection; result: PackResult } {
    1784    const config = PACK_CONTENTS[packType];
    
  • L2393

    ts
    2391   */
    2392  export function generateTradeId(): string {
    2393    return `trade-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    2394  }
    2395
    
  • L2400

    ts
    2398   */
    2399  export function generateLoanId(): string {
    2400    return `loan-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    2401  }
    2402
    
  • L2407

    ts
    2405   */
    2406  export function generateGiftId(): string {
    2407    return `gift-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    2408  }
    2409
    
  • L2937

    ts
    2935  export function createCardSharingSession(partyId: string, playerIds: string[]): CardSharingSession {
    2936    return {
    2937      id: `sharing-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    2938      partyId,
    2939      playerIds,
    
  • L3225

    ts
    3223   */
    3224  export function generateBalanceTestId(): string {
    3225    return `balance-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    3226  }
    3227
    

apps/hathor/svc-veilborn-core/src/character-creation.ts#

  • L549

    ts
    547   */
    548  export function generateCharacterId(): string {
    549    return `char-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    550  }
    551
    

apps/hathor/svc-veilborn-core/src/character-sheet.ts#

  • L267

    ts
    265   */
    266  export function generateItemId(): string {
    267    return `item-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    268  }
    269
    
  • L536

    ts
    534   */
    535  export function generateNoteId(): string {
    536    return `note-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    537  }
    538
    
  • L643

    ts
    641   */
    642  export function generateJournalId(): string {
    643    return `journal-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    644  }
    645
    
  • L861

    ts
    859   */
    860  export function generateShareId(): string {
    861    return `share-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    862  }
    863
    

apps/hathor/svc-veilborn-core/src/combat-ai.ts#

  • L313

    ts
    311    const difficultyNoise = getDifficultyNoise(config.difficulty);
    312
    313    if (difficultyNoise > 0 && Math.random() < difficultyNoise) {
    314      // Lower difficulty may pick suboptimal targets
    315      const randomIndex = Math.floor(Math.random() * Math.min(3, threats.length));
    
  • L315

    ts
    313    if (difficultyNoise > 0 && Math.random() < difficultyNoise) {
    314      // Lower difficulty may pick suboptimal targets
    315      const randomIndex = Math.floor(Math.random() * Math.min(3, threats.length));
    316      const targetId = threats[randomIndex].targetId;
    317      return state.combatants.get(targetId) ?? null;
    
  • L467

    ts
    465    const difficultyNoise = getDifficultyNoise(config.difficulty);
    466
    467    if (difficultyNoise > 0 && Math.random() < difficultyNoise && positions.length > 1) {
    468      const randomIndex = Math.floor(Math.random() * Math.min(3, positions.length));
    469      return positions[randomIndex];
    
  • L468

    ts
    466
    467    if (difficultyNoise > 0 && Math.random() < difficultyNoise && positions.length > 1) {
    468      const randomIndex = Math.floor(Math.random() * Math.min(3, positions.length));
    469      return positions[randomIndex];
    470    }
    
  • L1042

    ts
    1040    const difficultyNoise = getDifficultyNoise(config.difficulty);
    1041
    1042    if (difficultyNoise > 0 && Math.random() < difficultyNoise && decisions.length > 1) {
    1043      // Lower difficulties may choose suboptimal decisions
    1044      const numToConsider = Math.min(3, decisions.length);
    
  • L1045

    ts
    1043      // Lower difficulties may choose suboptimal decisions
    1044      const numToConsider = Math.min(3, decisions.length);
    1045      const randomIndex = Math.floor(Math.random() * numToConsider);
    1046      return decisions[randomIndex];
    1047    }
    

apps/hathor/svc-veilborn-core/src/combat.ts#

  • L763

    ts
    761    const tokens: TideToken[] = combatantIds.map((id) => ({
    762      combatantId: id,
    763      value: Math.floor(Math.random() * 20) + 1, // Initial roll
    764      modifiers: [],
    765    }));
    

apps/hathor/svc-veilborn-core/src/data-access.ts#

  • L323

    ts
    321  export function generateUUID(): string {
    322    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    323      const r = (Math.random() * 16) | 0;
    324      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    325      return v.toString(16);
    
  • L887

    ts
    885      let code = '';
    886      for (let i = 0; i < 6; i++) {
    887        code += chars.charAt(Math.floor(Math.random() * chars.length));
    888      }
    889      return code;
    

apps/hathor/svc-veilborn-core/src/dice.ts#

  • L77

    ts
    75
    76  /**
    77   * Default random number generator using Math.random
    78   */
    79  export function defaultRandom(): number {
    
  • L80

    ts
    78   */
    79  export function defaultRandom(): number {
    80    return Math.floor(Math.random() * DICE_SIDES) + 1;
    81  }
    82
    

apps/hathor/svc-veilborn-core/src/game-state.ts#

  • L74

    ts
    72
    73  function generateId(): string {
    74    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    75  }
    76
    

apps/hathor/svc-veilborn-core/src/multiplayer.ts#

  • L402

    ts
    400    let code = '';
    401    for (let i = 0; i < 6; i++) {
    402      code += chars.charAt(Math.floor(Math.random() * chars.length));
    403    }
    404    return code;
    
  • L1219

    ts
    1217      const results: number[] = [];
    1218      for (let i = 0; i < parsed.count; i++) {
    1219        results.push(Math.floor(Math.random() * parsed.sides) + 1);
    1220      }
    1221
    
  • L1811

    ts
    1809
    1810      const action: GameAction = {
    1811        id: `action-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    1812        type: actionType,
    1813        playerId,
    

apps/hathor/svc-veilborn-core/src/territory-control.ts#

  • L559

    ts
    557      this.history.push({
    558        ...entry,
    559        id: `hist_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    560        timestamp: Date.now(),
    561      });
    

apps/hathor/svc-veilborn-core/src/veylmaster.ts#

  • L234

    ts
    232      const results: number[] = [];
    233      for (let i = 0; i < count; i++) {
    234        results.push(Math.floor(Math.random() * sides) + 1);
    235      }
    236      return results;
    
  • L733

    ts
    731      }
    732
    733      const selected = candidates[Math.floor(Math.random() * candidates.length)];
    734      return this.generateQuest(selected.id);
    735    }
    
  • L1017

    ts
    1015     */
    1016    generateName(): string {
    1017      const first = this.firstNames[Math.floor(Math.random() * this.firstNames.length)];
    1018      const last = this.lastNames[Math.floor(Math.random() * this.lastNames.length)];
    1019      return `${first} ${last}`;
    
  • L1018

    ts
    1016    generateName(): string {
    1017      const first = this.firstNames[Math.floor(Math.random() * this.firstNames.length)];
    1018      const last = this.lastNames[Math.floor(Math.random() * this.lastNames.length)];
    1019      return `${first} ${last}`;
    1020    }
    
  • L1082

    ts
    1080            'hunter',
    1081          ];
    1082      const selectedRole = roles[Math.floor(Math.random() * roles.length)];
    1083
    1084      const allTraits: PersonalityTrait[] = [
    
  • L1098

    ts
    1096
    1097      // Pick 2-3 random traits
    1098      const traitCount = 2 + Math.floor(Math.random() * 2);
    1099      const traits: PersonalityTrait[] = [];
    1100      const shuffled = [...allTraits].sort(() => Math.random() - 0.5);
    
  • L1100

    ts
    1098      const traitCount = 2 + Math.floor(Math.random() * 2);
    1099      const traits: PersonalityTrait[] = [];
    1100      const shuffled = [...allTraits].sort(() => Math.random() - 0.5);
    1101      for (let i = 0; i < traitCount; i++) {
    1102        traits.push(shuffled[i]);
    
  • L1106

    ts
    1104
    1105      const dispositions: NPCDisposition[] = ['unfriendly', 'neutral', 'neutral', 'friendly'];
    1106      const disposition = dispositions[Math.floor(Math.random() * dispositions.length)];
    1107
    1108      return {
    
  • L1149

    ts
    1147      const newMemory: NPCMemory = {
    1148        ...memory,
    1149        id: `mem-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    1150        timestamp: new Date().toISOString(),
    1151      };
    
  • L1589

    ts
    1587      const newEntry: JournalEntry = {
    1588        ...entry,
    1589        id: `journal-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    1590        sessionId,
    1591        timestamp: new Date().toISOString(),
    

apps/hathor/svc-veilborn-core/src/wargame.ts#

  • L941

    ts
    939
    940    const unit: ArmyUnit = {
    941      id: `unit-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    942      templateId,
    943      name: customName || template.name,
    
  • L1358

    ts
    1356   */
    1357  export function roll2d6(modifier: number = 0, target: number = 7): DiceResult {
    1358    const die1 = Math.floor(Math.random() * 6) + 1;
    1359    const die2 = Math.floor(Math.random() * 6) + 1;
    1360    const total = die1 + die2;
    
  • L1359

    ts
    1357  export function roll2d6(modifier: number = 0, target: number = 7): DiceResult {
    1358    const die1 = Math.floor(Math.random() * 6) + 1;
    1359    const die2 = Math.floor(Math.random() * 6) + 1;
    1360    const total = die1 + die2;
    1361    const finalResult = total + modifier;
    
  • L1649

    ts
    1647      const unitPool = prioritizedUnits.length > 0 ? prioritizedUnits : affordableUnits;
    1648
    1649      const selectedUnit = unitPool[Math.floor(Math.random() * unitPool.length)];
    1650      currentArmy = addUnitToArmy(currentArmy, selectedUnit.id);
    1651    }
    

apps/hathor/svc-veilborn-core/src/weave.ts#

  • L123

    ts
    121   */
    122  export function generateId(): string {
    123    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    124  }
    125
    

apps/hathor/svc-veilborn-core/src/world-gen.ts#

  • L2632

    ts
    2630
    2631          // Chance of dungeon
    2632          if (Math.random() < 0.3) {
    2633            locations.push(this.location.generateDungeon({ regionId }));
    2634          }
    

apps/hathor/svc-veilborn-strategy/src/ai-opponent.ts#

  • L600

    ts
    598    ): GameAction {
    599      return {
    600        id: `ai_move_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    601        playerId: this.playerId,
    602        type: 'move_army',
    
  • L616

    ts
    614    ): GameAction {
    615      return {
    616        id: `ai_attack_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    617        playerId: this.playerId,
    618        type: 'attack',
    
  • L632

    ts
    630    ): GameAction {
    631      return {
    632        id: `ai_veil_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    633        playerId: this.playerId,
    634        type: 'cast_veil_strike',
    
  • L649

    ts
    647    ): GameAction {
    648      return {
    649        id: `ai_passage_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    650        playerId: this.playerId,
    651        type: 'use_hidden_passage',
    
  • L665

    ts
    663    ): GameAction {
    664      return {
    665        id: `ai_alliance_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    666        playerId: this.playerId,
    667        type: 'form_alliance',
    
  • L677

    ts
    675    private createBreakAllianceAction(gameState: VeilWarGameState, allianceId: string): GameAction {
    676      return {
    677        id: `ai_break_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    678        playerId: this.playerId,
    679        type: 'break_alliance',
    
  • L693

    ts
    691    ): GameAction {
    692      return {
    693        id: `ai_recruit_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    694        playerId: this.playerId,
    695        type: 'recruit_unit',
    
  • L705

    ts
    703    private createBuildFortificationAction(gameState: VeilWarGameState, nodeId: NodeId): GameAction {
    704      return {
    705        id: `ai_build_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    706        playerId: this.playerId,
    707        type: 'build_fortification',
    
  • L717

    ts
    715    private createEndPhaseAction(gameState: VeilWarGameState): GameAction {
    716      return {
    717        id: `ai_end_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    718        playerId: this.playerId,
    719        type: 'end_phase',
    
  • L768

    ts
    766
    767      // Apply difficulty-based noise
    768      if (Math.random() < this.difficultyParams.mistakeChance) {
    769        score *= 0.5; // Sometimes make mistakes
    770      }
    
  • L1018

    ts
    1016
    1017      // Deterministic selection for low randomness
    1018      if (Math.random() > randomFactor) {
    1019        return scoredActions[0] ?? null;
    1020      }
    
  • L1024

    ts
    1022      // Weighted random selection
    1023      const totalScore = scoredActions.reduce((sum, a) => sum + Math.max(1, a.score), 0);
    1024      let random = Math.random() * totalScore;
    1025
    1026      for (const action of scoredActions) {
    

apps/hathor/svc-veilborn-strategy/src/ai/ai-common.ts#

  • L465

    ts
    463        this.randomGen = this.createSeededRandom(config.randomSeed);
    464      } else {
    465        this.randomGen = Math.random;
    466      }
    467    }
    
  • L790

    ts
    788      case 'resonance_wars':
    789        // Bluffing-heavy mode benefits from deceptive/analytical
    790        return Math.random() > 0.5 ? 'deceptive' : 'analytical';
    791      case 'eternal_game':
    792        // Go-like mode benefits from methodical/defensive
    
  • L793

    ts
    791      case 'eternal_game':
    792        // Go-like mode benefits from methodical/defensive
    793        return Math.random() > 0.5 ? 'methodical' : 'defensive';
    794      case 'echoes_of_fate':
    795        // Temporal mode benefits from analytical/methodical
    
  • L796

    ts
    794      case 'echoes_of_fate':
    795        // Temporal mode benefits from analytical/methodical
    796        return Math.random() > 0.5 ? 'analytical' : 'methodical';
    797      case 'weave_conspiracy':
    798        // Social deduction benefits from deceptive/diplomatic
    
  • L799

    ts
    797      case 'weave_conspiracy':
    798        // Social deduction benefits from deceptive/diplomatic
    799        return Math.random() > 0.5 ? 'deceptive' : 'diplomatic';
    800      case 'veil_war':
    801      default:
    

apps/hathor/svc-veilborn-strategy/src/ai/ai-game-master.ts#

  • L187

    ts
    185
    186  function generateId(prefix: string): string {
    187    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    188  }
    189
    
  • L293

    ts
    291
    292      if (templates) {
    293        title = templates.titles[Math.floor(Math.random() * templates.titles.length)];
    294        description =
    295          templates.descriptions[Math.floor(Math.random() * templates.descriptions.length)];
    
  • L295

    ts
    293        title = templates.titles[Math.floor(Math.random() * templates.titles.length)];
    294        description =
    295          templates.descriptions[Math.floor(Math.random() * templates.descriptions.length)];
    296      } else {
    297        // Fallback for unknown event types
    
  • L941

    ts
    939
    940      const template =
    941        situationTemplates[Math.floor(Math.random() * situationTemplates.length)] ||
    942        'Greetings, traveler.';
    943
    
  • L977

    ts
    975
    976      return {
    977        text: templates[Math.floor(Math.random() * templates.length)],
    978        emotionalTone: 'tense',
    979      };
    

apps/hathor/svc-veilborn-strategy/src/balance/balance-pipeline.ts#

  • L179

    ts
    177      matchCount: number
    178    ): BalanceExperiment {
    179      const id = `experiment-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    180
    181      // Get control values from current config
    

apps/hathor/svc-veilborn-strategy/src/balance/tournament-runner.ts#

  • L159

    ts
    157          if (!hasPlayed || j === sortedParticipants.length - 1) {
    158            const firstPlayer =
    159              Math.random() > 0.5 ? sortedParticipants[i]!.id : sortedParticipants[j]!.id;
    160            const secondPlayer =
    161              firstPlayer === sortedParticipants[i]!.id
    

apps/hathor/svc-veilborn-strategy/src/data-access.ts#

  • L149

    ts
    147
    148  function generateId(prefix: string): string {
    149    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    150  }
    151
    

apps/hathor/svc-veilborn-strategy/src/echoes-of-fate/timeline-engine.ts#

  • L56

    ts
    54
    55  function generateId(prefix: string): string {
    56    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    57  }
    58
    
  • L731

    ts
    729
    730      const successChance = prophecy.probability * (fulfillInfluence / (totalInfluence || 1));
    731      const roll = Math.random();
    732
    733      if (roll <= successChance) {
    
  • L809

    ts
    807
    808      const successChance = (1 - prophecy.probability) * (subvertInfluence / (totalInfluence || 1));
    809      const roll = Math.random();
    810
    811      if (roll <= successChance) {
    

apps/hathor/svc-veilborn-strategy/src/eternal-game/influence-engine.ts#

  • L56

    ts
    54
    55  function generateId(prefix: string): string {
    56    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    57  }
    58
    

apps/hathor/svc-veilborn-strategy/src/grand-campaign/campaign-manager.ts#

  • L68

    ts
    66
    67  function generateId(prefix: string): string {
    68    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    69  }
    70
    
  • L254

    ts
    252      const shuffled = [...players];
    253      for (let i = shuffled.length - 1; i > 0; i--) {
    254        const j = Math.floor(Math.random() * (i + 1));
    255        [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
    256      }
    
  • L285

    ts
    283
    284        let type: TerritoryType = 'heartland';
    285        if (sacredSitesPlaced < sacredSites && Math.random() < 0.15) {
    286          type = 'sacred_site';
    287          sacredSitesPlaced++;
    
  • L288

    ts
    286          type = 'sacred_site';
    287          sacredSitesPlaced++;
    288        } else if (nexusesPlaced < nexuses && Math.random() < 0.1) {
    289          type = 'nexus';
    290          nexusesPlaced++;
    
  • L293

    ts
    291        } else if (x === 0 || x === gridSize - 1 || y === 0 || y === Math.floor(count / gridSize)) {
    292          type = 'borderland';
    293        } else if (Math.random() < 0.1) {
    294          type = 'wasteland';
    295        }
    
  • L332

    ts
    330
    331      const suffixes = ['Vale', 'Reach', 'Heights', 'Crossing', 'Domain', 'Fields', 'Gate'];
    332      const prefix = prefixes[type][Math.floor(Math.random() * prefixes[type].length)];
    333      const suffix = suffixes[Math.floor(Math.random() * suffixes.length)];
    334
    
  • L333

    ts
    331      const suffixes = ['Vale', 'Reach', 'Heights', 'Crossing', 'Domain', 'Fields', 'Gate'];
    332      const prefix = prefixes[type][Math.floor(Math.random() * prefixes[type].length)];
    333      const suffix = suffixes[Math.floor(Math.random() * suffixes.length)];
    334
    335      return `${prefix} ${suffix}`;
    
  • L578

    ts
    576      // Shuffle
    577      for (let i = templates.length - 1; i > 0; i--) {
    578        const j = Math.floor(Math.random() * (i + 1));
    579        [templates[i], templates[j]] = [templates[j], templates[i]];
    580      }
    

apps/hathor/svc-veilborn-strategy/src/grand-campaign/mode-orchestrator.ts#

  • L566

    ts
    564
    565        // Simple combat resolution
    566        const attackerDamage = Math.random() * this.battleState.attacker.strength * 0.2;
    567        const defenderDamage = Math.random() * this.battleState.defender.strength * 0.2;
    568
    
  • L567

    ts
    565        // Simple combat resolution
    566        const attackerDamage = Math.random() * this.battleState.attacker.strength * 0.2;
    567        const defenderDamage = Math.random() * this.battleState.defender.strength * 0.2;
    568
    569        this.battleState.defender.strength -= attackerDamage;
    
  • L703

    ts
    701      for (let i = 0; i < rounds; i++) {
    702        for (const playerId of this.context.participants) {
    703          const action = Math.random();
    704          const currentInfluence = this.timelineState.playerInfluence.get(playerId) ?? 0;
    705
    
  • L710

    ts
    708            this.timelineState.playerInfluence.set(
    709              playerId,
    710              currentInfluence + 10 + Math.random() * 10
    711            );
    712            this.timelineState.eventsCreated++;
    
  • L719

    ts
    717          } else {
    718            // Risky temporal manipulation
    719            if (Math.random() < 0.3) {
    720              this.timelineState.paradoxes++;
    721              this.timelineState.stability -= 15;
    
  • L841

    ts
    839        for (const playerId of this.context.participants) {
    840          // Simulate intent selection and resolution
    841          const intentSuccess = Math.random();
    842          const currentScore = this.combatState.playerScores.get(playerId) ?? 0;
    843          const currentChain = this.combatState.synergyChains.get(playerId) ?? 0;
    
  • L962

    ts
    960
    961        // Random mission outcome based on player "loyalty"
    962        const sabotageChance = Math.random();
    963        if (sabotageChance < 0.3) {
    964          // Mission sabotaged
    
  • L966

    ts
    964          // Mission sabotaged
    965          const saboteur =
    966            this.context.participants[Math.floor(Math.random() * this.context.participants.length)];
    967          this.conspiracyState.betrayals.push(saboteur);
    968          const currentTrust = this.conspiracyState.trustedPlayers.get(saboteur) ?? 50;
    
  • L1110

    ts
    1108        for (const playerId of this.context.participants) {
    1109          // Place a stone
    1110          const x = Math.floor(Math.random() * this.gameState.boardSize);
    1111          const y = Math.floor(Math.random() * this.gameState.boardSize);
    1112          const key = `${x},${y}`;
    
  • L1111

    ts
    1109          // Place a stone
    1110          const x = Math.floor(Math.random() * this.gameState.boardSize);
    1111          const y = Math.floor(Math.random() * this.gameState.boardSize);
    1112          const key = `${x},${y}`;
    1113
    
  • L1115

    ts
    1113
    1114          if (!this.gameState.stones.has(key)) {
    1115            const resonance = resonanceTypes[Math.floor(Math.random() * resonanceTypes.length)];
    1116            this.gameState.stones.set(key, { owner: playerId, resonance });
    1117
    

apps/hathor/svc-veilborn-strategy/src/grand-campaign/types.ts#

  • L1176

    ts
    1174
    1175  export function generateCampaignId(): CampaignId {
    1176    return `campaign_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1177  }
    1178
    
  • L1180

    ts
    1178
    1179  export function generateSessionId(): SessionId {
    1180    return `session_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1181  }
    1182
    
  • L1184

    ts
    1182
    1183  export function generateModeInstanceId(): ModeInstanceId {
    1184    return `mode_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1185  }
    1186
    

apps/hathor/svc-veilborn-strategy/src/resonance-wars/combat-engine.ts#

  • L51

    ts
    49
    50  function generateId(prefix: string): string {
    51    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    52  }
    53
    

apps/hathor/svc-veilborn-strategy/src/routes/temporal-routes.ts#

  • L301

    ts
    299        // Build temporal action
    300        const temporalAction: TemporalAction = {
    301          id: `action_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    302          agentId: playerId,
    303          type: action.type as TemporalActionType,
    

apps/hathor/svc-veilborn-strategy/src/weave-conspiracy/conspiracy-engine.ts#

  • L61

    ts
    59
    60  function generateId(prefix: string): string {
    61    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    62  }
    63
    
  • L67

    ts
    65    const result = [...array];
    66    for (let i = result.length - 1; i > 0; i--) {
    67      const j = Math.floor(Math.random() * (i + 1));
    68      [result[i], result[j]] = [result[j], result[i]];
    69    }
    
  • L265

    ts
    263      const traitorCount = Math.min(
    264        Math.floor(
    265          Math.random() * (agendaDistribution.maxTraitors - agendaDistribution.minTraitors + 1)
    266        ) + agendaDistribution.minTraitors,
    267        playerCount - agendaDistribution.guaranteedTrueBeliever
    
  • L326

    ts
    324        ];
    325        const otherFactions = factions.filter((f) => f !== faction);
    326        agenda.hiddenFaction = otherFactions[Math.floor(Math.random() * otherFactions.length)];
    327      }
    328
    
  • L348

    ts
    346        'Five players shall survive to the end',
    347      ];
    348      return prophecies[Math.floor(Math.random() * prophecies.length)];
    349    }
    350
    
  • L606

    ts
    604
    605        // Check for casualties
    606        if (Math.random() < mission.penaltyOnFailure.casualtiesRisk) {
    607          const casualtyIndex = Math.floor(Math.random() * mission.teamMembers.length);
    608          const casualtyId = mission.teamMembers[casualtyIndex];
    
  • L607

    ts
    605        // Check for casualties
    606        if (Math.random() < mission.penaltyOnFailure.casualtiesRisk) {
    607          const casualtyIndex = Math.floor(Math.random() * mission.teamMembers.length);
    608          const casualtyId = mission.teamMembers[casualtyIndex];
    609          this.eliminatePlayer(casualtyId, 'Mission failure casualty');
    
  • L717

    ts
    715
    716      // Apply accuracy - some roles can deceive
    717      const isAccurate = Math.random() < ability.accuracy;
    718
    719      switch (revelationType) {
    
  • L728

    ts
    726          revealedInfo = isAccurate
    727            ? `Agenda progress: ${target.hiddenAgenda.completionProgress}%`
    728            : `Agenda progress: ${Math.floor(Math.random() * 100)}%`;
    729          break;
    730        case 'hidden_faction':
    
  • L745

    ts
    743              ? 'Recent sabotage detected'
    744              : 'No recent sabotage'
    745            : Math.random() < 0.5
    746              ? 'Recent sabotage detected'
    747              : 'No recent sabotage';
    
  • L756

    ts
    754              ? 'True to their faction'
    755              : 'Has hidden motives'
    756            : Math.random() < 0.5
    757              ? 'True to their faction'
    758              : 'Has hidden motives';
    
  • L796

    ts
    794        'collector',
    795      ];
    796      return types[Math.floor(Math.random() * types.length)];
    797    }
    798
    
  • L814

    ts
    812        'exemplar',
    813      ];
    814      return factions[Math.floor(Math.random() * factions.length)];
    815    }
    816
    
  • L1148

    ts
    1146      // Calculate detection probability
    1147      const detectionChance = this.calculateSabotageDetection(saboteur, target, sabotageType);
    1148      const wasDetected = Math.random() < detectionChance;
    1149
    1150      const sabotage: SabotageAction = {
    
  • L1263

    ts
    1261      const seers = potentialWitnesses.filter((p) => p.publicAllegiance.faction === 'seer');
    1262      if (seers.length > 0) {
    1263        return seers[Math.floor(Math.random() * seers.length)].playerId;
    1264      }
    1265
    
  • L1266

    ts
    1264      }
    1265
    1266      return potentialWitnesses[Math.floor(Math.random() * potentialWitnesses.length)].playerId;
    1267    }
    1268
    
  • L1305

    ts
    1303      ) {
    1304        // Roll for resistance
    1305        const resisted = Math.random() < 0.3 - player.voidCorruption.resistanceRolls * 0.1;
    1306        player.voidCorruption.resistanceRolls++;
    1307
    

apps/hathor/workbench/src/components/Modal.tsx#

  • L22

    ts
    20    const modalRef = useRef<HTMLDivElement>(null);
    21    const previousActiveElement = useRef<HTMLElement | null>(null);
    22    const generatedTitleId = titleId ?? `modal-title-${Math.random().toString(36).substr(2, 9)}`;
    23
    24    // Focus trap: Get all focusable elements
    

apps/hestia/api/src/graphql/context.ts#

  • L122

    ts
    120      user,
    121      requestId:
    122        request.ctx?.requestId ?? `gql-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    123      requestTime: new Date().toISOString(),
    124      isAuthenticated: user !== undefined,
    

apps/hestia/api/src/graphql/plugin.ts#

  • L107

    ts
    105        return {
    106          user,
    107          requestId: `gql-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    108          requestTime: new Date().toISOString(),
    109          isAuthenticated: user !== undefined,
    

apps/hestia/api/src/graphql/resolvers/cooking-session.ts#

  • L48

    ts
    46  function generateId(): string {
    47    sessionIdCounter += 1;
    48    return `cs-${Date.now()}-${sessionIdCounter}-${Math.random().toString(36).slice(2, 8)}`;
    49  }
    50
    

apps/hestia/api/src/graphql/resolvers/index.ts#

  • L176

    ts
    174  function generateSlId(): string {
    175    slIdCounter += 1;
    176    return `sl-${Date.now()}-${slIdCounter}-${Math.random().toString(36).slice(2, 8)}`;
    177  }
    178
    

apps/hestia/api/src/graphql/resolvers/meal-plan.ts#

  • L50

    ts
    48  function generateId(prefix: string = 'mp'): string {
    49    mpIdCounter += 1;
    50    return `${prefix}-${Date.now()}-${mpIdCounter}-${Math.random().toString(36).slice(2, 8)}`;
    51  }
    52
    

apps/hestia/api/src/graphql/resolvers/pantry.ts#

  • L45

    ts
    43  function generateId(): string {
    44    pantryIdCounter += 1;
    45    return `pantry-${Date.now()}-${pantryIdCounter}-${Math.random().toString(36).slice(2, 8)}`;
    46  }
    47
    

apps/hestia/api/src/graphql/resolvers/recipe.ts#

  • L76

    ts
    74  function generateId(prefix: string = 'rec'): string {
    75    idCounter += 1;
    76    return `${prefix}-${Date.now()}-${idCounter}-${Math.random().toString(36).slice(2, 8)}`;
    77  }
    78
    
  • L314

    ts
    312        id: generateId('rec'),
    313        title: input.title.trim(),
    314        slug: slugify(input.title) + '-' + Math.random().toString(36).slice(2, 8),
    315        description: input.description ?? '',
    316        servings: input.servings ?? 4,
    

apps/hestia/web/src/app/(app)/admin/api-keys/page.tsx#

  • L256

    ts
    254        id: `ak${keys.length + 1}`,
    255        name: newKey.name,
    256        keyPrefix: `hst_new_${Math.random().toString(36).slice(2, 6)}`,
    257        permissions: newKey.permissions,
    258        rateLimit: Number(newKey.rateLimit) || 1000,
    

apps/hestia/web/src/app/(app)/nutrition/page.tsx#

  • L53

    ts
    51    return {
    52      date: format(dateObj, 'yyyy-MM-dd'),
    53      calories: 1800 + Math.floor(Math.random() * 600),
    54      protein: 90 + Math.floor(Math.random() * 50),
    55      carbs: 200 + Math.floor(Math.random() * 100),
    
  • L54

    ts
    52      date: format(dateObj, 'yyyy-MM-dd'),
    53      calories: 1800 + Math.floor(Math.random() * 600),
    54      protein: 90 + Math.floor(Math.random() * 50),
    55      carbs: 200 + Math.floor(Math.random() * 100),
    56      fat: 50 + Math.floor(Math.random() * 40),
    
  • L55

    ts
    53      calories: 1800 + Math.floor(Math.random() * 600),
    54      protein: 90 + Math.floor(Math.random() * 50),
    55      carbs: 200 + Math.floor(Math.random() * 100),
    56      fat: 50 + Math.floor(Math.random() * 40),
    57      fiber: 18 + Math.floor(Math.random() * 15),
    
  • L56

    ts
    54      protein: 90 + Math.floor(Math.random() * 50),
    55      carbs: 200 + Math.floor(Math.random() * 100),
    56      fat: 50 + Math.floor(Math.random() * 40),
    57      fiber: 18 + Math.floor(Math.random() * 15),
    58      sugar: 30 + Math.floor(Math.random() * 30),
    
  • L57

    ts
    55      carbs: 200 + Math.floor(Math.random() * 100),
    56      fat: 50 + Math.floor(Math.random() * 40),
    57      fiber: 18 + Math.floor(Math.random() * 15),
    58      sugar: 30 + Math.floor(Math.random() * 30),
    59      sodium: 1600 + Math.floor(Math.random() * 1000),
    
  • L58

    ts
    56      fat: 50 + Math.floor(Math.random() * 40),
    57      fiber: 18 + Math.floor(Math.random() * 15),
    58      sugar: 30 + Math.floor(Math.random() * 30),
    59      sodium: 1600 + Math.floor(Math.random() * 1000),
    60      water: 1500 + Math.floor(Math.random() * 1500),
    
  • L59

    ts
    57      fiber: 18 + Math.floor(Math.random() * 15),
    58      sugar: 30 + Math.floor(Math.random() * 30),
    59      sodium: 1600 + Math.floor(Math.random() * 1000),
    60      water: 1500 + Math.floor(Math.random() * 1500),
    61    };
    
  • L60

    ts
    58      sugar: 30 + Math.floor(Math.random() * 30),
    59      sodium: 1600 + Math.floor(Math.random() * 1000),
    60      water: 1500 + Math.floor(Math.random() * 1500),
    61    };
    62  });
    

apps/hestia/web/src/app/(app)/pantry/bulk/page.tsx#

  • L289

    ts
    287  function createEmptyRow(): BulkEntryRow {
    288    return {
    289      id: `row-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    290      name: '',
    291      quantity: '1',
    
  • L335

    ts
    333      const newRows: BulkEntryRow[] = template.items.map((item) => ({
    334        ...item,
    335        id: `row-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    336      }));
    337      setRows(newRows);
    
  • L349

    ts
    347        const parts = line.split(',').map((p) => p.trim());
    348        return {
    349          id: `row-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    350          name: parts[0] || '',
    351          quantity: parts[1] || '1',
    

apps/hestia/web/src/app/(app)/recipes/analytics/page.tsx#

  • L180

    ts
    178        days.push({
    179          date: date.toISOString().split('T')[0],
    180          count: Math.floor(Math.random() * 4),
    181          dayOfWeek: d,
    182          weekOfYear: 11 - w,
    

apps/hestia/web/src/stores/cooking-store.ts#

  • L77

    ts
    75
    76    startSession: (recipe) => {
    77      const id = `session-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
    78      const session: CookingSession = {
    79        id,
    

apps/iris/api/src/graphql/index.ts#

  • L249

    ts
    247    ): Promise<MessageGQL> {
    248      const msgs = this.messages.get(conversationId) ?? [];
    249      const id = `msg-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    250
    251      const message: MessageGQL = {
    
  • L401

    ts
    399
    400    private createConversationId(): string {
    401      return `conv-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    402    }
    403
    
  • L405

    ts
    403
    404    private createMessageId(): string {
    405      return `msg-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    406    }
    407  }
    
  • L494

    ts
    492      const key = `${userId}:${sessionId}`;
    493      const entries = this.workingMemory.get(key) ?? [];
    494      const id = `wm-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    495
    496      const entry: WorkingMemoryEntryGQL = {
    
  • L546

    ts
    544    ): Promise<ArchivalMemoryEntryGQL> {
    545      const entries = this.archivalMemory.get(userId) ?? [];
    546      const id = `am-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    547      const now = new Date().toISOString();
    548
    
  • L597

    ts
    595    ): Promise<EpisodicMemoryEntryGQL> {
    596      const entries = this.episodicMemory.get(userId) ?? [];
    597      const id = `em-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    598
    599      const entry: EpisodicMemoryEntryGQL = {
    
  • L839

    ts
    837
    838    async create(userId: string, input: CreateAgentInput): Promise<AgentGQL> {
    839      const id = `agent-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    840      const now = new Date().toISOString();
    841
    
  • L928

    ts
    926    async createTask(agentId: string, input: CreateTaskInput): Promise<TaskGQL> {
    927      const tasks = this.tasks.get(agentId) ?? [];
    928      const id = `task-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    929
    930      const task: TaskGQL = {
    
  • L1050

    ts
    1048
    1049    async create(userId: string, input: CreateKnowledgeBaseInput): Promise<KnowledgeBaseGQL> {
    1050      const id = `kb-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    1051      const now = new Date().toISOString();
    1052
    
  • L1141

    ts
    1139    async addDocument(knowledgeBaseId: string, input: CreateDocumentInput): Promise<DocumentGQL> {
    1140      const docs = this.documents.get(knowledgeBaseId) ?? [];
    1141      const id = `doc-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    1142      const now = new Date().toISOString();
    1143
    

apps/iris/developer-portal/src/services/model-distillation-edge-service.ts#

  • L121

    ts
    119      this.options = {
    120        now: options.now ?? (() => new Date()),
    121        random: options.random ?? Math.random,
    122      };
    123    }
    

apps/iris/developer-portal/src/services/model-ensemble-voting-service.ts#

  • L96

    ts
    94      this.options = {
    95        now: options.now ?? (() => new Date()),
    96        random: options.random ?? Math.random,
    97      };
    98    }
    

apps/iris/developer-portal/src/services/model-explanation-generation-service.ts#

  • L94

    ts
    92      this.options = {
    93        now: options.now ?? (() => new Date()),
    94        random: options.random ?? Math.random,
    95      };
    96    }
    

apps/iris/developer-portal/src/services/model-specialization-fine-tuning-service.ts#

  • L123

    ts
    121      this.options = {
    122        now: options.now ?? (() => new Date()),
    123        random: options.random ?? Math.random,
    124      };
    125    }
    

apps/iris/developer-portal/src/services/partner-program-service.ts#

  • L630

    ts
    628        .slice(0, 6)
    629        .padEnd(6, 'X');
    630      return `${prefix}-${Math.random().toString(36).slice(2, 8).toUpperCase()}`;
    631    }
    632
    

apps/iris/mobile/src/services/OfflineSyncService.ts#

  • L233

    ts
    231    ): Promise<string> {
    232      const queue = this.getSyncQueue();
    233      const id = `${type}-${operation}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    234
    235      const item: PendingSyncItem = {
    

apps/iris/mobile/src/services/StorageService.ts#

  • L98

    ts
    96      let key = '';
    97      for (let i = 0; i < 32; i++) {
    98        key += chars.charAt(Math.floor(Math.random() * chars.length));
    99      }
    100      return key;
    

apps/iris/mobile/src/store/chatStore.ts#

  • L114

    ts
    112   */
    113  function generateId(): string {
    114    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    115  }
    116
    

apps/iris/wearable/shared/src/sync.ts#

  • L276

    ts
    274   */
    275  function generateSyncId(): string {
    276    return `sync_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    277  }
    278
    

apps/iris/web/pwa/src/lib/offline-storage.ts#

  • L424

    ts
    422  ): Promise<string> {
    423    const db = await getDB();
    424    const id = `sync-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    425
    426    await db.put('pendingSync', {
    

apps/iris/web/pwa/src/pages/ChatPage.tsx#

  • L353

    ts
    351   */
    352  function generateId(): string {
    353    return Date.now().toString(36) + Math.random().toString(36).substr(2);
    354  }
    355
    

apps/iris/web/widget/src/lib/api.ts#

  • L432

    ts
    430
    431      const randomResponse =
    432        this.mockResponses[Math.floor(Math.random() * this.mockResponses.length)];
    433
    434      return {
    
  • L451

    ts
    449    ): AsyncGenerator<StreamChunk> {
    450      const randomResponse =
    451        this.mockResponses[Math.floor(Math.random() * this.mockResponses.length)];
    452      const fullResponse = `${randomResponse}\n\nYou said: "${content}"`;
    453
    

apps/iris/web/widget/src/widget.ts#

  • L947

    ts
    945     */
    946    private generateId(): string {
    947      return Date.now().toString(36) + Math.random().toString(36).substr(2);
    948    }
    949  }
    

apps/iris/xr/shared/src/anchor-manager.ts#

  • L103

    ts
    101     */
    102    private generateAnchorId(): AnchorId {
    103      return `anchor_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as AnchorId;
    104    }
    105
    

apps/iris/xr/shared/src/session-manager.ts#

  • L137

    ts
    135     */
    136    private generateSessionId(): SessionId {
    137      return `session_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as SessionId;
    138    }
    139
    

apps/iris/xr/shared/src/spatial-ui.ts#

  • L21

    ts
    19   */
    20  export function generateUIElementId(): UIElementId {
    21    return `ui_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as UIElementId;
    22  }
    23
    

apps/iris/xr/shared/src/voice-spatial.ts#

  • L424

    ts
    422      }
    423
    424      const id = `audio_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    425      const source: SpatialAudioSource = { id, ...config };
    426
    

apps/isis/generation-api/src/workflows/error-boundary.ts#

  • L554

    ts
    552    const delay = Math.min(baseDelayMs * Math.pow(multiplier, attempt), maxDelayMs);
    553    // Add jitter (±10%)
    554    const jitter = delay * 0.1 * (Math.random() * 2 - 1);
    555    return Math.floor(delay + jitter);
    556  }
    

apps/isis/output-registry/src/services/output.service.ts#

  • L3485

    ts
    3483    private generateAuditId(): string {
    3484      const timestamp = Date.now().toString(36);
    3485      const random = Math.random().toString(36).substring(2, 10);
    3486      return `audit_${timestamp}_${random}`;
    3487    }
    
  • L3491

    ts
    3489    private generateOutputId(): OutputId {
    3490      const timestamp = Date.now().toString(36);
    3491      const random = Math.random().toString(36).substring(2, 10);
    3492      return `out_${timestamp}_${random}` as OutputId;
    3493    }
    
  • L3497

    ts
    3495    private generateProvenanceId(): ProvenanceId {
    3496      const timestamp = Date.now().toString(36);
    3497      const random = Math.random().toString(36).substring(2, 10);
    3498      return `prov_${timestamp}_${random}` as ProvenanceId;
    3499    }
    

apps/isis/web/src/pages/job-studio-preset-utils.ts#

  • L88

    ts
    86        }
    87      : {
    88          id: `preset_${Math.random().toString(36).slice(2, 10)}`,
    89          name: normalizedName,
    90          description: next.description?.trim() || undefined,
    

apps/isis/web/src/pages/output-review-loop-utils.ts#

  • L226

    ts
    224    const nowIso = (input.now ?? new Date()).toISOString();
    225    const comment: OutputReviewComment = {
    226      id: `comment_${Math.random().toString(36).slice(2, 10)}`,
    227      author,
    228      scope: input.scope,
    
  • L300

    ts
    298    const nowIso = (input.now ?? new Date()).toISOString();
    299    const annotation: OutputReviewAnnotation = {
    300      id: `annotation_${Math.random().toString(36).slice(2, 10)}`,
    301      target: input.target,
    302      xPercent: input.xPercent,
    

apps/isis/workflow-registry/src/services/workflow.service.ts#

  • L3438

    ts
    3436    private generateWorkflowId(): WorkflowId {
    3437      const timestamp = Date.now().toString(36);
    3438      const random = Math.random().toString(36).slice(2, 10);
    3439      return `wf_${timestamp}_${random}` as WorkflowId;
    3440    }
    
  • L3444

    ts
    3442    private generateVersionId(): VersionId {
    3443      const timestamp = Date.now().toString(36);
    3444      const random = Math.random().toString(36).slice(2, 10);
    3445      return `ver_${timestamp}_${random}` as VersionId;
    3446    }
    
  • L3456

    ts
    3454      }
    3455
    3456      const id = `wa_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    3457      this.auditLogs.unshift({
    3458        id,
    
  • L3472

    ts
    3470      payload: Omit<WorkflowAuditLogEntry, 'id' | 'timestamp'>
    3471    ): Promise<void> {
    3472      const id = `wa_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    3473      await executor.query(
    3474        `
    

apps/lilith/contracts/scripts/soak-test.ts#

  • L277

    ts
    275    private selectScenario(): SoakScenario {
    276      const totalWeight = this.scenarios.reduce((sum, s) => sum + s.weight, 0);
    277      let random = Math.random() * totalWeight;
    278
    279      for (const scenario of this.scenarios) {
    
  • L293

    ts
    291    private async executeCreateTokenType(): Promise<TransactionRecord> {
    292      const start = Date.now();
    293      const tokenId = Math.floor(Math.random() * 1000000);
    294
    295      try {
    
  • L386

    ts
    384          const tx = await this.creatorRoyalties.updateRoyaltyRate(
    385            this.deployer.address,
    386            Math.floor(Math.random() * 500) + 100 // 1-6% royalty
    387          );
    388          const receipt = await tx.wait();
    
  • L477

    ts
    475        const tx = await this.identityReputation.updateReputation(
    476          this.deployer.address,
    477          Math.floor(Math.random() * 10) + 1, // 1-10 points
    478          true // positive
    479        );
    

apps/lilith/mobile/src/__mocks__/react-native-widget.ts#

  • L98

    ts
    96  // Mock functions that can be reconfigured in tests
    97  export const createWidget = jest.fn().mockImplementation((config: any) => {
    98    const widgetId = `widget_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    99    installedWidgets.push(widgetId);
    100    widgetDataMap.set(widgetId, { ...mockWidgetData });
    
  • L165

    ts
    163      weeklyProgress: {
    164        target: 7,
    165        completed: Math.min(7, Math.floor(Math.random() * 8)),
    166        percentage: Math.min(100, Math.floor(Math.random() * 101))
    167      }
    
  • L166

    ts
    164        target: 7,
    165        completed: Math.min(7, Math.floor(Math.random() * 8)),
    166        percentage: Math.min(100, Math.floor(Math.random() * 101))
    167      }
    168    };
    
  • L201

    ts
    199
    200  export const createLiveActivity = jest.fn().mockImplementation((activity: any) => {
    201    const activityId = `activity_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    202    return Promise.resolve(activityId);
    203  });
    

apps/lilith/mobile/src/components/fitness/SvgLineChart.tsx#

  • L5

    ts
    3   *
    4   * Minimal, dependency-light line chart implemented directly on top of
    5   * react-native-svg. Renders real data — no Math.random / placeholder points.
    6   * Used by WorkoutHistoryScreen and FitnessProgressScreen.
    7   */
    

apps/lilith/mobile/src/components/meditation/StatsChart.tsx#

  • L155

    ts
    153          <View testID={`${testID}-skeleton`} style={styles.skeleton}>
    154            {[1, 2, 3, 4, 5, 6, 7].map((i) => (
    155              <View key={i} style={[styles.skeletonBar, { height: Math.random() * sizeConfig.height * 0.8 + 20 }]} />
    156            ))}
    157          </View>
    

apps/lilith/mobile/src/components/skeleton/SkeletonText.tsx#

  • L66

    ts
    64      } else {
    65        // Vary widths slightly for natural appearance
    66        const variance = Math.random() * 10;
    67        lineWidths.push(`${90 + variance}%`);
    68      }
    

apps/lilith/mobile/src/services/ComfyUIService.ts#

  • L418

    ts
    416    private async callApi(deploymentId: string, params: any): Promise<any> {
    417      // Mock implementation - replace with actual API call
    418      await this.delay(2000 + Math.random() * 3000);
    419
    420      return {
    

apps/lilith/mobile/src/services/__mocks__/VoiceResponseService.ts#

  • L59

    ts
    57      const progressInterval = setInterval(() => {
    58        if (this.isPlaying && this.currentPlayback) {
    59          const progress = Math.random() * 100;
    60          this.emit('playbackProgress', {
    61            response: this.currentPlayback,
    

apps/lilith/mobile/src/services/auth/SeamlessAuthService.ts#

  • L38

    ts
    36      const session: AuthSession = {
    37        userId,
    38        token: `tok_${Math.random().toString(36).slice(2)}`,
    39        createdAt: new Date().toISOString(),
    40      };
    

apps/lilith/mobile/src/services/biometric/OracleDivinationService.ts#

  • L118

    ts
    116
    117    private drawCards(deck: string[], count: number): string[] {
    118      const shuffled = [...deck].sort(() => Math.random() - 0.5);
    119      return shuffled.slice(0, count);
    120    }
    

apps/lilith/mobile/src/services/download/ResumableDownloader.ts#

  • L196

    ts
    194      const simulatedData = new ArrayBuffer(chunkSize);
    195
    196      await new Promise((resolve) => setTimeout(resolve, 50 + Math.random() * 100));
    197
    198      const wordArray = CryptoJS.lib.WordArray.create(simulatedData);
    

apps/lilith/mobile/src/services/download/RetryManager.ts#

  • L84

    ts
    82      if (this.config.jitterEnabled) {
    83        const jitterAmount = delay * this.config.jitterRange;
    84        const jitter = (Math.random() - 0.5) * 2 * jitterAmount;
    85        delay = Math.max(0, delay + jitter);
    86      }
    

apps/lilith/mobile/src/services/meditation/BackgroundSoundsService.ts#

  • L880

    ts
    878
    879      for (let i = 0; i < totalSamples; i++) {
    880        const white = Math.random() * 2 - 1;
    881
    882        switch (type) {
    

apps/lilith/mobile/src/services/metaverse/GroupMeditationTempleService.ts#

  • L555

    ts
    553        role: user.role ?? 'participant',
    554        avatarId: user.avatarId ?? null,
    555        position: { x: Math.random() * 10 - 5, y: 0, z: Math.random() * 10 - 5 },
    556        areaId: 'main-hall',
    557        joinedAt: new Date().toISOString(),
    

apps/lilith/mobile/src/services/progress/ProgressSyncServiceImpl.ts#

  • L564

    ts
    562
    563    private generateDeviceId(): string {
    564      return 'mobile_' + Math.random().toString(36).substr(2, 9);
    565    }
    566
    
  • L568

    ts
    566
    567    private generateId(): string {
    568      return Math.random().toString(36).substr(2, 9) + Date.now().toString(36);
    569    }
    570
    

apps/lilith/mobile/src/services/themes/AIArtFusionService.ts#

  • L122

    ts
    120      const baseSeed = randomChoice(preset.seeds) || Date.now();
    121      const seed = options?.useMutation
    122        ? baseSeed + Math.floor(Math.random() * preset.mutationRate * 1000)
    123        : baseSeed;
    124
    

apps/lilith/mobile/src/services/veilborn/VeilbornOfflineAI.ts#

  • L647

    ts
    645        case 'chaotic':
    646          // Add significant randomness
    647          score += Math.random() * 30;
    648          break;
    649
    
  • L671

    ts
    669    ): ScoredMove {
    670      // Check for intentional mistake (to make AI beatable at lower difficulties)
    671      if (Math.random() < mistakeRate && scoredMoves.length > 2) {
    672        // Pick a suboptimal move
    673        const index = Math.floor(Math.random() * Math.min(5, scoredMoves.length - 1)) + 1;
    
  • L673

    ts
    671      if (Math.random() < mistakeRate && scoredMoves.length > 2) {
    672        // Pick a suboptimal move
    673        const index = Math.floor(Math.random() * Math.min(5, scoredMoves.length - 1)) + 1;
    674        return scoredMoves[Math.min(index, scoredMoves.length - 1)];
    675      }
    
  • L687

    ts
    685
    686        // Random selection weighted by score
    687        let random = Math.random() * totalScore;
    688        for (let i = 0; i < topMoves.length; i++) {
    689          random -= adjustedScores[i];
    
  • L755

    ts
    753
    754    private async simulateThinking(delayConfig: { min: number; max: number }): Promise<void> {
    755      const delay = delayConfig.min + Math.random() * (delayConfig.max - delayConfig.min);
    756      return new Promise((resolve) => setTimeout(resolve, delay));
    757    }
    
  • L859

    ts
    857      const config = DIFFICULTY_CONFIG[this.getDifficulty()];
    858      for (const intent of intents) {
    859        scores[intent] += Math.random() * config.randomness * 20;
    860      }
    861
    

apps/lilith/mobile/src/services/voice/error-handler.ts#

  • L164

    ts
    162
    163      // Add jitter
    164      const jitter = Math.random() * 100;
    165      await this.sleep(delay + jitter);
    166
    

apps/lilith/shared/common/index.ts#

  • L14

    ts
    12
    13    for (let index = 0; index < bytes.length; index += 1) {
    14      bytes[index] = Math.floor(Math.random() * 256);
    15    }
    16    return bytes;
    

apps/lilith/svc-ai/src/adaptive-content/adaptive-content-service.ts#

  • L616

    ts
    614        if (currentIndex < DIFFICULTY_ORDER.length - 1) {
    615          // 30% chance to try next level when ready
    616          if (Math.random() < 0.3) {
    617            selectedLevel = DIFFICULTY_ORDER[currentIndex + 1]!;
    618          }
    

apps/lilith/svc-ai/src/agent-coordination.ts#

  • L273

    ts
    271        agent: specialist.name,
    272        response: `Specialist ${specialist.name} response to: ${task.content}`,
    273        confidence: 0.85 + Math.random() * 0.1,
    274      }));
    275
    
  • L292

    ts
    290        agent: agent.name,
    291        argument: `${agent.name}'s perspective on ${topic}`,
    292        confidence: 0.7 + Math.random() * 0.2,
    293        evidence: [`Evidence point 1 for ${agent.name}`, `Evidence point 2 for ${agent.name}`],
    294      }));
    
  • L318

    ts
    316        agent: agent.name,
    317        result: `Parallel execution result from ${agent.name} for task: ${task.content}`,
    318        execution_time: 100 + Math.random() * 500,
    319        success: true,
    320      }));
    
  • L356

    ts
    354      return {
    355        consensus: `Consensus built from ${opinions.length} opinions`,
    356        agreement_level: 0.8 + Math.random() * 0.15,
    357        participant_count: opinions.length,
    358      };
    
  • L367

    ts
    365        topic: topic,
    366        proposal: `${agent.name}'s proposal on ${topic}`,
    367        confidence: 0.6 + Math.random() * 0.4,
    368        keyPoints: this.getAgentSpecificKeyPoints(agent),
    369      }));
    
  • L405

    ts
    403              weaknesses: [`Weakness identified by ${critiqueAgent.name}`, `Area for improvement`],
    404              suggestions: [`Suggestion from ${critiqueAgent.name}`, `Alternative approach`],
    405              confidence: 0.7 + Math.random() * 0.3,
    406            });
    407          }
    
  • L439

    ts
    437        const originalProposal = proposals.find((p) => p.agent === agent.name);
    438        const relevantCritiques = critiques.filter((c) => c.targetAgent === agent.name);
    439        const improvementBoost = 0.05 + Math.random() * 0.1;
    440
    441        return {
    
  • L561

    ts
    559      const endTime = Date.now();
    560      const duration_ms = Math.max(1, endTime - startTime); // Ensure at least 1ms
    561      const improvementScore = 0.85 + Math.random() * 0.1;
    562
    563      return {
    

apps/lilith/svc-ai/src/agent-executor.ts#

  • L656

    ts
    654  - Structured recommendations
    655  - Confidence assessment`,
    656        confidence: 0.85 + Math.random() * 0.1,
    657        metadata: {
    658          agentRole: agent.role,
    

apps/lilith/svc-ai/src/ai-personal-trainer/real-time-coaching.ts#

  • L1761

    ts
    1759   *
    1760   * The chosen index is stable for identical inputs: this replaces the prior
    1761   * `Math.random()` call so tests can assert exact message output.
    1762   *
    1763   * We combine set number, target rep count, and total sets via a simple
    

apps/lilith/svc-ai/src/ambient-soundscape/ambient-soundscape-service.ts#

  • L1474

    ts
    1472    ): { left: Float32Array; right: Float32Array } {
    1473      // Random position based on stereo width
    1474      const azimuth = (Math.random() - 0.5) * 180 * params.stereoWidth;
    1475      const distance = 5 + Math.random() * 20;
    1476
    
  • L1475

    ts
    1473      // Random position based on stereo width
    1474      const azimuth = (Math.random() - 0.5) * 180 * params.stereoWidth;
    1475      const distance = 5 + Math.random() * 20;
    1476
    1477      if (this.config.enableHRTF) {
    

apps/lilith/svc-ai/src/asset-generation/asset-generation-service.ts#

  • L1616

    ts
    1614    async generate(request: AssetGenerationRequest): Promise<AssetGenerationResponse> {
    1615      const startTime = Date.now();
    1616      const seed = request.seed ?? Math.floor(Math.random() * 1000000);
    1617
    1618      try {
    

apps/lilith/svc-ai/src/biometric-integration/biometric-integration-service.ts#

  • L1082

    ts
    1080          frequency: this.getBandFrequency(band),
    1081          amplitude: power[band] / 100,
    1082          phase: Math.random() * Math.PI * 2,
    1083          color: BRAINWAVE_COLORS[band],
    1084        });
    

apps/lilith/svc-ai/src/comfyui-generation-provider.ts#

  • L498

    ts
    496          width: Math.round((request.width || 1024) * resolutionMultiplier),
    497          height: Math.round((request.height || 1024) * resolutionMultiplier),
    498          seed: request.seed || Math.floor(Math.random() * 2147483647),
    499          ...qualityParams,
    500          ...request.parameters,
    
  • L1088

    ts
    1086;
    1087; // Sticky bucketing based on a stable hash of (experimentId, assignmentKey).
    1088; // A/B tests require deterministic assignment per user; a Math.random()
    1089; // draw would rebucket the user on every request and invalidate
    1090; // experiment telemetry.
    

apps/lilith/svc-ai/src/daily-content/autonomous-daily-content-service.ts#

  • L1146

    ts
    1144        tradition,
    1145        type,
    1146        durationSeconds: 60 + Math.floor(Math.random() * 120), // 1-3 minutes
    1147        scriptText: `Take a moment for ${type.replace('_', ' ')}. ${this.getMomentInstruction(type, tradition)}`,
    1148        traditionMarkers: markers,
    

apps/lilith/svc-ai/src/document-processing/service.ts#

  • L938

    ts
    936      if (request.extractionSchema?.fields) {
    937        for (const field of request.extractionSchema.fields) {
    938          confidence[field.name] = 0.85 + Math.random() * 0.1;
    939        }
    940      }
    

apps/lilith/svc-ai/src/domain-agents.ts#

  • L820

    ts
    818            success: true,
    819            output: `Agent ${agent.name} completed task: ${task.type}`,
    820            confidence: 0.85 + Math.random() * 0.1,
    821            metadata: {
    822              agentRole: agent.role,
    

apps/lilith/svc-ai/src/dynamic-dialogue/dynamic-dialogue-service.ts#

  • L367

    ts
    365      if (persona.personality.warmth > 0.8 && !text.match(/^\s*(I |It'?s |That'?s )/)) {
    366        const warmPrefixes = ['I appreciate that. ', 'Thank you for sharing. ', 'I understand. '];
    367        if (Math.random() > 0.5) {
    368          text = randomChoice(warmPrefixes) + text;
    369        }
    
  • L809

    ts
    807          // Weighted random selection
    808          const totalScore = candidates.reduce((sum, c) => sum + c.score, 0);
    809          let random = Math.random() * totalScore;
    810          for (const candidate of candidates) {
    811            random -= candidate.score;
    

apps/lilith/svc-ai/src/facial-animation-lipsync/facial-animation-lipsync-service.ts#

  • L2179

    ts
    2177      let id = 'anim_';
    2178      for (let i = 0; i < 12; i++) {
    2179        id += chars.charAt(Math.floor(Math.random() * chars.length));
    2180      }
    2181      return id;
    

apps/lilith/svc-ai/src/fitness-instructor-generation/fitness-instructor-generation-service.ts#

  • L1319

    ts
    1317     */
    1318    generateInstructor(params?: InstructorGenerationParams): FitnessInstructorProfile {
    1319      const seed = params?.seed ?? Math.floor(Math.random() * 1000000);
    1320      const rng = new SeededRandom(seed);
    1321
    
  • L1422

    ts
    1420     */
    1421    generateBatch(params: BatchInstructorGenerationParams): BatchInstructorGenerationResult {
    1422      const seed = params.seed ?? Math.floor(Math.random() * 1000000);
    1423      const rng = new SeededRandom(seed);
    1424      const instructors: FitnessInstructorProfile[] = [];
    

apps/lilith/svc-ai/src/generative-nft/generative-nft-service.ts#

  • L422

    ts
    420        case 'probability':
    421          // Skip based on probability
    422          return Math.random() >= 1 - (rule.probability ?? 1);
    423        default:
    424          return true;
    
  • L842

    ts
    840  <g class="particles">
    841    ${Array.from({ length: particleCount }, (_, i) => {
    842      const cx = Math.random() * 100;
    843      const delay = Math.random() * config.duration;
    844      const color = colors[i % colors.length];
    
  • L843

    ts
    841    ${Array.from({ length: particleCount }, (_, i) => {
    842      const cx = Math.random() * 100;
    843      const delay = Math.random() * config.duration;
    844      const color = colors[i % colors.length];
    845      return `
    

apps/lilith/svc-ai/src/hair-generation/hair-generation-service.ts#

  • L1892

    ts
    1890
    1891      for (let i = 0; i < count; i++) {
    1892        const theta = Math.random() * Math.PI * 2;
    1893        const phi = Math.random() * Math.PI * 0.5;
    1894        const r = 0.1;
    
  • L1893

    ts
    1891      for (let i = 0; i < count; i++) {
    1892        const theta = Math.random() * Math.PI * 2;
    1893        const phi = Math.random() * Math.PI * 0.5;
    1894        const r = 0.1;
    1895
    

apps/lilith/svc-ai/src/hiit-cardio-instruction/hiit-cardio-instruction-service.ts#

  • L531

    ts
    529
    530    // Shuffle and select
    531    const shuffled = candidates.sort(() => Math.random() - 0.5);
    532    return shuffled.slice(0, params.count);
    533  }
    

apps/lilith/svc-ai/src/low-latency-infrastructure/edge-deployment.ts#

  • L43

    ts
    41    const bytes = new Array(16);
    42    for (let i = 0; i < 16; i++) {
    43      bytes[i] = Math.floor(Math.random() * 256)
    44        .toString(16)
    45        .padStart(2, '0');
    

apps/lilith/svc-ai/src/low-latency-infrastructure/latency-monitoring.ts#

  • L43

    ts
    41    const bytes = new Uint8Array(16);
    42    for (let i = 0; i < 16; i++) {
    43      bytes[i] = Math.floor(Math.random() * 256);
    44    }
    45    return Array.from(bytes)
    
  • L56

    ts
    54    const bytes = new Uint8Array(8);
    55    for (let i = 0; i < 8; i++) {
    56      bytes[i] = Math.floor(Math.random() * 256);
    57    }
    58    return Array.from(bytes)
    
  • L266

    ts
    264          return false;
    265        case 'probabilistic':
    266          return Math.random() < this.probability;
    267        case 'rate_limiting':
    268          return this.checkRateLimit();
    
  • L272

    ts
    270          return this.adaptiveSample(attributes);
    271        default:
    272          return Math.random() < this.probability;
    273      }
    274    }
    
  • L308

    ts
    306        if (attributes['error'] === true) return true;
    307        if (typeof attributes['latencyMs'] === 'number' && attributes['latencyMs'] > 100) {
    308          return Math.random() < Math.min(1, this.probability * 3);
    309        }
    310      }
    
  • L312

    ts
    310      }
    311
    312      return Math.random() < this.probability;
    313    }
    314  }
    

apps/lilith/svc-ai/src/mandala-generation/mandala-generation-service.ts#

  • L72

    ts
    70    // CSPRNG-backed identifier: 13 base36 chars from 8 random bytes. Prevents
    71    // predictable collisions when many mandalas are generated in a tight
    72    // loop (Math.random() has ~1-in-millions collision risk at batch scale
    73    // and is explicitly banned from id-generation code paths).
    74    const hex = randomBytes(8).toString('hex');
    

apps/lilith/svc-ai/src/meditation-generation/meditation-generation-pipeline.ts#

  • L773

    ts
    771        title: `${input.tradition || 'General'} teachings on ${input.topic}`,
    772        citation: `${input.tradition || 'Mindfulness'} Tradition, Modern Interpretation`,
    773        relevanceScore: 0.85 + Math.random() * 0.15,
    774        content: `Key teachings about ${input.topic} from ${input.tradition || 'various'} traditions...`,
    775      };
    
  • L785

    ts
    783        tradition: input.tradition || 'general',
    784        citation: 'Contemporary Meditation Practices',
    785        relevanceScore: 0.75 + Math.random() * 0.2,
    786        content: `Practical applications of ${input.topic}...`,
    787      };
    
  • L1069

    ts
    1067      };
    1068      if (input.tradition) {
    1069        result.traditionScore = 0.85 + Math.random() * 0.1;
    1070      }
    1071      return result;
    

apps/lilith/svc-ai/src/movement-meditation-animation/movement-meditation-animation-service.ts#

  • L746

    ts
    744      while (currentDistance < targetLength) {
    745        const segmentLength = Math.min(areaWidth * 0.2, targetLength - currentDistance);
    746        angle += (Math.random() - 0.5) * Math.PI * 0.3;
    747
    748        const endPoint: Point3D = {
    
  • L1997

    ts
    1995        particles.push({
    1996          position: {
    1997            x: (Math.random() - 0.5) * 0.5,
    1998            y: 0.8 + Math.random() * 1.2,
    1999            z: (Math.random() - 0.5) * 0.3
    
  • L1998

    ts
    1996          position: {
    1997            x: (Math.random() - 0.5) * 0.5,
    1998            y: 0.8 + Math.random() * 1.2,
    1999            z: (Math.random() - 0.5) * 0.3
    2000          },
    
  • L1999

    ts
    1997            x: (Math.random() - 0.5) * 0.5,
    1998            y: 0.8 + Math.random() * 1.2,
    1999            z: (Math.random() - 0.5) * 0.3
    2000          },
    2001          velocity: {
    
  • L2002

    ts
    2000          },
    2001          velocity: {
    2002            x: (Math.random() - 0.5) * 0.1,
    2003            y: Math.random() * 0.2,
    2004            z: (Math.random() - 0.5) * 0.1
    
  • L2003

    ts
    2001          velocity: {
    2002            x: (Math.random() - 0.5) * 0.1,
    2003            y: Math.random() * 0.2,
    2004            z: (Math.random() - 0.5) * 0.1
    2005          },
    
  • L2004

    ts
    2002            x: (Math.random() - 0.5) * 0.1,
    2003            y: Math.random() * 0.2,
    2004            z: (Math.random() - 0.5) * 0.1
    2005          },
    2006          color: this.getEnergyColor(i / numParticles),
    
  • L2007

    ts
    2005          },
    2006          color: this.getEnergyColor(i / numParticles),
    2007          size: 0.02 + Math.random() * 0.03,
    2008          lifetime: 2 + Math.random() * 3,
    2009          opacity: 0.5 + Math.random() * 0.5
    
  • L2008

    ts
    2006          color: this.getEnergyColor(i / numParticles),
    2007          size: 0.02 + Math.random() * 0.03,
    2008          lifetime: 2 + Math.random() * 3,
    2009          opacity: 0.5 + Math.random() * 0.5
    2010        });
    
  • L2009

    ts
    2007          size: 0.02 + Math.random() * 0.03,
    2008          lifetime: 2 + Math.random() * 3,
    2009          opacity: 0.5 + Math.random() * 0.5
    2010        });
    2011      }
    
  • L2574

    ts
    2572
    2573      for (const pause of path.pausePoints) {
    2574        const typeIndex = Math.floor(Math.random() * types.length);
    2575        pois.push({
    2576          position: pause.position,
    

apps/lilith/svc-ai/src/multi-platform-delivery/smart-tv-casting.ts#

  • L642

    ts
    640   * Rejection-sampling over the 32-character alphabet (base32 without
    641   * the easily-confused `I`, `L`, `O`, `U`) guarantees a uniform
    642   * distribution — unlike `Math.random`, which MUST NOT be used for
    643   * security-sensitive tokens.
    644   */
    

apps/lilith/svc-ai/src/personality-engine.ts#

  • L399

    ts
    397      // Weighted random selection
    398      const totalWeight = weights.reduce((sum, w) => sum + w, 0);
    399      let random = Math.random() * totalWeight;
    400
    401      for (let i = 0; i < methods.length; i++) {
    

apps/lilith/svc-ai/src/personality-response.ts#

  • L44

    ts
    42    _userMessage: string,
    43    teachingMethod: string,
    44    random: RandomGenerator = Math.random
    45  ): string {
    46    const methodTemplates =
    

apps/lilith/svc-ai/src/procedural-qa/procedural-qa-service.ts#

  • L1373

    ts
    1371
    1372      // Check traffic percentage
    1373      if (Math.random() > test.config.trafficPercentage) {
    1374        return null;
    1375      }
    
  • L1379

    ts
    1377      // Weighted random assignment
    1378      const totalWeight = test.variants.reduce((sum, v) => sum + v.weight, 0);
    1379      let random = Math.random() * totalWeight;
    1380
    1381      for (const variant of test.variants) {
    
  • L1447

    ts
    1445      // samples recorded by recordMetric(). Variants with no recorded
    1446      // samples report zero participants — this replaces the earlier
    1447      // Math.random()*1000+100 placeholder and Math.random() metric
    1448      // values, which produced a different report on every call.
    1449      const byVariant: Record<string, VariantResults> = {};
    
  • L1531

    ts
    1529          bestValue,
    1530          improvement: controlValue > 0 ? ((bestValue - controlValue) / controlValue) * 100 : 0,
    1531          pValue: Math.random() * 0.1,
    1532          isSignificant: Math.random() > 0.3,
    1533        };
    
  • L1532

    ts
    1530          improvement: controlValue > 0 ? ((bestValue - controlValue) / controlValue) * 100 : 0,
    1531          pValue: Math.random() * 0.1,
    1532          isSignificant: Math.random() > 0.3,
    1533        };
    1534      });
    

apps/lilith/svc-ai/src/providers/openrouter-provider.ts#

  • L2319

    ts
    2317      }
    2318
    2319      const random = Math.random();
    2320      let cumulative = 0;
    2321
    

apps/lilith/svc-ai/src/realtime-processing/realtime-processing-service.ts#

  • L310

    ts
    308        image:
    309          'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',
    310        seed: input.seed ?? Math.floor(Math.random() * 1000000),
    311        parameters: input
    312      };
    

apps/lilith/svc-ai/src/rpg-character-generation/character-generation-service.ts#

  • L379

    ts
    377
    378      while (remaining > 0) {
    379        const type = RESONANCE_TYPES[Math.floor(Math.random() * 5)];
    380        if (type !== undefined && scores[type] < max) {
    381          scores[type]++;
    
  • L783

    ts
    781          factionName: 'Unknown Faction',
    782          rank: 'member',
    783          loyalty: 50 + Math.floor(Math.random() * 50),
    784          publicRole: 'member'
    785        };
    
  • L944

    ts
    942
    943    private generateHiddenAgenda(): string | undefined {
    944      if (Math.random() < 0.3) {return undefined;}
    945
    946      const agendas = [
    
  • L1004

    ts
    1002        targetId: e.id,
    1003        type: this.randomRelationshipType(),
    1004        strength: Math.floor(Math.random() * 10) - 5,
    1005        bidirectional: Math.random() > 0.3,
    1006        visibility: Math.random() > 0.8 ? ('secret' as const) : ('public' as const)
    
  • L1005

    ts
    1003        type: this.randomRelationshipType(),
    1004        strength: Math.floor(Math.random() * 10) - 5,
    1005        bidirectional: Math.random() > 0.3,
    1006        visibility: Math.random() > 0.8 ? ('secret' as const) : ('public' as const)
    1007      }));
    
  • L1006

    ts
    1004        strength: Math.floor(Math.random() * 10) - 5,
    1005        bidirectional: Math.random() > 0.3,
    1006        visibility: Math.random() > 0.8 ? ('secret' as const) : ('public' as const)
    1007      }));
    1008
    
  • L1239

    ts
    1237          noticeability: 'hidden' as const
    1238        }
    1239      ].sort(() => Math.random() - 0.5);
    1240
    1241      // Priority quirks first, then shuffled base pool
    
  • L1397

    ts
    1395            type: t.type,
    1396            resonanceAffinity: t.resonance,
    1397            inheritanceProbability: 0.5 + Math.random() * 0.25,
    1398            effects: [{ type: 'resonance_bonus', value: 1 }]
    1399          });
    
  • L1443

    ts
    1441            description: t.desc,
    1442            category: t.category,
    1443            inheritanceProbability: 0.4 + Math.random() * 0.3,
    1444            isPositive: t.positive,
    1445            effects: []
    
  • L1453

    ts
    1451
    1452    private inheritAbilities(abilities: BloodlineAbility[], chance: number): BloodlineAbility[] {
    1453      return abilities.filter(a => Math.random() < Math.min(a.inheritanceProbability, chance));
    1454    }
    1455
    
  • L1457

    ts
    1455
    1456    private inheritTraits(traits: DynastyTrait[], chance: number): DynastyTrait[] {
    1457      return traits.filter(t => Math.random() < Math.min(t.inheritanceProbability, chance));
    1458    }
    1459
    
  • L1461

    ts
    1459
    1460    private generateMutations(chance: number): string[] {
    1461      if (Math.random() > chance) {return [];}
    1462      const mutations = [
    1463        'Enhanced senses',
    
  • L1485

    ts
    1483    create(request: FactionGenerationRequest): GeneratedFaction {
    1484      const resonance: ResonanceType =
    1485        request.resonanceAffinity ?? RESONANCE_TYPES[Math.floor(Math.random() * 5)] ?? 'Clarity';
    1486
    1487      return {
    

apps/lilith/svc-ai/src/rpg-combat-tactics/combat-tactics-service.ts#

  • L207

    ts
    205      if (!types || types.length === 0) {return units;}
    206
    207      const typeIndex = Math.floor(Math.random() * types.length);
    208      const type = types[typeIndex];
    209      if (!type) {return units;}
    
  • L917

    ts
    915    private createPrimaryObjective(difficulty: number, hint?: string): BattleObjective {
    916      const types: ObjectiveType[] = ['elimination', 'capture', 'defend', 'escort'];
    917      const typeIndex = Math.floor(Math.random() * types.length);
    918      const type: ObjectiveType = hint
    919        ? this.typeFromHint(hint)
    
  • L938

    ts
    936    private createSecondaryObjective(difficulty: number): BattleObjective {
    937      const types: ObjectiveType[] = ['capture', 'sabotage', 'survival'];
    938      const typeIndex = Math.floor(Math.random() * types.length);
    939      const type: ObjectiveType = types[typeIndex] ?? 'capture';
    940
    
  • L955

    ts
    953    private createBonusObjective(): BattleObjective {
    954      const types: ObjectiveType[] = ['assassination', 'ritual'];
    955      const typeIndex = Math.floor(Math.random() * types.length);
    956      const type: ObjectiveType = types[typeIndex] ?? 'assassination';
    957
    
  • L993

    ts
    991
    992      const typeNames = names[type] ?? ['Objective'];
    993      const randomIndex = Math.floor(Math.random() * typeNames.length);
    994      return isPrimary ? (typeNames[0] ?? 'Objective') : (typeNames[randomIndex] ?? 'Objective');
    995    }
    
  • L1032

    ts
    1030        id: generateUniqueId('target'),
    1031        name: `${type.charAt(0).toUpperCase() + type.slice(1)} Target`,
    1032        position: { x: Math.floor(Math.random() * 10), y: Math.floor(Math.random() * 10) }
    1033      };
    1034    }
    
  • L1108

    ts
    1106        description: this.getHazardDescription(type),
    1107        position: {
    1108          x: Math.floor(Math.random() * mapSize.width),
    1109          y: Math.floor(Math.random() * mapSize.height)
    1110        },
    
  • L1109

    ts
    1107        position: {
    1108          x: Math.floor(Math.random() * mapSize.width),
    1109          y: Math.floor(Math.random() * mapSize.height)
    1110        },
    1111        radius: 1 + Math.floor(difficulty / 2),
    
  • L1810

    ts
    1808        const { factionId, role, tier, resonanceAffinity } = request;
    1809        const types = ROLE_TO_TYPES[role];
    1810        const typeIndex = Math.floor(Math.random() * types.length);
    1811        const type: UnitType = types[typeIndex] ?? 'infantry';
    1812        const baseStats = UNIT_BASE_STATS[type];
    

apps/lilith/svc-ai/src/rpg-game-mechanics/game-mechanics-service.ts#

  • L203

    ts
    201
    202      for (let i = 0; i < poolSize; i++) {
    203        const roll = Math.floor(Math.random() * DICE_SIDES) + 1;
    204        if (roll >= SUCCESS_MIN) {successes++;}
    205        if (roll === ECHO_VALUE) {echoes++;}
    
  • L212

    ts
    210        const newEchoes = 0;
    211        for (let i = 0; i < echoes; i++) {
    212          const roll = Math.floor(Math.random() * DICE_SIDES) + 1;
    213          if (roll >= SUCCESS_MIN) {successes++;}
    214          if (roll === SHADOW_VALUE) {shadows++;}
    

apps/lilith/svc-ai/src/rpg-items-artifacts/items-artifacts-service.ts#

  • L127

    ts
    125      }
    126      if (type === 'triggered') {
    127        ability.charges = 3 + Math.floor(Math.random() * 5);
    128      }
    129      if (rarity === 'mythic' || rarity === 'transcendent') {
    
  • L147

    ts
    145      ].indexOf(rarity);
    146
    147      if (rarityWeight >= 5) {return Math.random() < 0.3 ? 'ultimate' : 'active';}
    148      if (rarityWeight >= 3) {return Math.random() < 0.5 ? 'active' : 'triggered';}
    149      if (rarityWeight >= 1) {return Math.random() < 0.5 ? 'triggered' : 'passive';}
    
  • L148

    ts
    146
    147      if (rarityWeight >= 5) {return Math.random() < 0.3 ? 'ultimate' : 'active';}
    148      if (rarityWeight >= 3) {return Math.random() < 0.5 ? 'active' : 'triggered';}
    149      if (rarityWeight >= 1) {return Math.random() < 0.5 ? 'triggered' : 'passive';}
    150      return 'passive';
    
  • L149

    ts
    147      if (rarityWeight >= 5) {return Math.random() < 0.3 ? 'ultimate' : 'active';}
    148      if (rarityWeight >= 3) {return Math.random() < 0.5 ? 'active' : 'triggered';}
    149      if (rarityWeight >= 1) {return Math.random() < 0.5 ? 'triggered' : 'passive';}
    150      return 'passive';
    151    }
    
  • L172

    ts
    170      const effect: AbilityEffect = {
    171        effectType,
    172        magnitude: 10 * rarityMultiplier + Math.floor(Math.random() * 20 * rarityMultiplier),
    173        targets: this.determineTargets(effectType)
    174      };
    
  • L177

    ts
    175
    176      if (['buff', 'debuff', 'transform'].includes(effectType)) {
    177        effect.duration = 10 + Math.floor(Math.random() * 20);
    178      }
    179      if (element) {
    
  • L191

    ts
    189    private determineTargets(effectType: AbilityEffect['effectType']): AbilityEffect['targets'] {
    190      if (['heal', 'buff', 'transform'].includes(effectType)) {return 'self';}
    191      if (['damage', 'debuff'].includes(effectType)) {return Math.random() < 0.5 ? 'single' : 'area';}
    192      if (effectType === 'summon') {return 'area';}
    193      return 'self';
    
  • L208

    ts
    206        ? this.elementPrefix(element)
    207        : randomChoice(prefixes);
    208      const action = actions[type][Math.floor(Math.random() * actions[type].length)];
    209
    210      return `${prefix} ${action}`;
    
  • L236

    ts
    234      const costTypes: AbilityCost['type'][] = ['mana', 'health', 'stamina', 'soul', 'charge'];
    235      const costType: AbilityCost['type'] =
    236        type === 'ultimate' ? 'soul' : (costTypes[Math.floor(Math.random() * 4)] ?? 'mana');
    237      const rarityMultiplier =
    238        ['common', 'uncommon', 'rare', 'epic', 'legendary', 'mythic', 'transcendent'].indexOf(
    
  • L297

    ts
    295
    296      history.creator = this.generateCreator(rarity);
    297      if (Math.random() < 0.5) {
    298        history.currentLocation = this.generateLocation();
    299      }
    
  • L719

    ts
    717      if (['mythic', 'transcendent'].includes(rarity)) {return 'pristine';}
    718      if (['legendary', 'epic'].includes(rarity))
    719        {return Math.random() < 0.7 ? 'pristine' : 'battle-scarred';}
    720      if (['rare', 'uncommon'].includes(rarity)) {return Math.random() < 0.5 ? 'worn' : 'pristine';}
    721      return 'ancient';
    
  • L720

    ts
    718      if (['legendary', 'epic'].includes(rarity))
    719        {return Math.random() < 0.7 ? 'pristine' : 'battle-scarred';}
    720      if (['rare', 'uncommon'].includes(rarity)) {return Math.random() < 0.5 ? 'worn' : 'pristine';}
    721      return 'ancient';
    722    }
    
  • L741

    ts
    739      if (category === 'weapon') {
    740        return {
    741          attack: Math.floor(baseValue * (1 + Math.random() * 0.2)),
    742          critChance: Math.floor(5 + rarityMultiplier * 2),
    743          critDamage: Math.floor(150 + rarityMultiplier * 10),
    
  • L751

    ts
    749      if (category === 'armor') {
    750        return {
    751          defense: Math.floor(baseValue * (1 + Math.random() * 0.2)),
    752          magicDefense: Math.floor(baseValue * 0.7),
    753          evasion: Math.floor(5 + rarityMultiplier * 2)
    
  • L786

    ts
    784      for (let i = 0; i < count; i++) {
    785        const stat = randomChoice(stats) ?? 'attack';
    786        const isPercentage = Math.random() < 0.3;
    787
    788        bonuses.push({
    
  • L942

    ts
    940    private determineTarget(effectType: ConsumableEffect['type']): ConsumableEffect['target'] {
    941      if (['heal', 'buff', 'restore', 'transform'].includes(effectType)) {return 'self';}
    942      if (effectType === 'damage') {return Math.random() < 0.5 ? 'single' : 'area';}
    943      return 'self';
    944    }
    
  • L1058

    ts
    1056          itemId: generateUniqueId('ingredient'),
    1057          itemName: baseName,
    1058          quantity: 1 + Math.floor(Math.random() * 3),
    1059          optional: i === count - 1
    1060        };
    
  • L1146

    ts
    1144        if (request.includeCurse) {
    1145          artifact.curse = this.curseBlessingAgent.generateCurse(
    1146            Math.ceil(Math.random() * 3) as 1 | 2 | 3
    1147          );
    1148        }
    
  • L1151

    ts
    1149        if (request.includeBlessing) {
    1150          artifact.blessing = this.curseBlessingAgent.generateBlessing(
    1151            Math.ceil(Math.random() * 4) as 1 | 2 | 3 | 4
    1152          );
    1153        }
    

apps/lilith/svc-ai/src/rpg-map-generation/map-generation-service.ts#

  • L92

    ts
    90            temperature: this.pickTemperature(bounds, mapSize),
    91            precipitation: this.pickPrecipitation(),
    92            seasons: Math.random() > 0.3,
    93          },
    94        });
    
  • L104

    ts
    102        return 'mainland';
    103      }
    104      if (total > 3 && Math.random() < 0.2) {
    105        return 'archipelago';
    106      }
    
  • L107

    ts
    105        return 'archipelago';
    106      }
    107      if (Math.random() < 0.3) {
    108        return 'island';
    109      }
    
  • L110

    ts
    108        return 'island';
    109      }
    110      if (Math.random() < 0.2) {
    111        return 'floating';
    112      }
    
  • L142

    ts
    140      const radiusX = (bounds.maxX - bounds.minX) / 2;
    141      const radiusY = (bounds.maxY - bounds.minY) / 2;
    142      const points = 8 + Math.floor(Math.random() * 8);
    143
    144      for (let i = 0; i < points; i++) {
    
  • L146

    ts
    144      for (let i = 0; i < points; i++) {
    145        const angle = (i / points) * Math.PI * 2;
    146        const r = 0.6 + Math.random() * 0.4;
    147        vertices.push({
    148          x: centerX + Math.cos(angle) * radiusX * r,
    
  • L167

    ts
    165        return 'tropical';
    166      }
    167      return Math.random() > 0.5 ? 'temperate' : 'arid';
    168    }
    169
    
  • L171

    ts
    169
    170    private pickPrecipitation(): 'dry' | 'moderate' | 'wet' | 'monsoon' {
    171      const r = Math.random();
    172      if (r < 0.25) {
    173        return 'dry';
    
  • L312

    ts
    310            type: resourceType,
    311            abundance: this.pickAbundance(value),
    312            extractionDifficulty: Math.floor(Math.random() * 5) + 3,
    313          });
    314        }
    
  • L362

    ts
    360  export class NeutralDistributorAgent {
    361    distribute(regions: Region[], _factionCount: number): string[] {
    362      const neutralRatio = 0.2 + Math.random() * 0.2;
    363      const neutralCount = Math.floor(regions.length * neutralRatio);
    364      const neutralIds: string[] = [];
    
  • L367

    ts
    365
    366      const candidates = regions.filter((r) => r.strategicValue !== 'critical');
    367      const shuffled = [...candidates].sort(() => Math.random() - 0.5);
    368
    369      for (let i = 0; i < neutralCount && i < shuffled.length; i++) {
    
  • L391

    ts
    389      for (let i = 0; i < lineCount; i++) {
    390        const path = this.generatePath(regions);
    391        const resonanceIndex = Math.floor(Math.random() * RESONANCE_TYPES.length);
    392        const resonance = RESONANCE_TYPES[resonanceIndex] ?? 'mixed';
    393
    
  • L399

    ts
    397          path,
    398          resonanceType: resonance,
    399          strength: Math.floor(Math.random() * 5) + 5,
    400          stability: this.pickStability(),
    401          nodes: this.generateNodes(path),
    
  • L416

    ts
    414    private generatePath(regions: Region[]): MapCoordinate[] {
    415      const path: MapCoordinate[] = [];
    416      const pointCount = 3 + Math.floor(Math.random() * 4);
    417      const shuffled = [...regions].sort(() => Math.random() - 0.5).slice(0, pointCount);
    418
    
  • L417

    ts
    415      const path: MapCoordinate[] = [];
    416      const pointCount = 3 + Math.floor(Math.random() * 4);
    417      const shuffled = [...regions].sort(() => Math.random() - 0.5).slice(0, pointCount);
    418
    419      for (const region of shuffled) {
    
  • L427

    ts
    425
    426    private pickStability(): 'stable' | 'fluctuating' | 'unstable' | 'corrupted' {
    427      const r = Math.random();
    428      if (r < 0.5) {
    429        return 'stable';
    
  • L449

    ts
    447            : i === path.length - 1
    448              ? 'terminus'
    449              : Math.random() > 0.5
    450                ? 'junction'
    451                : 'amplifier',
    
  • L452

    ts
    450                ? 'junction'
    451                : 'amplifier',
    452        power: Math.floor(Math.random() * 5) + 3,
    453        effects: [],
    454      }));
    
  • L462

    ts
    460          type: 'buff',
    461          description: `Enhanced ${resonance} in this area`,
    462          radius: 50 + Math.floor(Math.random() * 100),
    463          magnitude: Math.floor(Math.random() * 3) + 1,
    464        },
    
  • L463

    ts
    461          description: `Enhanced ${resonance} in this area`,
    462          radius: 50 + Math.floor(Math.random() * 100),
    463          magnitude: Math.floor(Math.random() * 3) + 1,
    464        },
    465      ];
    
  • L521

    ts
    519    place(regions: Region[], count: number): VoidRift[] {
    520      const rifts: VoidRift[] = [];
    521      const candidates = [...regions].sort(() => Math.random() - 0.5).slice(0, count);
    522
    523      for (let i = 0; i < candidates.length; i++) {
    
  • L535

    ts
    533          position: { ...region.polygon.centroid },
    534          size: this.pickSize(),
    535          stability: Math.floor(Math.random() * 60) + 20,
    536          age: this.pickAge(),
    537          narrativeSignificance: this.generateNarrative(region),
    
  • L553

    ts
    551
    552    private pickSize(): 'minor' | 'moderate' | 'major' | 'catastrophic' {
    553      const r = Math.random();
    554      if (r < 0.4) {
    555        return 'minor';
    
  • L567

    ts
    565
    566    private pickAge(): 'ancient' | 'old' | 'recent' | 'fresh' {
    567      const r = Math.random();
    568      if (r < 0.3) {
    569        return 'ancient';
    
  • L584

    ts
    582        origin: `Formed during the ${region.biome === 'void_touched' ? 'Great Sundering' : 'Veil Collapse'}`,
    583        loreFragment: 'Ancient texts speak of this wound in reality',
    584        threatLevel: Math.random() < 0.3 ? 'active' : Math.random() < 0.6 ? 'stirring' : 'dormant',
    585      };
    586    }
    
  • L592

    ts
    590        {
    591          type: 'corruption',
    592          radius: 100 + Math.floor(Math.random() * 200),
    593          intensity: Math.floor(Math.random() * 5) + 3,
    594          description: 'Reality warps and twists near the rift',
    
  • L593

    ts
    591          type: 'corruption',
    592          radius: 100 + Math.floor(Math.random() * 200),
    593          intensity: Math.floor(Math.random() * 5) + 3,
    594          description: 'Reality warps and twists near the rift',
    595        },
    
  • L600

    ts
    598
    599    private pickContainmentStatus(): VoidRift['containmentStatus'] {
    600      const r = Math.random();
    601      if (r < 0.3) {
    602        return 'uncontained';
    
  • L663

    ts
    661
    662      const options = terrainByStyle[style] || ['open'];
    663      const terrainIndex = Math.floor(Math.random() * options.length);
    664      return options[terrainIndex] ?? 'open';
    665    }
    
  • L703

    ts
    701
    702      const selectedTiles = eligibleTiles
    703        .map((tile) => ({ tile, sortKey: Math.random() }))
    704        .sort((a, b) => a.sortKey - b.sortKey)
    705        .slice(0, coverTarget);
    
  • L714

    ts
    712    private pickCover(terrain: TerrainType): CoverType {
    713      if (terrain === 'forest') {
    714        return Math.random() > 0.5 ? 'medium' : 'heavy';
    715      }
    716      if (terrain === 'rocky') {
    
  • L717

    ts
    715      }
    716      if (terrain === 'rocky') {
    717        return Math.random() > 0.5 ? 'light' : 'medium';
    718      }
    719      if (terrain === 'crystal') {
    
  • L775

    ts
    773      const mysticalSites: MysticalSite[] = [];
    774      const available = this.getAvailableTiles(tiles);
    775      const shuffled = available.sort(() => Math.random() - 0.5).slice(0, count * 2);
    776
    777      for (let i = 0; i < Math.min(count, shuffled.length / 2); i++) {
    
  • L782

    ts
    780          continue;
    781        }
    782        const resonanceIndex = Math.floor(Math.random() * RESONANCE_TYPES.length);
    783        powerNodes.push({
    784          id: `power_node_${i}`,
    
  • L787

    ts
    785          position: pos,
    786          resonanceType: RESONANCE_TYPES[resonanceIndex] ?? 'mixed',
    787          power: Math.floor(Math.random() * 5) + 3,
    788          bonuses: ['+1 to resonance checks'],
    789        });
    
  • L805

    ts
    803          'nexus',
    804        ];
    805        const typeIndex = Math.floor(Math.random() * types.length);
    806        const resonanceIndex = Math.floor(Math.random() * RESONANCE_TYPES.length);
    807        mysticalSites.push({
    
  • L806

    ts
    804        ];
    805        const typeIndex = Math.floor(Math.random() * types.length);
    806        const resonanceIndex = Math.floor(Math.random() * RESONANCE_TYPES.length);
    807        mysticalSites.push({
    808          id: `mystical_site_${i}`,
    
  • L990

    ts
    988
    989      for (let i = 0; i < count; i++) {
    990        const typeIndex = Math.floor(Math.random() * types.length);
    991        const type = types[typeIndex] ?? 'battle';
    992        stickers.push({
    
  • L997

    ts
    995          name: this.generateStickerName(type),
    996          description: this.generateDescription(type),
    997          era: `Era ${Math.floor(Math.random() * 5) + 1}`,
    998          impact: this.pickImpact(),
    999          permanentEffects: this.generateEffects(type),
    
  • L1024

    ts
    1022
    1023    private pickImpact(): LegacySticker['impact'] {
    1024      const r = Math.random();
    1025      if (r < 0.4) {
    1026        return 'minor';
    

apps/lilith/svc-ai/src/rpg-multiplayer-social/multiplayer-social-service.ts#

  • L705

    ts
    703      const shuffled = [...participants];
    704      for (let i = shuffled.length - 1; i > 0; i--) {
    705        const j = Math.floor(Math.random() * (i + 1));
    706        const temp = shuffled[i];
    707        const swapWith = shuffled[j];
    
  • L1310

    ts
    1308
    1309      const totalWeight = weights.reduce((a, b) => a + b, 0);
    1310      let random = Math.random() * totalWeight;
    1311
    1312      for (let i = 0; i < types.length; i++) {
    

apps/lilith/svc-ai/src/rpg-political-intrigue/political-intrigue-service.ts#

  • L129

    ts
    127          role: i === 0 ? 'mastermind' : 'inner_circle',
    128          joinedAt: new Date().toISOString(),
    129          loyalty: 90 + Math.floor(Math.random() * 10),
    130          usefulness: 80 + Math.floor(Math.random() * 20),
    131          knowledgeLevel: 5,
    
  • L130

    ts
    128          joinedAt: new Date().toISOString(),
    129          loyalty: 90 + Math.floor(Math.random() * 10),
    130          usefulness: 80 + Math.floor(Math.random() * 20),
    131          knowledgeLevel: 5,
    132          suspicionLevel: 10 + Math.floor(Math.random() * 20)
    
  • L132

    ts
    130          usefulness: 80 + Math.floor(Math.random() * 20),
    131          knowledgeLevel: 5,
    132          suspicionLevel: 10 + Math.floor(Math.random() * 20)
    133        });
    134      });
    
  • L144

    ts
    142          role,
    143          joinedAt: new Date().toISOString(),
    144          loyalty: 50 + Math.floor(Math.random() * 40),
    145          usefulness: 40 + Math.floor(Math.random() * 40),
    146          knowledgeLevel: role === 'operative' ? 3 : role === 'informant' ? 2 : 1,
    
  • L145

    ts
    143          joinedAt: new Date().toISOString(),
    144          loyalty: 50 + Math.floor(Math.random() * 40),
    145          usefulness: 40 + Math.floor(Math.random() * 40),
    146          knowledgeLevel: role === 'operative' ? 3 : role === 'informant' ? 2 : 1,
    147          suspicionLevel: Math.floor(Math.random() * 30)
    
  • L147

    ts
    145          usefulness: 40 + Math.floor(Math.random() * 40),
    146          knowledgeLevel: role === 'operative' ? 3 : role === 'informant' ? 2 : 1,
    147          suspicionLevel: Math.floor(Math.random() * 30)
    148        });
    149      }
    
  • L172

    ts
    170          purpose: i === 0 ? 'Intelligence gathering' : 'Direct action',
    171          location: `District ${i + 1}`,
    172          autonomy: 50 + Math.floor(Math.random() * 30),
    173          knownToCells: []
    174        });
    
  • L331

    ts
    329        content,
    330        accuracy: intentional
    331          ? 70 + Math.floor(Math.random() * 30)
    332          : 40 + Math.floor(Math.random() * 40),
    333        timestamp: new Date().toISOString(),
    
  • L332

    ts
    330        accuracy: intentional
    331          ? 70 + Math.floor(Math.random() * 30)
    332          : 40 + Math.floor(Math.random() * 40),
    333        timestamp: new Date().toISOString(),
    334        intentional,
    
  • L525

    ts
    523        spreadLevel: 10,
    524        credibility: fabricated
    525          ? 30 + Math.floor(Math.random() * 30)
    526          : 60 + Math.floor(Math.random() * 30),
    527        ...(source ? { source } : {}),
    
  • L526

    ts
    524        credibility: fabricated
    525          ? 30 + Math.floor(Math.random() * 30)
    526          : 60 + Math.floor(Math.random() * 30),
    527        ...(source ? { source } : {}),
    528        fabricated,
    
  • L751

    ts
    749          relatedTo: 'mystery_subject',
    750          reliability: isHerring
    751            ? 20 + Math.floor(Math.random() * 30)
    752            : 60 + Math.floor(Math.random() * 30),
    753          location: locations[i % locations.length]!,
    
  • L752

    ts
    750          reliability: isHerring
    751            ? 20 + Math.floor(Math.random() * 30)
    752            : 60 + Math.floor(Math.random() * 30),
    753          location: locations[i % locations.length]!,
    754          isRedHerring: isHerring,
    
  • L774

    ts
    772        clueId: clue.id,
    773        falseTarget,
    774        plausibility: 50 + Math.floor(Math.random() * 40),
    775        detectability: 30 + Math.floor(Math.random() * 40),
    776        purpose: this.determinePurpose()
    
  • L775

    ts
    773        falseTarget,
    774        plausibility: 50 + Math.floor(Math.random() * 40),
    775        detectability: 30 + Math.floor(Math.random() * 40),
    776        purpose: this.determinePurpose()
    777      };
    
  • L790

    ts
    788    ): { detected: boolean; confidence: number } {
    789      const detectionChance = herring.detectability + investigatorSkill - 50;
    790      const detected = Math.random() * 100 < detectionChance;
    791
    792      return {
    
  • L794

    ts
    792      return {
    793        detected,
    794        confidence: detected ? 60 + Math.floor(Math.random() * 40) : 0
    795      };
    796    }
    
  • L832

    ts
    830        : 0.5 - evidenceStrength / 200;
    831
    832      const correctVerdict = Math.random() < verdictProbability;
    833      const verdict =
    834        correctVerdict === isGuilty
    

apps/lilith/svc-ai/src/rpg-political-intrigue/political-math.ts#

  • L10

    ts
    8   *
    9   * Two design rules:
    10   *   1. NO `Math.random()`. Every score is a closed-form function of the
    11   *      character/faction inputs, with a mulberry32 PRNG used only for
    12   *      tie-breaking jitter so identical inputs always produce identical
    
  • L100

    ts
    98   * Conspiracy roles encode loyalty floors and ceilings. Masterminds are
    99   * (almost) by definition committed; patsies are coerced or duped and drift.
    100   * These bounds are the same shape the original `Math.random` ranges produced,
    101   * but now derived from role semantics rather than dice.
    102   */
    

apps/lilith/svc-ai/src/rpg-quest-generation/quest-generation-service.ts#

  • L67

    ts
    65  }
    66
    67  function pickRandom<T>(arr: T[], random: () => number = Math.random): T {
    68    const item = arr[Math.floor(random() * arr.length)];
    69    if (item === undefined) {
    
  • L94

    ts
    92
    93    generateQuest(config: QuestGenerationConfig): Quest {
    94      const random = config.seed ? seededRandom(config.seed) : Math.random;
    95      const theme = pickRandom(config.themes, random);
    96      const tradition = config.traditions ? pickRandom(config.traditions, random) : undefined;
    
  • L157

    ts
    155      };
    156
    157      const r = random || Math.random;
    158      return pickRandom(themeNames[theme], r);
    159    }
    
  • L179

    ts
    177      };
    178
    179      const r = random || Math.random;
    180      return pickRandom(descriptions[theme], r);
    181    }
    
  • L279

    ts
    277      random?: () => number
    278    ): QuestReward[] {
    279      const r = random || Math.random;
    280      const rewards: QuestReward[] = [
    281        {
    
  • L520

    ts
    518
    519    generateProphecy(config: ProphecyGenerationConfig): Prophecy {
    520      const random = config.seed ? seededRandom(config.seed) : Math.random;
    521
    522      const prophecy: Prophecy = {
    
  • L609

    ts
    607      random?: () => number
    608    ): ProphecySymbol[] {
    609      const r = random || Math.random;
    610      const allSymbols: ProphecySymbol[] = [
    611        {
    
  • L664

    ts
    662          const fromId = ids[i];
    663          const toId = ids[j];
    664          if (fromId && toId && Math.random() > 0.6) {
    665            connections.push({
    666              from: fromId,
    
  • L669

    ts
    667              to: toId,
    668              type: 'parallel',
    669              strength: 0.3 + Math.random() * 0.4,
    670              revealed: false,
    671              description: 'These prophecies are connected',
    

apps/lilith/svc-ai/src/rpg-rewards-progression/rewards-progression-service.ts#

  • L595

    ts
    593      };
    594
    595      const prefix = prefixes[category][Math.floor(Math.random() * prefixes[category].length)];
    596      return `${prefix} of ${action.replace(/_/g, ' ').replace(/\b\w/g, (l) => l.toUpperCase())}`;
    597    }
    

apps/lilith/svc-ai/src/rpg-temporal-mechanics/temporal-mechanics-service.ts#

  • L103

    ts
    101        anchors: this.generateAnchors(anchorCount),
    102        stabilityIndex: parentTimeline ? stabilityTarget - 20 : stabilityTarget,
    103        divergenceLevel: parentTimeline ? 30 + Math.floor(Math.random() * 40) : 0,
    104        activeParadoxes: [],
    105        createdAt: new Date().toISOString(),
    
  • L152

    ts
    150          type: types[i % types.length]!,
    151          eventId: generateUniqueId('event'),
    152          strength: 50 + Math.floor(Math.random() * 50),
    153          protectedRadius: 10 + Math.floor(Math.random() * 40),
    154          createdBy: 'system',
    
  • L153

    ts
    151          eventId: generateUniqueId('event'),
    152          strength: 50 + Math.floor(Math.random() * 50),
    153          protectedRadius: 10 + Math.floor(Math.random() * 40),
    154          createdBy: 'system',
    155          permanence: i === 0 ? 'eternal' : i < count / 2 ? 'lasting' : 'temporary',
    
  • L180

    ts
    178        branchPoint,
    179        divergenceCause,
    180        divergenceLevel: 20 + Math.floor(Math.random() * 30),
    181        mergeability: 70 - Math.floor(Math.random() * 40),
    182        sharedHistory: sourceTimeline.events
    
  • L181

    ts
    179        divergenceCause,
    180        divergenceLevel: 20 + Math.floor(Math.random() * 30),
    181        mergeability: 70 - Math.floor(Math.random() * 40),
    182        sharedHistory: sourceTimeline.events
    183          .slice(0, Math.floor(sourceTimeline.events.length / 2))
    
  • L469

    ts
    467      resolution: ParadoxResolution
    468    ): { success: boolean; timeline?: Timeline; sideEffects: string[] } {
    469      const success = Math.random() * 100 < resolution.successChance;
    470
    471      return {
    
  • L511

    ts
    509      };
    510
    511      const prefix = prefixes[type][Math.floor(Math.random() * prefixes[type].length)];
    512      return `${prefix} Anchor`;
    513    }
    
  • L524

    ts
    522      };
    523
    524      return baseStrength[type] + Math.floor(Math.random() * 10);
    525    }
    526
    
  • L536

    ts
    534      };
    535
    536      return baseRadius[type] + Math.floor(Math.random() * 15);
    537    }
    538
    
  • L789

    ts
    787
    788      // Effects typically diminish but can occasionally amplify
    789      if (Math.random() < 0.2) {
    790        return current; // Maintain level
    791      } else if (Math.random() < 0.1 && index < progression.length - 1) {
    
  • L791

    ts
    789      if (Math.random() < 0.2) {
    790        return current; // Maintain level
    791      } else if (Math.random() < 0.1 && index < progression.length - 1) {
    792        return progression[index + 1]!; // Amplify
    793      } else if (index > 0) {
    
  • L1002

    ts
    1000
    1001    private createMirrorCharacter(originalId: string, keyChanges: string[]): MirrorCharacter {
    1002      const hasOpposite = Math.random() < 0.3;
    1003      const isAware = Math.random() < 0.1;
    1004
    
  • L1003

    ts
    1001    private createMirrorCharacter(originalId: string, keyChanges: string[]): MirrorCharacter {
    1002      const hasOpposite = Math.random() < 0.3;
    1003      const isAware = Math.random() < 0.1;
    1004
    1005      return {
    
  • L1009

    ts
    1007        mirrorId: generateUniqueId('mirror'),
    1008        differences: this.generateCharacterDifferences(keyChanges),
    1009        alignment: hasOpposite ? 'opposite' : Math.random() < 0.5 ? 'same' : 'neutral',
    1010        awareness: isAware,
    1011      };
    
  • L1083

    ts
    1081        endEvent: endEventId,
    1082        duration: events.length * 24, // hours
    1083        iterations: 1 + Math.floor(Math.random() * 10),
    1084        breakConditions: this.generateBreakConditions(),
    1085        persistentMemories: [],
    

apps/lilith/svc-ai/src/rpg-veylmaster/veylmaster-service.ts#

  • L806

    ts
    804
    805    private calculateTimeInBeat(_state: SessionState, _beat: StoryBeatType): number {
    806      return Math.floor(Math.random() * 30) + 5; // 5-35 minutes estimate
    807    }
    808
    

apps/lilith/svc-ai/src/runpod-integration/runpod-integration-service.ts#

  • L840

    ts
    838      // progress source via advanceSyncProgress() as files are copied;
    839      // the job starts with 0 totals and the caller populates them. This
    840      // avoids synthesising file counts via Math.random (which previously
    841      // produced a different job shape on every test run).
    842      setImmediate(() => {
    
  • L898

    ts
    896     * tests call it directly to drive the state machine deterministically.
    897     * Progress % is computed against `totalFiles` which must have been
    898     * populated by the caller (no Math.random defaults).
    899     */
    900    advanceSyncProgress(jobId: string, files: number, bytes: number): void {
    

apps/lilith/svc-ai/src/sacred-environments/sacred-environments-service.ts#

  • L141

    ts
    139  function generateUUID(): string {
    140    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
    141      const r = (Math.random() * 16) | 0;
    142      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    143      return v.toString(16);
    

apps/lilith/svc-ai/src/strength-training-instruction/strength-training-instruction-service.ts#

  • L742

    ts
    740    const result = [...array];
    741    for (let i = result.length - 1; i > 0; i--) {
    742      const j = Math.floor(Math.random() * (i + 1));
    743      [result[i], result[j]] = [result[j], result[i]];
    744    }
    

apps/lilith/svc-ai/src/text-to-3d/text-to-3d-service.ts#

  • L939

    ts
    937      switch (timestepSchedule) {
    938        case 'uniform':
    939          return minTimestep + Math.random() * (maxTimestep - minTimestep);
    940        case 'linear_decay': {
    941          const progress = iteration / totalIterations;
    
  • L1531

    ts
    1529      for (let i = 0; i < mesh.triangles.length && newTriangles.length < targetFaces; i++) {
    1530        const tri = mesh.triangles[i];
    1531        if (tri && (Math.random() < ratio || newTriangles.length < targetFaces * 0.9)) {
    1532          newTriangles.push(tri);
    1533        }
    
  • L2013

    ts
    2011     * need real CLIP similarity must inject a CLIP scoring backend via a
    2012     * higher-level wiring layer; this method intentionally does not fall
    2013     * back to Math.random so the signal remains deterministic per prompt.
    2014     */
    2015    private calculateCLIPSimilarity(_views: RenderedView[], prompt: TextPrompt): number {
    
  • L2159

    ts
    2157    async generate(request: TextTo3DRequest): Promise<TextTo3DResponse> {
    2158      const startTime = Date.now();
    2159      const seed = request.seed ?? Math.floor(Math.random() * 1000000);
    2160
    2161      try {
    

apps/lilith/svc-ai/src/utils/request-retry-circuit-breaker.ts#

  • L279

    ts
    277    if (policy.jitter_enabled) {
    278      const jitterRange = delay * 0.1; // ±10% jitter
    279      delay = delay + (Math.random() - 0.5) * jitterRange * 2;
    280    }
    281
    

apps/lilith/svc-ai/src/utils/routing-configuration-policies.ts#

  • L388

    ts
    386    if (strategy.jitter_enabled) {
    387      const jitterRange = delay * 0.1; // ±10% jitter
    388      delay = delay + (Math.random() - 0.5) * jitterRange * 2;
    389    }
    390
    

apps/lilith/svc-ai/src/verification/consensus-detection.ts#

  • L480

    ts
    478      }
    479
    480      return 'Position ' + Math.random().toString(36).substr(2, 4);
    481    }
    482
    

apps/lilith/svc-ai/src/water-rendering/water-rendering-service.ts#

  • L363

    ts
    361    for (let i = 0; i < width * height; i++) {
    362      const idx = i * 4;
    363      data[idx] = Math.floor(Math.random() * 256);
    364      data[idx + 1] = Math.floor(Math.random() * 256);
    365      data[idx + 2] = Math.floor(Math.random() * 256);
    
  • L364

    ts
    362      const idx = i * 4;
    363      data[idx] = Math.floor(Math.random() * 256);
    364      data[idx + 1] = Math.floor(Math.random() * 256);
    365      data[idx + 2] = Math.floor(Math.random() * 256);
    366      data[idx + 3] = 255;
    
  • L365

    ts
    363      data[idx] = Math.floor(Math.random() * 256);
    364      data[idx + 1] = Math.floor(Math.random() * 256);
    365      data[idx + 2] = Math.floor(Math.random() * 256);
    366      data[idx + 3] = 255;
    367    }
    

apps/lilith/svc-ai/src/world-generation/gaussian-splatting-service.ts#

  • L618

    ts
    616          const pose: CameraPose = image.cameraPose ?? {
    617            position: {
    618              x: Math.random() * 2 - 1,
    619              y: Math.random() * 2,
    620              z: Math.random() * 2 - 1,
    
  • L619

    ts
    617            position: {
    618              x: Math.random() * 2 - 1,
    619              y: Math.random() * 2,
    620              z: Math.random() * 2 - 1,
    621            },
    
  • L620

    ts
    618              x: Math.random() * 2 - 1,
    619              y: Math.random() * 2,
    620              z: Math.random() * 2 - 1,
    621            },
    622            orientation: identityQuaternion(),
    
  • L647

    ts
    645        for (let i = 0; i < initialPointCount; i++) {
    646          initialPoints.push({
    647            x: Math.random() * 4 - 2,
    648            y: Math.random() * 4,
    649            z: Math.random() * 4 - 2,
    
  • L648

    ts
    646          initialPoints.push({
    647            x: Math.random() * 4 - 2,
    648            y: Math.random() * 4,
    649            z: Math.random() * 4 - 2,
    650          });
    
  • L649

    ts
    647            x: Math.random() * 4 - 2,
    648            y: Math.random() * 4,
    649            z: Math.random() * 4 - 2,
    650          });
    651        }
    
  • L671

    ts
    669            position: pos,
    670            color: {
    671              x: 0.5 + Math.random() * 0.5,
    672              y: 0.5 + Math.random() * 0.5,
    673              z: 0.5 + Math.random() * 0.5,
    
  • L672

    ts
    670            color: {
    671              x: 0.5 + Math.random() * 0.5,
    672              y: 0.5 + Math.random() * 0.5,
    673              z: 0.5 + Math.random() * 0.5,
    674            },
    
  • L673

    ts
    671              x: 0.5 + Math.random() * 0.5,
    672              y: 0.5 + Math.random() * 0.5,
    673              z: 0.5 + Math.random() * 0.5,
    674            },
    675            scale: { x: 0.02, y: 0.02, z: 0.02 },
    
  • L698

    ts
    696        // real optimiser is wired via attachTrainingBackend().
    697        const iterationSteps = 10;
    698        let currentPsnr = 15 + Math.random() * 5;
    699
    700        for (let step = 0; step < iterationSteps; step++) {
    
  • L717

    ts
    715                this.createSplat({
    716                  position: {
    717                    x: baseSplat.position.x + (Math.random() - 0.5) * 0.1,
    718                    y: baseSplat.position.y + (Math.random() - 0.5) * 0.1,
    719                    z: baseSplat.position.z + (Math.random() - 0.5) * 0.1,
    
  • L718

    ts
    716                  position: {
    717                    x: baseSplat.position.x + (Math.random() - 0.5) * 0.1,
    718                    y: baseSplat.position.y + (Math.random() - 0.5) * 0.1,
    719                    z: baseSplat.position.z + (Math.random() - 0.5) * 0.1,
    720                  },
    
  • L719

    ts
    717                    x: baseSplat.position.x + (Math.random() - 0.5) * 0.1,
    718                    y: baseSplat.position.y + (Math.random() - 0.5) * 0.1,
    719                    z: baseSplat.position.z + (Math.random() - 0.5) * 0.1,
    720                  },
    721                  color: { x: 0.5, y: 0.5, z: 0.5 },
    
  • L727

    ts
    725          }
    726
    727          currentPsnr += 1 + Math.random();
    728
    729          progressCallback?.({
    
  • L760

    ts
    758        splatCloud.metadata.trainingTime = (Date.now() - startTime) / 1000;
    759        splatCloud.metadata.psnr = currentPsnr;
    760        splatCloud.metadata.ssim = 0.85 + Math.random() * 0.1;
    761
    762        progressCallback?.({
    
  • L798

    ts
    796          psnr: splatCloud.metadata.psnr ?? 25,
    797          ssim: splatCloud.metadata.ssim ?? 0.9,
    798          lpips: 0.1 + Math.random() * 0.1,
    799          reprojectionError: 0.5 + Math.random() * 0.5,
    800          coverageRatio: 0.85 + Math.random() * 0.1,
    
  • L799

    ts
    797          ssim: splatCloud.metadata.ssim ?? 0.9,
    798          lpips: 0.1 + Math.random() * 0.1,
    799          reprojectionError: 0.5 + Math.random() * 0.5,
    800          coverageRatio: 0.85 + Math.random() * 0.1,
    801          viewsUsed: config.images.length,
    
  • L800

    ts
    798          lpips: 0.1 + Math.random() * 0.1,
    799          reprojectionError: 0.5 + Math.random() * 0.5,
    800          coverageRatio: 0.85 + Math.random() * 0.1,
    801          viewsUsed: config.images.length,
    802        };
    
  • L974

    ts
    972      const result = Array.from(selected.values());
    973      while (result.length < target && result.length < splats.length) {
    974        const randomIndex = Math.floor(Math.random() * splats.length);
    975        if (!result.includes(randomIndex)) {
    976          result.push(randomIndex);
    
  • L1457

    ts
    1455        // Generate splats using barycentric sampling
    1456        for (let i = 0; i < numSplats; i++) {
    1457          const u = Math.random();
    1458          const v = Math.random();
    1459          const w = 1 - u - v;
    
  • L1458

    ts
    1456        for (let i = 0; i < numSplats; i++) {
    1457          const u = Math.random();
    1458          const v = Math.random();
    1459          const w = 1 - u - v;
    1460
    

apps/lilith/svc-ai/src/world-generation/world-generation-service.ts#

  • L129

    ts
    127  function generateUUID(): string {
    128    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    129      const r = (Math.random() * 16) | 0;
    130      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    131      return v.toString(16);
    

apps/lilith/svc-anonymization/src/app.ts#

  • L457

    ts
    455       *
    456       * Differential privacy guarantees rely on the attacker being unable to
    457       * predict the noise added to a release. Math.random is explicitly not
    458       * cryptographically strong in V8 (Xorshift128+), so using it breaks the
    459       * privacy guarantee: an attacker who can observe enough release outputs
    

apps/lilith/svc-auth/src/__tests__/integration/auth-test-harness.ts#

  • L94

    ts
    92      ],
    93      apiKeyTests: {
    94        validKey: 'test_key_' + Math.random().toString(36).substring(7),
    95        invalidKey: 'invalid_key_xyz',
    96      },
    

apps/lilith/svc-biometric/src/implementations/GsrImplementations.ts#

  • L16

    ts
    14   * All pseudo-randomness in calibration sample synthesis is produced by a Linear
    15   * Congruential Generator (LCG) seeded from the call context, so repeated runs
    16   * with the same input return the same samples. No `Math.random` is used.
    17   *
    18   * Numeric EDA constants follow the conventions of:
    

apps/lilith/svc-biometric/src/implementations/PostureImplementations.ts#

  • L39

    ts
    37   *   of the gyroscope magnitude within 0.05–0.5 Hz.
    38   *
    39   * No `Math.random` is used. All pseudo-random calibration samples come from a
    40   * Linear Congruential Generator seeded via an FNV-1a hash of call-context
    41   * strings, matching the conventions of the HRV / GSR / eye-tracking defaults.
    

apps/lilith/svc-biometric/src/implementations/TemperatureImplementations.ts#

  • L31

    ts
    29   * All pseudo-random processes are driven by deterministic LCG / FNV-1a
    30   * hashing so calibration traces are reproducible for identical (deviceId,
    31   * userId) pairs. No Math.random is used anywhere in this module.
    32   */
    33
    

apps/lilith/svc-blockchain/src/content-licensing-service.ts#

  • L644

    ts
    642    generateMockCID() {
    643      // IPFS CIDs are base58 encoded and typically 46 characters (Qm + 44 chars).
    644      // Randomness is CSPRNG-backed via `randomBase58Like` (replaces `Math.random`)
    645      // so mock CIDs used as storage/dedupe keys aren't predictable.
    646      return `Qm${randomBase58Like(44)}`;
    

apps/lilith/svc-blockchain/src/crypto-random.ts#

  • L4

    ts
    2   * Cryptographically secure random helpers for svc-blockchain.
    3   *
    4   * These replace previous `Math.random()` callsites across mock runtimes,
    5   * id generators, and fake-hash producers. The outputs keep the same shape
    6   * (hex tx hashes, base58-ish CIDs, hex block numbers, wei-hex balances)
    
  • L8

    ts
    6   * (hex tx hashes, base58-ish CIDs, hex block numbers, wei-hex balances)
    7   * so downstream consumers are unaffected — only the randomness source
    8   * changes, from the PRNG `Math.random` to Node's CSPRNG (`crypto.randomBytes`
    9   * / `crypto.randomInt`).
    10   */
    

apps/lilith/svc-blockchain/src/in-memory-token-runtime.ts#

  • L364

    ts
    362  function randomHash(): string {
    363    // Mock tx hash for the token mock runtime. Randomness is CSPRNG-backed via
    364    // `randomTxHashLike` (replaces `Math.random`) so mock hashes keyed into
    365    // pending/confirmed maps remain collision-resistant.
    366    return randomTxHashLike();
    

apps/lilith/svc-blockchain/src/in-memory-transaction-runtime.ts#

  • L55

    ts
    53        transactionHash: tx.hash,
    54        // Monotone mock block number from a module counter — replaces the
    55        // `Math.random * 1e6` draw, which could produce non-monotone /
    56        // colliding "block numbers" across sibling confirmations. Shape
    57        // (`0x<hex>`) is unchanged.
    
  • L89

    ts
    87  function generateMockHash(): string {
    88    // Mock tx hash for the transaction mock runtime. Randomness is CSPRNG-backed
    89    // via `randomTxHashLike` (replaces `Math.random`) so hashes keyed into the
    90    // pending/confirmed transaction maps remain collision-resistant.
    91    return randomTxHashLike();
    

apps/lilith/svc-blockchain/src/nft-service.ts#

  • L452

    ts
    450     *
    451     * Used only on the mock fallback path. Randomness is CSPRNG-backed via
    452     * `randomTxHashLike` (replaces `Math.random`), producing a standard
    453     * `0x` + 64-hex-char Ethereum-style hash.
    454     */
    
  • L464

    ts
    462     * Keeps the `Qm` + 44-char base58-alphabet shape so consumers treating the
    463     * value as an IPFS CID still parse it. Randomness is CSPRNG-backed via
    464     * `randomBase58Like` (replaces `Math.random`).
    465     */
    466    generateIPFSHash() {
    

apps/lilith/svc-blockchain/src/sacred-asset-metadata.ts#

  • L467

    ts
    465          { trait_type: 'Algorithm', value: algorithm || 'Mandelbrot' },
    466          // Seed trait falls back to a 16-char CSPRNG hex draw when the caller
    467          // didn't supply one; replaces the previous `Math.random()` fallback
    468          // so generative art seeds aren't predictable from a PRNG state.
    469          { trait_type: 'Seed', value: seed || `0x${randomHex(16)}` },
    

apps/lilith/svc-blockchain/src/security-service.ts#

  • L537

    ts
    535     * Log an audit entry.
    536     *
    537     * The entry id now uses a CSPRNG-backed suffix (replaces `Math.random`)
    538     * so audit trails can't be predicted or collided with by an attacker
    539     * who observes earlier ids.
    

apps/lilith/svc-blockchain/src/transaction-manager.ts#

  • L568

    ts
    566     * Generate unique transaction ID.
    567     *
    568     * Replaces `Math.random` with a CSPRNG-backed suffix via `randomShortId`
    569     * so distinct managers / concurrent generations can't collide predictably.
    570     */
    

apps/lilith/svc-blockchain/src/wallet-service.ts#

  • L1230

    ts
    1228     *
    1229     * Generates a random address to avoid hardcoded test values. Randomness is
    1230     * CSPRNG-backed via `randomHex` (replaces `Math.random`) so test addresses
    1231     * can't be predicted from an observable PRNG state.
    1232     */
    
  • L1255

    ts
    1253     *
    1254     * Produces a 65-byte Ethereum-style signature shape (`0x` + 130 hex chars).
    1255     * Randomness is CSPRNG-backed via `randomHex` (replaces `Math.random`) so
    1256     * mock signatures can't be guessed from PRNG state during tests that
    1257     * persist them.
    
  • L1279

    ts
    1277     *
    1278     * Same 65-byte signature shape as `mockSignMessage`. Randomness is
    1279     * CSPRNG-backed via `randomHex` (replaces `Math.random`).
    1280     */
    1281    mockSignTypedData(
    
  • L1306

    ts
    1304     *
    1305     * Returns a hex-wei balance. Randomness is CSPRNG-backed via
    1306     * `randomBalanceHex` (replaces `Math.random`). The `formatted` conversion
    1307     * is preserved from the prior behavior so existing callers/tests see the
    1308     * same shape.
    

apps/lilith/svc-conversation/src/app.ts#

  • L1598

    ts
    1596      } else {
    1597        // Use random for lower failure rates
    1598        if (Math.random() < failureRate) {
    1599          const error = new Error('Simulated transient failure') as Error & { statusCode?: number };
    1600          error.statusCode = 500;
    
  • L1616

    ts
    1614        // Add ±25% jitter to prevent thundering herd
    1615        const jitterAmount = exponential * 0.25;
    1616        return exponential + (Math.random() * 2 - 1) * jitterAmount;
    1617      }
    1618      return exponential;
    

apps/lilith/svc-daily-content/src/services/content-sharing-service.ts#

  • L51

    ts
    49  } from '../types.js';
    50
    51  // Helper to generate random tokens using CSPRNG (CLAUDE.md bans Math.random for tokens)
    52  function generateToken(length: number): string {
    53    const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
    

apps/lilith/svc-error-handler/src/app.ts#

  • L717

    ts
    715        case 'retry_request':
    716          shouldRetry = true;
    717          retryAfter = Date.now() + Math.random() * 5000 + 1000; // 1-6 second delay
    718          break;
    719
    

apps/lilith/svc-fiat-ramp/src/fiat-ramp.ts#

  • L25

    ts
    23   *      (because the tx id itself contains 4 bytes of csprng entropy).
    24   *   3. The format is a well-formed 0x + 40 hex character eth-style
    25   *      address, not a variable-length Math.random string.
    26   * When `FIAT_RAMP_PROVIDER_ADDRESS_HOOK` is set to a module that exports
    27   * `mintDepositAddress(txId)`, we call it instead so production
    
  • L47

    ts
    45   * enumerate them to spoof verification; node's crypto.randomInt backs
    46   * a uniform draw over the configured cent range, then we divide by 100
    47   * for the final decimal amount. This replaces Math.random (v8
    48   * Xorshift128+, predictable) which meant a determined attacker
    49   * observing any sequence of micro-deposits could forecast the next
    

apps/lilith/svc-media/__mocks__/core-mock.ts#

  • L145

    ts
    143
    144  // Mock utilities
    145  export const generateId = vi.fn(() => 'mock-id-' + Math.random().toString(36).substr(2, 9));
    146  export const generateUUID = vi.fn(() => 'mock-uuid-' + Math.random().toString(36).substr(2, 9));
    147
    
  • L146

    ts
    144  // Mock utilities
    145  export const generateId = vi.fn(() => 'mock-id-' + Math.random().toString(36).substr(2, 9));
    146  export const generateUUID = vi.fn(() => 'mock-uuid-' + Math.random().toString(36).substr(2, 9));
    147
    148  // Service names
    

apps/lilith/svc-media/src/transcripts/transcript-processor.ts#

  • L346

    ts
    344        startTime: Math.round(segment.startTime + index * wordDuration),
    345        endTime: Math.round(segment.startTime + (index + 1) * wordDuration),
    346        confidence: confidenceBase - Math.random() * 0.1 // Add slight variance
    347      };
    348      if (segment.speakerId !== undefined) {
    

apps/lilith/svc-meditation-generation/src/time-optimizer.ts#

  • L584

    ts
    582    const fallback = phrases['presence'] ?? [];
    583    const options = phrases[emphasis] ?? fallback;
    584    const pickIndex = options.length > 0 ? Math.floor(Math.random() * options.length) : 0;
    585    return options[pickIndex] ?? options[0] ?? '';
    586  }
    
  • L626

    ts
    624    const fallback = phrases['gratitude'] ?? [];
    625    const options = phrases[emphasis] ?? fallback;
    626    const pickIndex = options.length > 0 ? Math.floor(Math.random() * options.length) : 0;
    627    return options[pickIndex] ?? options[0] ?? '';
    628  }
    

apps/lilith/svc-metaverse/src/advanced/AstralProjection.ts#

  • L550

    ts
    548      for (let i = 0; i < this.etherealEffect.particleCount; i++) {
    549        const angle = (i / this.etherealEffect.particleCount) * Math.PI * 2;
    550        const radius = 2 + Math.random() * 3;
    551        const height = Math.random() * 4 - 2;
    552
    
  • L551

    ts
    549        const angle = (i / this.etherealEffect.particleCount) * Math.PI * 2;
    550        const radius = 2 + Math.random() * 3;
    551        const height = Math.random() * 4 - 2;
    552
    553        particles.push({
    
  • L559

    ts
    557            this.state.astralPosition[2] + Math.sin(angle) * radius,
    558          ],
    559          velocity: [Math.cos(angle) * 0.5, Math.random() * 0.5 - 0.25, Math.sin(angle) * 0.5],
    560          color: this.etherealEffect.colorShift,
    561          size: 0.1 + Math.random() * 0.2,
    
  • L561

    ts
    559          velocity: [Math.cos(angle) * 0.5, Math.random() * 0.5 - 0.25, Math.sin(angle) * 0.5],
    560          color: this.etherealEffect.colorShift,
    561          size: 0.1 + Math.random() * 0.2,
    562          life: 1.0,
    563        });
    

apps/lilith/svc-metaverse/src/advanced/EnergyFieldVisualization.ts#

  • L242

    ts
    240
    241    private spawnEnergyParticle(): void {
    242      const angle = Math.random() * Math.PI * 2;
    243      const radius = 0.5 + Math.random() * 1.5;
    244
    
  • L243

    ts
    241    private spawnEnergyParticle(): void {
    242      const angle = Math.random() * Math.PI * 2;
    243      const radius = 0.5 + Math.random() * 1.5;
    244
    245      this.energyFlow.particles.push({
    
  • L248

    ts
    246        position: [
    247          this.bodyPosition[0] + Math.cos(angle) * radius,
    248          this.bodyPosition[1] + Math.random() * 2,
    249          this.bodyPosition[2] + Math.sin(angle) * radius,
    250        ],
    
  • L257

    ts
    255        ],
    256        color: this.getRandomEnergyColor(),
    257        size: 0.05 + Math.random() * 0.1,
    258        life: 2.0 + Math.random() * 2.0,
    259      });
    
  • L258

    ts
    256        color: this.getRandomEnergyColor(),
    257        size: 0.05 + Math.random() * 0.1,
    258        life: 2.0 + Math.random() * 2.0,
    259      });
    260    }
    

apps/lilith/svc-metaverse/src/advanced/ProceduralWorldGenerator.ts#

  • L105

    ts
    103    ) {
    104      this.seed = {
    105        seed: config.seed || Math.floor(Math.random() * 1000000),
    106        version: '1.0.0',
    107      };
    

apps/lilith/svc-metaverse/src/advanced/UnderwaterConsciousness.ts#

  • L150

    ts
    148      for (let i = 0; i < count; i++) {
    149        const type: MarineLife['type'] = ['fish', 'jellyfish', 'whale', 'dolphin', 'ray'][
    150          Math.floor(Math.random() * 5)
    151        ] as MarineLife['type'];
    152
    
  • L156

    ts
    154          id: `marine_${i}`,
    155          type,
    156          position: [Math.random() * 200 - 100, -Math.random() * 100, Math.random() * 200 - 100],
    157          velocity: [
    158            (Math.random() - 0.5) * 2,
    
  • L158

    ts
    156          position: [Math.random() * 200 - 100, -Math.random() * 100, Math.random() * 200 - 100],
    157          velocity: [
    158            (Math.random() - 0.5) * 2,
    159            (Math.random() - 0.5) * 0.5,
    160            (Math.random() - 0.5) * 2
    
  • L159

    ts
    157          velocity: [
    158            (Math.random() - 0.5) * 2,
    159            (Math.random() - 0.5) * 0.5,
    160            (Math.random() - 0.5) * 2
    161          ],
    
  • L160

    ts
    158            (Math.random() - 0.5) * 2,
    159            (Math.random() - 0.5) * 0.5,
    160            (Math.random() - 0.5) * 2
    161          ],
    162          size: type === 'whale' ? 10 : type === 'fish' ? 0.5 : 2
    

apps/lilith/svc-metaverse/src/ai/AIServiceClient.ts#

  • L340

    ts
    338      ];
    339
    340      const idx = Math.floor(Math.random() * fallbacks.length);
    341      return fallbacks[idx];
    342    }
    
  • L433

    ts
    431    randomUUID: () => {
    432      return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
    433        const r = (Math.random() * 16) | 0;
    434        const v = c === 'x' ? r : (r & 0x3) | 0x8;
    435        return v.toString(16);
    

apps/lilith/svc-metaverse/src/ai/DialogueSystem.ts#

  • L255

    ts
    253        const topicData = this.topics.get(topic);
    254        if (topicData) {
    255          const idx = Math.floor(Math.random() * topicData.responses.length);
    256          return topicData.responses[idx];
    257        }
    

apps/lilith/svc-metaverse/src/ai/PersonalityEngine.ts#

  • L522

    ts
    520      // Add random variation (±0.1)
    521      return {
    522        openness: Math.max(0, Math.min(1, base.o + (Math.random() - 0.5) * 0.2)),
    523        conscientiousness: Math.max(0, Math.min(1, base.c + (Math.random() - 0.5) * 0.2)),
    524        extraversion: Math.max(0, Math.min(1, base.e + (Math.random() - 0.5) * 0.2)),
    
  • L523

    ts
    521      return {
    522        openness: Math.max(0, Math.min(1, base.o + (Math.random() - 0.5) * 0.2)),
    523        conscientiousness: Math.max(0, Math.min(1, base.c + (Math.random() - 0.5) * 0.2)),
    524        extraversion: Math.max(0, Math.min(1, base.e + (Math.random() - 0.5) * 0.2)),
    525        agreeableness: Math.max(0, Math.min(1, base.a + (Math.random() - 0.5) * 0.2)),
    
  • L524

    ts
    522        openness: Math.max(0, Math.min(1, base.o + (Math.random() - 0.5) * 0.2)),
    523        conscientiousness: Math.max(0, Math.min(1, base.c + (Math.random() - 0.5) * 0.2)),
    524        extraversion: Math.max(0, Math.min(1, base.e + (Math.random() - 0.5) * 0.2)),
    525        agreeableness: Math.max(0, Math.min(1, base.a + (Math.random() - 0.5) * 0.2)),
    526        neuroticism: Math.max(0, Math.min(1, base.n + (Math.random() - 0.5) * 0.2))
    
  • L525

    ts
    523        conscientiousness: Math.max(0, Math.min(1, base.c + (Math.random() - 0.5) * 0.2)),
    524        extraversion: Math.max(0, Math.min(1, base.e + (Math.random() - 0.5) * 0.2)),
    525        agreeableness: Math.max(0, Math.min(1, base.a + (Math.random() - 0.5) * 0.2)),
    526        neuroticism: Math.max(0, Math.min(1, base.n + (Math.random() - 0.5) * 0.2))
    527      };
    
  • L526

    ts
    524        extraversion: Math.max(0, Math.min(1, base.e + (Math.random() - 0.5) * 0.2)),
    525        agreeableness: Math.max(0, Math.min(1, base.a + (Math.random() - 0.5) * 0.2)),
    526        neuroticism: Math.max(0, Math.min(1, base.n + (Math.random() - 0.5) * 0.2))
    527      };
    528    }
    
  • L906

    ts
    904
    905      for (const quirk of personality.quirks) {
    906        if (quirk.triggers.includes(trigger) && Math.random() < quirk.frequency) {
    907          return quirk;
    908        }
    

apps/lilith/svc-metaverse/src/ai/ai-community-simulation.ts#

  • L163

    ts
    161  export function createGossip(community: Community, config: any): Gossip {
    162    const gossip: Gossip = {
    163      id: `gossip_${Math.random().toString(36).substr(2, 9)}`,
    164      topic: config.topic,
    165      subject: config.subject,
    
  • L216

    ts
    214  export function createStoryEvent(community: Community, config: any): StoryEvent {
    215    const story: StoryEvent = {
    216      id: `story_${Math.random().toString(36).substr(2, 9)}`,
    217      title: config.title,
    218      participants: config.participants,
    

apps/lilith/svc-metaverse/src/ai/ai-guide-assignment.ts#

  • L125

    ts
    123  export function createAssignment(config: any): Assignment {
    124    return {
    125      id: `assignment_${Math.random().toString(36).substr(2, 9)}`,
    126      guideId: config.guideId,
    127      userId: config.userId,
    

apps/lilith/svc-metaverse/src/ai/ai-sacred-art-generation.ts#

  • L1004

    ts
    1002        const varArt = generateFromType(baseArt.type, {
    1003          ...baseArt,
    1004          seed: Math.floor(Math.random() * 2147483647),
    1005        });
    1006
    

apps/lilith/svc-metaverse/src/ai/ambient-life-system.ts#

  • L197

    ts
    195      if (entity.movementPattern === 'wander' && entity.position) {
    196        // Simple random wander
    197        entity.position.x += (Math.random() - 0.5) * deltaTime;
    198        entity.position.y += (Math.random() - 0.5) * deltaTime * 0.5; // Less vertical movement
    199        entity.position.z += (Math.random() - 0.5) * deltaTime;
    
  • L198

    ts
    196        // Simple random wander
    197        entity.position.x += (Math.random() - 0.5) * deltaTime;
    198        entity.position.y += (Math.random() - 0.5) * deltaTime * 0.5; // Less vertical movement
    199        entity.position.z += (Math.random() - 0.5) * deltaTime;
    200      }
    
  • L199

    ts
    197        entity.position.x += (Math.random() - 0.5) * deltaTime;
    198        entity.position.y += (Math.random() - 0.5) * deltaTime * 0.5; // Less vertical movement
    199        entity.position.z += (Math.random() - 0.5) * deltaTime;
    200      }
    201
    
  • L203

    ts
    201
    202      // Update states based on time
    203      if (Math.random() < 0.1) {
    204        // 10% chance per update
    205        const states = ['idle', 'moving', 'resting', 'active'];
    

apps/lilith/svc-metaverse/src/ai/behavior-trees.ts#

  • L46

    ts
    44  export function createBehaviorTree(config: any): BehaviorTree {
    45    return {
    46      id: `tree_${Math.random().toString(36).substr(2, 9)}`,
    47      name: config.name ?? 'unnamed_tree',
    48    };
    
  • L88

    ts
    86    if (typeof execute === 'function') {
    87      return {
    88        id: `action_${Math.random().toString(36).substr(2, 9)}`,
    89        name,
    90        type: 'action',
    
  • L103

    ts
    101
    102    return {
    103      id: `action_${Math.random().toString(36).substr(2, 9)}`,
    104      name,
    105      type: 'action',
    
  • L190

    ts
    188  ): BehaviorNode {
    189    return {
    190      id: `condition_${Math.random().toString(36).substr(2, 9)}`,
    191      name,
    192      type: 'condition',
    
  • L202

    ts
    200  export function createSequenceNode(name: string): BehaviorNode {
    201    return {
    202      id: `sequence_${Math.random().toString(36).substr(2, 9)}`,
    203      name,
    204      type: 'sequence',
    
  • L214

    ts
    212  export function createSelectorNode(name: string): BehaviorNode {
    213    return {
    214      id: `selector_${Math.random().toString(36).substr(2, 9)}`,
    215      name,
    216      type: 'selector',
    

apps/lilith/svc-metaverse/src/ai/celtic-druids.ts#

  • L773

    ts
    771   * a grove's recognized lineage depth — the number of consecutive initiate
    772   * generations documented for that grove in the Celtic Druidic tradition.
    773   * This replaces a Math.random() approximation; the depth here is deterministic and
    774   * grounded in published lineage histories (Order of Bards, Ovates & Druids
    775   * grove records; Forest of Brocéliande scholarly reconstructions).
    

apps/lilith/svc-metaverse/src/ai/interactive-consciousness-simulations.ts#

  • L713

    ts
    711      style: config.style,
    712      data: {
    713        coordinates: config.dimensions.map((dim) => ({ dimension: dim, value: Math.random() })),
    714      },
    715    };
    

apps/lilith/svc-metaverse/src/ai/mayan-daykeepers.ts#

  • L647

    ts
    645  export function performReading(config: { studentId: string; question: string }): Reading {
    646    recordTeaching('mayan-daykeepers', 'performReading', config);
    647    const randomDaySign = DAY_SIGNS[Math.floor(Math.random() * 20)];
    648    const randomTone = Math.floor(Math.random() * 13) + 1;
    649    const toneInfo = GALACTIC_TONES[randomTone - 1];
    
  • L648

    ts
    646    recordTeaching('mayan-daykeepers', 'performReading', config);
    647    const randomDaySign = DAY_SIGNS[Math.floor(Math.random() * 20)];
    648    const randomTone = Math.floor(Math.random() * 13) + 1;
    649    const toneInfo = GALACTIC_TONES[randomTone - 1];
    650
    
  • L714

    ts
    712    return {
    713      authentic,
    714      lineageDepth: authentic ? Math.floor(Math.random() * 25) + 10 : 0,
    715      verification: authentic
    716        ? `Verified lineage in ${config.lineage} tradition`
    

apps/lilith/svc-metaverse/src/ai/personality-engine.ts#

  • L92

    ts
    90    }
    91  ): Personality {
    92    const id = 'personality_' + Math.random().toString(36).substr(2, 9);
    93
    94    // Seed-based trait generation for reproducibility
    
  • L95

    ts
    93
    94    // Seed-based trait generation for reproducibility
    95    const seed = options?.seed || Math.random() * 10000;
    96    const seededRandom = (min: number, max: number, index: number) => {
    97      const x = Math.sin(seed + index * 0.1) * 10000;
    
  • L232

    ts
    230
    231    const blended: Personality = {
    232      id: 'hybrid_' + Math.random().toString(36).substr(2, 9),
    233      archetype: `${archetype1}_${archetype2}`,
    234      traits: {
    
  • L389

    ts
    387  export async function savePersonality(persona: Personality): Promise<void> {
    388    if (!persona.id) {
    389      persona.id = 'personality_' + Math.random().toString(36).substr(2, 9);
    390    }
    391    personalityStore.set(persona.id, persona);
    

apps/lilith/svc-metaverse/src/ai/teachers/MultiModalComm.ts#

  • L543

    ts
    541      // Calculate clarity based on relationship depth (would integrate with DeepPersonality)
    542      const baseClarity = 0.7;
    543      const distortion = Math.random() * 0.2; // Mental noise
    544
    545      return {
    
  • L553

    ts
    551        emotionalTone: emotion,
    552        timestamp: Date.now(),
    553        receivedSuccessfully: Math.random() > distortion,
    554        distortionLevel: distortion,
    555      };
    

apps/lilith/svc-metaverse/src/ai/teachers/advanced/DreamInterpretation.ts#

  • L634

    ts
    632            symbol: symbolName,
    633            meaning: personalMeaning || symbol?.jungianMeaning || 'Unknown symbol',
    634            significance: symbol ? 0.7 + Math.random() * 0.3 : 0.3,
    635          };
    636        })
    

apps/lilith/svc-metaverse/src/ai/teachers/advanced/EnergyReading.ts#

  • L237

    ts
    235    private analyzeAura(userId: string): AuraLayer[] {
    236      return this.AURA_LAYERS.map(layer => {
    237        const baseIntensity = 0.6 + Math.random() * 0.3;
    238        const clarity = 0.5 + Math.random() * 0.5;
    239
    
  • L238

    ts
    236      return this.AURA_LAYERS.map(layer => {
    237        const baseIntensity = 0.6 + Math.random() * 0.3;
    238        const clarity = 0.5 + Math.random() * 0.5;
    239
    240        return {
    
  • L292

    ts
    290    private analyzeChakras(userId: string): ChakraState[] {
    291      return this.CHAKRAS.map((chakra, index) => {
    292        const balance = -0.3 + Math.random() * 0.6; // -0.3 to 0.3
    293        const openness = 0.4 + Math.random() * 0.6;
    294        const blockageLevel = Math.max(0, -balance * 0.5 + (1 - openness) * 0.5);
    
  • L293

    ts
    291      return this.CHAKRAS.map((chakra, index) => {
    292        const balance = -0.3 + Math.random() * 0.6; // -0.3 to 0.3
    293        const openness = 0.4 + Math.random() * 0.6;
    294        const blockageLevel = Math.max(0, -balance * 0.5 + (1 - openness) * 0.5);
    295
    
  • L358

    ts
    356    private analyzeMeridians(userId: string): Meridian[] {
    357      return this.MERIDIANS.map(meridian => {
    358        const flowRate = 0.5 + Math.random() * 0.5;
    359        const blockages = this.generateMeridianBlockages(meridian.name, flowRate);
    360
    
  • L387

    ts
    385        blockages.push({
    386          location: locations[i % locations.length],
    387          severity: 0.3 + Math.random() * 0.7
    388        });
    389      }
    
  • L405

    ts
    403        primary,
    404        secondary,
    405        intensity: 0.3 + Math.random() * 0.7,
    406        stability: 0.4 + Math.random() * 0.6,
    407        authenticity: 0.5 + Math.random() * 0.5,
    
  • L406

    ts
    404        secondary,
    405        intensity: 0.3 + Math.random() * 0.7,
    406        stability: 0.4 + Math.random() * 0.6,
    407        authenticity: 0.5 + Math.random() * 0.5,
    408        patterns: this.identifyEmotionalPatterns(primary)
    
  • L407

    ts
    405        intensity: 0.3 + Math.random() * 0.7,
    406        stability: 0.4 + Math.random() * 0.6,
    407        authenticity: 0.5 + Math.random() * 0.5,
    408        patterns: this.identifyEmotionalPatterns(primary)
    409      };
    
  • L434

    ts
    432     */
    433    private assessStress(userId: string): StressAssessment {
    434      const level = Math.random();
    435      const type = level > 0.7 ? 'acute' : level > 0.4 ? 'chronic' : 'none';
    436
    
  • L473

    ts
    471     */
    472    private measureMeditationDepth(userId: string): MeditationDepth {
    473      const depth = Math.random();
    474      let state: MeditationDepth['state'];
    475      let brainwavePattern: MeditationDepth['brainwavePattern'];
    
  • L497

    ts
    495        coherence: 0.5 + depth * 0.5,
    496        stability: 0.4 + depth * 0.6,
    497        duration: Math.floor(Math.random() * 1800) // 0-30 minutes
    498      };
    499    }
    

apps/lilith/svc-metaverse/src/creator/AssetLibrary.ts#

  • L80

    ts
    78  /**
    79   * Deterministic seeded-noise helper used across the catalog seed. We must
    80   * NOT use Math.random() inside the asset initializer: the catalog would
    81   * churn between process restarts, every redeploy would invalidate
    82   * downloadCount / favoriteCount / rating totals, and tests could not
    

apps/lilith/svc-metaverse/src/creator/TerrainGenerator.ts#

  • L106

    ts
    104        resolution: 128,
    105        maxHeight: 100,
    106        seed: Math.random() * 10000,
    107        ...config,
    108      };
    
  • L433

    ts
    431              4;
    432
    433            this.setHeight(x + halfChunk, y + halfChunk, avg + (Math.random() - 0.5) * randomRange);
    434          }
    435        }
    
  • L449

    ts
    447
    448            const avg = sum / 4;
    449            this.setHeight(x, y, avg + (Math.random() - 0.5) * randomRange);
    450          }
    451        }
    
  • L500

    ts
    498            }
    499            case 'noise':
    500              newHeight = currentHeight + (Math.random() - 0.5) * strength * 2;
    501              break;
    502          }
    
  • L601

    ts
    599
    600        for (let i = 0; i < instanceCount; i++) {
    601          const x = Math.floor(Math.random() * this.heightMap.width);
    602          const y = Math.floor(Math.random() * this.heightMap.height);
    603          const height = this.getHeight(x, y);
    
  • L602

    ts
    600        for (let i = 0; i < instanceCount; i++) {
    601          const x = Math.floor(Math.random() * this.heightMap.width);
    602          const y = Math.floor(Math.random() * this.heightMap.height);
    603          const height = this.getHeight(x, y);
    604
    
  • L612

    ts
    610              assetId: rule.assetId,
    611              position: [worldX, height, worldZ] as [number, number, number],
    612              rotation: rule.rotation ? Math.random() * Math.PI * 2 : 0,
    613              scale: rule.scale.min + Math.random() * (rule.scale.max - rule.scale.min),
    614            });
    
  • L613

    ts
    611              position: [worldX, height, worldZ] as [number, number, number],
    612              rotation: rule.rotation ? Math.random() * Math.PI * 2 : 0,
    613              scale: rule.scale.min + Math.random() * (rule.scale.max - rule.scale.min),
    614            });
    615          }
    

apps/lilith/svc-metaverse/src/environments/CosmicSpaces.ts#

  • L236

    ts
    234          // Logarithmic spiral
    235          for (let i = 0; i < starCount; i++) {
    236            const angle = Math.random() * Math.PI * 4;
    237            const radius = Math.random() * 5000 * Math.exp(angle * 0.1);
    238            const armOffset = ((i % 2) * Math.PI) / 2; // Two main arms
    
  • L237

    ts
    235          for (let i = 0; i < starCount; i++) {
    236            const angle = Math.random() * Math.PI * 4;
    237            const radius = Math.random() * 5000 * Math.exp(angle * 0.1);
    238            const armOffset = ((i % 2) * Math.PI) / 2; // Two main arms
    239            const x = radius * Math.cos(angle + armOffset);
    
  • L241

    ts
    239            const x = radius * Math.cos(angle + armOffset);
    240            const z = radius * Math.sin(angle + armOffset);
    241            const y = (Math.random() - 0.5) * 100;
    242
    243            stars.push({
    
  • L245

    ts
    243            stars.push({
    244              position: [x, y, z] as [number, number, number],
    245              color: this.getStarColor(Math.random()),
    246              brightness: Math.random() * 0.5 + 0.5
    247            });
    
  • L246

    ts
    244              position: [x, y, z] as [number, number, number],
    245              color: this.getStarColor(Math.random()),
    246              brightness: Math.random() * 0.5 + 0.5
    247            });
    248          }
    
  • L254

    ts
    252          // Elliptical distribution
    253          for (let i = 0; i < starCount; i++) {
    254            const theta = Math.random() * Math.PI * 2;
    255            const phi = Math.acos(2 * Math.random() - 1);
    256            const radius = Math.pow(Math.random(), 0.3) * 3000;
    
  • L255

    ts
    253          for (let i = 0; i < starCount; i++) {
    254            const theta = Math.random() * Math.PI * 2;
    255            const phi = Math.acos(2 * Math.random() - 1);
    256            const radius = Math.pow(Math.random(), 0.3) * 3000;
    257
    
  • L256

    ts
    254            const theta = Math.random() * Math.PI * 2;
    255            const phi = Math.acos(2 * Math.random() - 1);
    256            const radius = Math.pow(Math.random(), 0.3) * 3000;
    257
    258            const x = radius * Math.sin(phi) * Math.cos(theta);
    
  • L264

    ts
    262            stars.push({
    263              position: [x, y, z] as [number, number, number],
    264              color: this.getStarColor(Math.random()),
    265              brightness: Math.random() * 0.5 + 0.5
    266            });
    
  • L265

    ts
    263              position: [x, y, z] as [number, number, number],
    264              color: this.getStarColor(Math.random()),
    265              brightness: Math.random() * 0.5 + 0.5
    266            });
    267          }
    
  • L273

    ts
    271          // Random clusters
    272          for (let i = 0; i < starCount; i++) {
    273            const clusterX = (Math.random() - 0.5) * 8000;
    274            const clusterY = (Math.random() - 0.5) * 2000;
    275            const clusterZ = (Math.random() - 0.5) * 8000;
    
  • L274

    ts
    272          for (let i = 0; i < starCount; i++) {
    273            const clusterX = (Math.random() - 0.5) * 8000;
    274            const clusterY = (Math.random() - 0.5) * 2000;
    275            const clusterZ = (Math.random() - 0.5) * 8000;
    276
    
  • L275

    ts
    273            const clusterX = (Math.random() - 0.5) * 8000;
    274            const clusterY = (Math.random() - 0.5) * 2000;
    275            const clusterZ = (Math.random() - 0.5) * 8000;
    276
    277            stars.push({
    
  • L279

    ts
    277            stars.push({
    278              position: [clusterX, clusterY, clusterZ] as [number, number, number],
    279              color: this.getStarColor(Math.random()),
    280              brightness: Math.random() * 0.5 + 0.5
    281            });
    
  • L280

    ts
    278              position: [clusterX, clusterY, clusterZ] as [number, number, number],
    279              color: this.getStarColor(Math.random()),
    280              brightness: Math.random() * 0.5 + 0.5
    281            });
    282          }
    
  • L300

    ts
    298
    299      for (let i = 0; i < particleCount; i++) {
    300        const x = config.position[0] + (Math.random() - 0.5) * config.size[0];
    301        const y = config.position[1] + (Math.random() - 0.5) * config.size[1];
    302        const z = config.position[2] + (Math.random() - 0.5) * config.size[2];
    
  • L301

    ts
    299      for (let i = 0; i < particleCount; i++) {
    300        const x = config.position[0] + (Math.random() - 0.5) * config.size[0];
    301        const y = config.position[1] + (Math.random() - 0.5) * config.size[1];
    302        const z = config.position[2] + (Math.random() - 0.5) * config.size[2];
    303
    
  • L302

    ts
    300        const x = config.position[0] + (Math.random() - 0.5) * config.size[0];
    301        const y = config.position[1] + (Math.random() - 0.5) * config.size[1];
    302        const z = config.position[2] + (Math.random() - 0.5) * config.size[2];
    303
    304        // Create wispy structure using perlin-like noise
    
  • L315

    ts
    313        particles.push({
    314          position: [x, y, z] as [number, number, number],
    315          size: Math.random() * 50 + 20,
    316          opacity: Math.max(0, opacity)
    317        });
    

apps/lilith/svc-metaverse/src/environments/WeatherSystem.ts#

  • L526

    ts
    524            const override = process.env['LIGHTNING_STRIKE_NOW'] === '1';
    525            const strikeChance = Math.min(1, effect.intensity * deltaTime * 0.5);
    526            if (override || Math.random() < strikeChance) {
    527              effect.intensity = Math.min(1, effect.intensity + 0.2);
    528            } else {
    

apps/lilith/svc-metaverse/src/geometry/ancient-sites.ts#

  • L6

    ts
    4   */
    5
    6  // Deterministic seeded "noise". Math.random() is banned in procedural
    7  // geometry generators because it makes worlds non-reproducible — a
    8  // client that caches vertices by site id would see every position drift
    

apps/lilith/svc-metaverse/src/geometry/cosmic-spaces-routes.ts#

  • L83

    ts
    81      }
    82
    83      const galaxyId = 'galaxy_' + Math.random().toString(36).substr(2, 9);
    84      galaxyCache.set(galaxyId, galaxy);
    85
    
  • L114

    ts
    112      }
    113
    114      const nebulaId = 'nebula_' + Math.random().toString(36).substr(2, 9);
    115      nebulaeCache.set(nebulaId, nebula);
    116
    

apps/lilith/svc-metaverse/src/geometry/cosmic-spaces.ts#

  • L28

    ts
    26    const armCount = params.armCount || 2;
    27    const radius = params.radius || 5000;
    28    const seed = params.seed || Math.random() * 10000;
    29
    30    const stars = [];
    
  • L39

    ts
    37        position: {
    38          x: Math.cos(angle) * r,
    39          y: (Math.random() - 0.5) * 500,
    40          z: Math.sin(angle) * r
    41        },
    
  • L42

    ts
    40          z: Math.sin(angle) * r
    41        },
    42        magnitude: Math.random() * 6 - 2,
    43        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    44        temperature: 3000 + Math.random() * 7000
    
  • L43

    ts
    41        },
    42        magnitude: Math.random() * 6 - 2,
    43        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    44        temperature: 3000 + Math.random() * 7000
    45      });
    
  • L44

    ts
    42        magnitude: Math.random() * 6 - 2,
    43        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    44        temperature: 3000 + Math.random() * 7000
    45      });
    46    }
    
  • L55

    ts
    53      stars,
    54      stellarMass: starCount * 1.989 * Math.pow(10, 30),
    55      age: Math.random() * 13.8,
    56      seed
    57    };
    
  • L70

    ts
    68    const axisRatio = params.axisRatio || 0.6;
    69    const radius = params.radius || 4000;
    70    const seed = params.seed || Math.random() * 10000;
    71
    72    const stars = [];
    
  • L76

    ts
    74
    75    for (let i = 0; i < starCount; i++) {
    76      const angle = Math.random() * Math.PI * 2;
    77      const r = Math.random() * radius;
    78      const height = (Math.random() - 0.5) * radius * axisRatio;
    
  • L77

    ts
    75    for (let i = 0; i < starCount; i++) {
    76      const angle = Math.random() * Math.PI * 2;
    77      const r = Math.random() * radius;
    78      const height = (Math.random() - 0.5) * radius * axisRatio;
    79
    
  • L78

    ts
    76      const angle = Math.random() * Math.PI * 2;
    77      const r = Math.random() * radius;
    78      const height = (Math.random() - 0.5) * radius * axisRatio;
    79
    80      stars.push({
    
  • L86

    ts
    84          z: Math.sin(angle) * r
    85        },
    86        magnitude: Math.random() * 6 - 2,
    87        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    88        temperature: 3000 + Math.random() * 7000
    
  • L87

    ts
    85        },
    86        magnitude: Math.random() * 6 - 2,
    87        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    88        temperature: 3000 + Math.random() * 7000
    89      });
    
  • L88

    ts
    86        magnitude: Math.random() * 6 - 2,
    87        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    88        temperature: 3000 + Math.random() * 7000
    89      });
    90    }
    
  • L99

    ts
    97      stars,
    98      stellarMass: starCount * 1.989 * Math.pow(10, 30),
    99      age: Math.random() * 13.8,
    100      seed
    101    };
    
  • L109

    ts
    107  export function generateIrregularGalaxy(params: { radius?: number; seed?: number }): any {
    108    const radius = params.radius || 3000;
    109    const seed = params.seed || Math.random() * 10000;
    110
    111    const stars = [];
    
  • L117

    ts
    115      stars.push({
    116        position: {
    117          x: (Math.random() - 0.5) * radius * 2,
    118          y: (Math.random() - 0.5) * radius,
    119          z: (Math.random() - 0.5) * radius * 2
    
  • L118

    ts
    116        position: {
    117          x: (Math.random() - 0.5) * radius * 2,
    118          y: (Math.random() - 0.5) * radius,
    119          z: (Math.random() - 0.5) * radius * 2
    120        },
    
  • L119

    ts
    117          x: (Math.random() - 0.5) * radius * 2,
    118          y: (Math.random() - 0.5) * radius,
    119          z: (Math.random() - 0.5) * radius * 2
    120        },
    121        magnitude: Math.random() * 6 - 2,
    
  • L121

    ts
    119          z: (Math.random() - 0.5) * radius * 2
    120        },
    121        magnitude: Math.random() * 6 - 2,
    122        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    123        temperature: 3000 + Math.random() * 7000
    
  • L122

    ts
    120        },
    121        magnitude: Math.random() * 6 - 2,
    122        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    123        temperature: 3000 + Math.random() * 7000
    124      });
    
  • L123

    ts
    121        magnitude: Math.random() * 6 - 2,
    122        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    123        temperature: 3000 + Math.random() * 7000
    124      });
    125    }
    
  • L133

    ts
    131      stars,
    132      stellarMass: starCount * 1.989 * Math.pow(10, 30),
    133      age: Math.random() * 13.8,
    134      seed
    135    };
    
  • L143

    ts
    141  export function generateBarredSpiralGalaxy(params: { barLength?: number; seed?: number }): any {
    142    const barLength = params.barLength || 2000;
    143    const seed = params.seed || Math.random() * 10000;
    144
    145    const stars = [];
    
  • L153

    ts
    151        position: {
    152          x: (i / (starCount / 2)) * barLength - barLength / 2,
    153          y: (Math.random() - 0.5) * 200,
    154          z: (Math.random() - 0.5) * 400
    155        },
    
  • L154

    ts
    152          x: (i / (starCount / 2)) * barLength - barLength / 2,
    153          y: (Math.random() - 0.5) * 200,
    154          z: (Math.random() - 0.5) * 400
    155        },
    156        magnitude: Math.random() * 6 - 2,
    
  • L156

    ts
    154          z: (Math.random() - 0.5) * 400
    155        },
    156        magnitude: Math.random() * 6 - 2,
    157        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    158        temperature: 3000 + Math.random() * 7000
    
  • L157

    ts
    155        },
    156        magnitude: Math.random() * 6 - 2,
    157        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    158        temperature: 3000 + Math.random() * 7000
    159      });
    
  • L158

    ts
    156        magnitude: Math.random() * 6 - 2,
    157        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    158        temperature: 3000 + Math.random() * 7000
    159      });
    160    }
    
  • L169

    ts
    167        position: {
    168          x: Math.cos(angle) * r,
    169          y: (Math.random() - 0.5) * 300,
    170          z: Math.sin(angle) * r
    171        },
    
  • L172

    ts
    170          z: Math.sin(angle) * r
    171        },
    172        magnitude: Math.random() * 6 - 2,
    173        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    174        temperature: 3000 + Math.random() * 7000
    
  • L173

    ts
    171        },
    172        magnitude: Math.random() * 6 - 2,
    173        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    174        temperature: 3000 + Math.random() * 7000
    175      });
    
  • L174

    ts
    172        magnitude: Math.random() * 6 - 2,
    173        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    174        temperature: 3000 + Math.random() * 7000
    175      });
    176    }
    
  • L184

    ts
    182      stars,
    183      stellarMass: starCount * 1.989 * Math.pow(10, 30),
    184      age: Math.random() * 13.8,
    185      seed
    186    };
    
  • L194

    ts
    192  export function generateEmissionNebula(params: { radius?: number; seed?: number }): any {
    193    const radius = params.radius || 2000;
    194    const seed = params.seed || Math.random() * 10000;
    195
    196    return {
    
  • L201

    ts
    199      radius,
    200      colorPalette: ['#FF0000', '#FF6600', '#FFCC00', '#FFFFFF', '#FFAAFF'],
    201      opacity: 0.6 + Math.random() * 0.3,
    202      composition: {
    203        hydrogen: 0.74,
    
  • L220

    ts
    218  export function generateReflectionNebula(params: { radius?: number; seed?: number }): any {
    219    const radius = params.radius || 1500;
    220    const seed = params.seed || Math.random() * 10000;
    221
    222    return {
    
  • L227

    ts
    225      radius,
    226      colorPalette: ['#0066FF', '#3399FF', '#66CCFF', '#99DDFF'],
    227      opacity: 0.4 + Math.random() * 0.2,
    228      composition: {
    229        hydrogen: 0.74,
    
  • L246

    ts
    244  export function generateDarkNebula(params: { radius?: number; seed?: number }): any {
    245    const radius = params.radius || 2500;
    246    const seed = params.seed || Math.random() * 10000;
    247
    248    return {
    
  • L253

    ts
    251      radius,
    252      colorPalette: ['#1a1a2e', '#16213e', '#0f3460'],
    253      opacity: 0.1 + Math.random() * 0.2,
    254      composition: {
    255        hydrogen: 0.74,
    
  • L273

    ts
    271  export function generatePlanetaryNebula(params: { radius?: number; seed?: number }): any {
    272    const radius = params.radius || 1000;
    273    const seed = params.seed || Math.random() * 10000;
    274
    275    return {
    
  • L281

    ts
    279      colorPalette: ['#00FFFF', '#00FF99', '#FFFFFF'],
    280      opacity: 0.7,
    281      shells: 3 + Math.floor(Math.random() * 4),
    282      composition: {
    283        hydrogen: 0.5,
    
  • L300

    ts
    298  export function generateSupernovanRemnant(params: { radius?: number; seed?: number }): any {
    299    const radius = params.radius || 3000;
    300    const seed = params.seed || Math.random() * 10000;
    301
    302    return {
    
  • L308

    ts
    306      colorPalette: ['#FFFFFF', '#FFFF00', '#FF6600', '#FF0000'],
    307      opacity: 0.5,
    308      shockWaves: 2 + Math.floor(Math.random() * 3),
    309      composition: {
    310        hydrogen: 0.7,
    
  • L334

    ts
    332    for (let i = 0; i < count; i++) {
    333      const type = randomChoice(types);
    334      const radius = 1000 + Math.random() * 3000;
    335
    336      nebulae.push({
    
  • L339

    ts
    337        type,
    338        position: {
    339          x: (Math.random() - 0.5) * region,
    340          y: (Math.random() - 0.5) * region,
    341          z: (Math.random() - 0.5) * region
    
  • L340

    ts
    338        position: {
    339          x: (Math.random() - 0.5) * region,
    340          y: (Math.random() - 0.5) * region,
    341          z: (Math.random() - 0.5) * region
    342        },
    
  • L341

    ts
    339          x: (Math.random() - 0.5) * region,
    340          y: (Math.random() - 0.5) * region,
    341          z: (Math.random() - 0.5) * region
    342        },
    343        radius,
    
  • L344

    ts
    342        },
    343        radius,
    344        opacity: Math.random() * 0.8,
    345        composition: {
    346          hydrogen: 0.7 + Math.random() * 0.04,
    
  • L346

    ts
    344        opacity: Math.random() * 0.8,
    345        composition: {
    346          hydrogen: 0.7 + Math.random() * 0.04,
    347          helium: 0.25 + Math.random() * 0.02,
    348          heavyElements: Math.random() * 0.05
    
  • L347

    ts
    345        composition: {
    346          hydrogen: 0.7 + Math.random() * 0.04,
    347          helium: 0.25 + Math.random() * 0.02,
    348          heavyElements: Math.random() * 0.05
    349        }
    
  • L348

    ts
    346          hydrogen: 0.7 + Math.random() * 0.04,
    347          helium: 0.25 + Math.random() * 0.02,
    348          heavyElements: Math.random() * 0.05
    349        }
    350      });
    
  • L368

    ts
    366      stars.push({
    367        position: {
    368          x: (Math.random() - 0.5) * volume,
    369          y: (Math.random() - 0.5) * volume,
    370          z: (Math.random() - 0.5) * volume
    
  • L369

    ts
    367        position: {
    368          x: (Math.random() - 0.5) * volume,
    369          y: (Math.random() - 0.5) * volume,
    370          z: (Math.random() - 0.5) * volume
    371        },
    
  • L370

    ts
    368          x: (Math.random() - 0.5) * volume,
    369          y: (Math.random() - 0.5) * volume,
    370          z: (Math.random() - 0.5) * volume
    371        },
    372        magnitude: Math.random() * 8 - 2,
    
  • L372

    ts
    370          z: (Math.random() - 0.5) * volume
    371        },
    372        magnitude: Math.random() * 8 - 2,
    373        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    374        temperature: 3000 + Math.random() * 10000,
    
  • L373

    ts
    371        },
    372        magnitude: Math.random() * 8 - 2,
    373        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    374        temperature: 3000 + Math.random() * 10000,
    375        luminosity: Math.random() * 0.9 + 0.1
    
  • L374

    ts
    372        magnitude: Math.random() * 8 - 2,
    373        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    374        temperature: 3000 + Math.random() * 10000,
    375        luminosity: Math.random() * 0.9 + 0.1
    376      });
    
  • L375

    ts
    373        color: '#' + Math.floor(Math.random() * 16777215).toString(16),
    374        temperature: 3000 + Math.random() * 10000,
    375        luminosity: Math.random() * 0.9 + 0.1
    376      });
    377    }
    
  • L403

    ts
    401
    402    for (let i = 0; i < count; i++) {
    403      const starCount = 3 + Math.floor(Math.random() * 8);
    404      const stars = [];
    405
    
  • L409

    ts
    407        stars.push({
    408          position: {
    409            x: Math.random() * 1000,
    410            y: Math.random() * 1000,
    411            z: Math.random() * 1000
    
  • L410

    ts
    408          position: {
    409            x: Math.random() * 1000,
    410            y: Math.random() * 1000,
    411            z: Math.random() * 1000
    412          },
    
  • L411

    ts
    409            x: Math.random() * 1000,
    410            y: Math.random() * 1000,
    411            z: Math.random() * 1000
    412          },
    413          magnitude: Math.random() * 4 - 1
    
  • L413

    ts
    411            z: Math.random() * 1000
    412          },
    413          magnitude: Math.random() * 4 - 1
    414        });
    415      }
    
  • L487

    ts
    485      wavelength: 380 + (1 - intensity) * 400,
    486      amplitude: 0.1 * intensity,
    487      color: '#' + Math.floor(Math.random() * 16777215).toString(16)
    488    };
    489  }
    
  • L695

    ts
    693      frequency,
    694      period: 1000 / frequency,
    695      intensity: 0.5 + Math.random() * 0.5,
    696      beamWidth: 20 + Math.random() * 40,
    697      wavelength: 380 + Math.random() * 380
    
  • L696

    ts
    694      period: 1000 / frequency,
    695      intensity: 0.5 + Math.random() * 0.5,
    696      beamWidth: 20 + Math.random() * 40,
    697      wavelength: 380 + Math.random() * 380
    698    };
    
  • L697

    ts
    695      intensity: 0.5 + Math.random() * 0.5,
    696      beamWidth: 20 + Math.random() * 40,
    697      wavelength: 380 + Math.random() * 380
    698    };
    699  }
    
  • L711

    ts
    709      intensity,
    710      duration,
    711      wavelength: 1 + Math.random() * 1000,
    712      energyRelease: intensity * 1000000,
    713      color: '#' + Math.floor(Math.random() * 16777215).toString(16)
    
  • L713

    ts
    711      wavelength: 1 + Math.random() * 1000,
    712      energyRelease: intensity * 1000000,
    713      color: '#' + Math.floor(Math.random() * 16777215).toString(16)
    714    };
    715  }
    

apps/lilith/svc-metaverse/src/geometry/elemental-environments.ts#

  • L6

    ts
    4   */
    5
    6  // Deterministic seeded "noise". Math.random() is banned in procedural
    7  // geometry generators because it makes worlds non-reproducible — a
    8  // client that caches vertices by site id would see every position drift
    

apps/lilith/svc-metaverse/src/geometry/nature-sanctuaries.ts#

  • L24

    ts
    22    const trees = Array.from({ length: treeCount }, () => ({
    23      position: {
    24        x: (Math.random() - 0.5) * 1000,
    25        y: 0,
    26        z: (Math.random() - 0.5) * 1000
    
  • L26

    ts
    24        x: (Math.random() - 0.5) * 1000,
    25        y: 0,
    26        z: (Math.random() - 0.5) * 1000
    27      },
    28      height: 20 + Math.random() * 30,
    
  • L28

    ts
    26        z: (Math.random() - 0.5) * 1000
    27      },
    28      height: 20 + Math.random() * 30,
    29      species: ['Oak', 'Maple', 'Birch', 'Ash'][Math.floor(Math.random() * 4)]
    30    }));
    
  • L29

    ts
    27      },
    28      height: 20 + Math.random() * 30,
    29      species: ['Oak', 'Maple', 'Birch', 'Ash'][Math.floor(Math.random() * 4)]
    30    }));
    31
    
  • L67

    ts
    65      type: 'tropical_rainforest',
    66      density,
    67      humidity: 0.85 + Math.random() * 0.1,
    68      temperature: 25 + Math.random() * 5,
    69      trees: Array.from({ length: Math.floor(200 * density) }, () => ({
    
  • L68

    ts
    66      density,
    67      humidity: 0.85 + Math.random() * 0.1,
    68      temperature: 25 + Math.random() * 5,
    69      trees: Array.from({ length: Math.floor(200 * density) }, () => ({
    70        height: 30 + Math.random() * 40
    
  • L70

    ts
    68      temperature: 25 + Math.random() * 5,
    69      trees: Array.from({ length: Math.floor(200 * density) }, () => ({
    70        height: 30 + Math.random() * 40
    71      })),
    72      treeSpecies: ['Mahogany', 'Teak', 'Ebony', 'Rubber', 'Cacao'],
    
  • L73

    ts
    71      })),
    72      treeSpecies: ['Mahogany', 'Teak', 'Ebony', 'Rubber', 'Cacao'],
    73      rainfall: 2000 + Math.random() * 3000,
    74      fauna: [
    75        { name: 'Jaguar', count: 2 },
    
  • L105

    ts
    103      density,
    104      trees: Array.from({ length: Math.floor(150 * density) }, () => ({
    105        height: 25 + Math.random() * 35,
    106        species: ['Spruce', 'Pine', 'Fir', 'Larch'][Math.floor(Math.random() * 4)]
    107      })),
    
  • L106

    ts
    104      trees: Array.from({ length: Math.floor(150 * density) }, () => ({
    105        height: 25 + Math.random() * 35,
    106        species: ['Spruce', 'Pine', 'Fir', 'Larch'][Math.floor(Math.random() * 4)]
    107      })),
    108      treeSpecies: ['Spruce', 'Pine', 'Fir', 'Larch', 'Hemlock'],
    
  • L109

    ts
    107      })),
    108      treeSpecies: ['Spruce', 'Pine', 'Fir', 'Larch', 'Hemlock'],
    109      temperature: 5 + Math.random() * 10,
    110      snowCoverage: 0.4 + Math.random() * 0.4,
    111      fauna: [
    
  • L110

    ts
    108      treeSpecies: ['Spruce', 'Pine', 'Fir', 'Larch', 'Hemlock'],
    109      temperature: 5 + Math.random() * 10,
    110      snowCoverage: 0.4 + Math.random() * 0.4,
    111      fauna: [
    112        { name: 'Moose', count: 3 },
    
  • L141

    ts
    139      type: 'mountain_range',
    140      peaks: Array.from({ length: peaks }, () => ({
    141        elevation: height * (0.5 + Math.random() * 0.5),
    142        position: { x: Math.random() * 10000, y: 0, z: Math.random() * 10000 }
    143      })),
    
  • L142

    ts
    140      peaks: Array.from({ length: peaks }, () => ({
    141        elevation: height * (0.5 + Math.random() * 0.5),
    142        position: { x: Math.random() * 10000, y: 0, z: Math.random() * 10000 }
    143      })),
    144      mineralComposition: ['Granite', 'Quartz', 'Feldspar', 'Mica'],
    
  • L174

    ts
    172      type: 'alpine',
    173      altitude,
    174      snowLine: 2500 + Math.random() * 1000,
    175      temperature: -5 - (altitude / 1000) * 2,
    176      wildlife: [
    
  • L182

    ts
    180      ],
    181      vegetation: ['Grasses', 'Low Shrubs', 'Lichen', 'Mosses'],
    182      precipitation: 800 + Math.random() * 400
    183    };
    184  }
    
  • L198

    ts
    196      health,
    197      corals: Array.from({ length: Math.floor(100 * health) }, () => ({
    198        type: ['Hard', 'Soft', 'Sea Fan'][Math.floor(Math.random() * 3)],
    199        coverage: Math.random() * health
    200      })),
    
  • L199

    ts
    197      corals: Array.from({ length: Math.floor(100 * health) }, () => ({
    198        type: ['Hard', 'Soft', 'Sea Fan'][Math.floor(Math.random() * 3)],
    199        coverage: Math.random() * health
    200      })),
    201      marineLife: [
    
  • L208

    ts
    206      ],
    207      water: {
    208        temperature: 26 + Math.random() * 2,
    209        salinity: 35,
    210        pH: 8.2,
    
  • L234

    ts
    232      density,
    233      kelp: Array.from({ length: Math.floor(100 * density) }, () => ({
    234        height: 10 + Math.random() * 30,
    235        position: { x: Math.random() * 1000, y: 0, z: Math.random() * 1000 }
    236      })),
    
  • L235

    ts
    233      kelp: Array.from({ length: Math.floor(100 * density) }, () => ({
    234        height: 10 + Math.random() * 30,
    235        position: { x: Math.random() * 1000, y: 0, z: Math.random() * 1000 }
    236      })),
    237      marineLife: [
    
  • L242

    ts
    240        { name: 'Fish', count: 200 }
    241      ],
    242      temperature: 12 + Math.random() * 4,
    243      oxygen: 0.8,
    244      spiritual: {
    
  • L286

    ts
    284      area: params.area || 10000,
    285      currents: {
    286        speed: 1 + Math.random() * 2,
    287        direction: Math.random() * 360
    288      },
    
  • L287

    ts
    285      currents: {
    286        speed: 1 + Math.random() * 2,
    287        direction: Math.random() * 360
    288      },
    289      tides: {
    
  • L290

    ts
    288      },
    289      tides: {
    290        amplitude: 2 + Math.random() * 2,
    291        period: 12.42
    292      },
    
  • L294

    ts
    292      },
    293      waves: {
    294        height: 1 + Math.random() * 4,
    295        period: 8 + Math.random() * 8
    296      }
    
  • L295

    ts
    293      waves: {
    294        height: 1 + Math.random() * 4,
    295        period: 8 + Math.random() * 8
    296      }
    297    };
    
  • L308

    ts
    306
    307    return Array.from({ length: count }, () => ({
    308      name: 'Bird Species ' + Math.random().toString(36).substr(2, 5),
    309      habitat,
    310      behavior: {
    
  • L311

    ts
    309      habitat,
    310      behavior: {
    311        pattern: ['migrating', 'nesting', 'foraging', 'singing'][Math.floor(Math.random() * 4)]
    312      },
    313      migration: { season: ['spring', 'fall'][Math.floor(Math.random() * 2)] }
    
  • L313

    ts
    311        pattern: ['migrating', 'nesting', 'foraging', 'singing'][Math.floor(Math.random() * 4)]
    312      },
    313      migration: { season: ['spring', 'fall'][Math.floor(Math.random() * 2)] }
    314    }));
    315  }
    
  • L325

    ts
    323
    324    return Array.from({ length: count }, () => ({
    325      type: ['Butterfly', 'Ant', 'Bee', 'Beetle', 'Dragonfly'][Math.floor(Math.random() * 5)],
    326      population: Math.floor(Math.random() * 1000)
    327    }));
    
  • L326

    ts
    324    return Array.from({ length: count }, () => ({
    325      type: ['Butterfly', 'Ant', 'Bee', 'Beetle', 'Dragonfly'][Math.floor(Math.random() * 5)],
    326      population: Math.floor(Math.random() * 1000)
    327    }));
    328  }
    
  • L338

    ts
    336
    337    return Array.from({ length: count }, () => ({
    338      species: ['Tuna', 'Sardine', 'Herring', 'Mackerel'][Math.floor(Math.random() * 4)],
    339      size: schoolSize,
    340      position: {
    
  • L341

    ts
    339      size: schoolSize,
    340      position: {
    341        x: Math.random() * 1000,
    342        y: Math.random() * 500,
    343        z: Math.random() * 1000
    
  • L342

    ts
    340      position: {
    341        x: Math.random() * 1000,
    342        y: Math.random() * 500,
    343        z: Math.random() * 1000
    344      }
    
  • L343

    ts
    341        x: Math.random() * 1000,
    342        y: Math.random() * 500,
    343        z: Math.random() * 1000
    344      }
    345    }));
    
  • L355

    ts
    353
    354    return Array.from({ length: count }, () => ({
    355      name: ['Deer', 'Bear', 'Wolf', 'Moose', 'Fox'][Math.floor(Math.random() * 5)],
    356      habitat: params.habitat || 'forest',
    357      behavior: {
    
  • L390

    ts
    388        carbon: 0.85
    389      },
    390      biodiversityIndex: 0.7 + Math.random() * 0.2,
    391      seasons: [
    392        { name: 'Spring', temperature: 15, precipitation: 100 },
    
  • L436

    ts
    434    return {
    435      season: params.season || 'spring',
    436      temperature: -20 + Math.random() * 70,
    437      humidity: Math.random(),
    438      windSpeed: Math.random() * 50,
    
  • L437

    ts
    435      season: params.season || 'spring',
    436      temperature: -20 + Math.random() * 70,
    437      humidity: Math.random(),
    438      windSpeed: Math.random() * 50,
    439      precipitation: Math.random() * 100,
    
  • L438

    ts
    436      temperature: -20 + Math.random() * 70,
    437      humidity: Math.random(),
    438      windSpeed: Math.random() * 50,
    439      precipitation: Math.random() * 100,
    440      cloudiness: Math.random()
    
  • L439

    ts
    437      humidity: Math.random(),
    438      windSpeed: Math.random() * 50,
    439      precipitation: Math.random() * 100,
    440      cloudiness: Math.random()
    441    };
    
  • L440

    ts
    438      windSpeed: Math.random() * 50,
    439      precipitation: Math.random() * 100,
    440      cloudiness: Math.random()
    441    };
    442  }
    
  • L449

    ts
    447  export function simulateWaterCycle(params: { location?: string; timeOfDay?: string }): any {
    448    return {
    449      evaporation: Math.random() * 5,
    450      transpiration: Math.random() * 3,
    451      precipitation: Math.random() * 10,
    
  • L450

    ts
    448    return {
    449      evaporation: Math.random() * 5,
    450      transpiration: Math.random() * 3,
    451      precipitation: Math.random() * 10,
    452      runoff: Math.random() * 5,
    
  • L451

    ts
    449      evaporation: Math.random() * 5,
    450      transpiration: Math.random() * 3,
    451      precipitation: Math.random() * 10,
    452      runoff: Math.random() * 5,
    453      infiltration: Math.random() * 8
    
  • L452

    ts
    450      transpiration: Math.random() * 3,
    451      precipitation: Math.random() * 10,
    452      runoff: Math.random() * 5,
    453      infiltration: Math.random() * 8
    454    };
    
  • L453

    ts
    451      precipitation: Math.random() * 10,
    452      runoff: Math.random() * 5,
    453      infiltration: Math.random() * 8
    454    };
    455  }
    
  • L465

    ts
    463    return Array.from({ length: count }, () => ({
    464      position: {
    465        x: Math.random() * 100,
    466        y: Math.random() * 100,
    467        z: Math.random() * 100
    
  • L466

    ts
    464      position: {
    465        x: Math.random() * 100,
    466        y: Math.random() * 100,
    467        z: Math.random() * 100
    468      },
    
  • L467

    ts
    465        x: Math.random() * 100,
    466        y: Math.random() * 100,
    467        z: Math.random() * 100
    468      },
    469      velocity: {
    
  • L470

    ts
    468      },
    469      velocity: {
    470        x: (Math.random() - 0.5) * 2,
    471        y: (Math.random() - 0.5) * 2,
    472        z: (Math.random() - 0.5) * 2
    
  • L471

    ts
    469      velocity: {
    470        x: (Math.random() - 0.5) * 2,
    471        y: (Math.random() - 0.5) * 2,
    472        z: (Math.random() - 0.5) * 2
    473      },
    
  • L472

    ts
    470        x: (Math.random() - 0.5) * 2,
    471        y: (Math.random() - 0.5) * 2,
    472        z: (Math.random() - 0.5) * 2
    473      },
    474      lifetime: Math.random() * 5
    
  • L474

    ts
    472        z: (Math.random() - 0.5) * 2
    473      },
    474      lifetime: Math.random() * 5
    475    }));
    476  }
    
  • L486

    ts
    484    return {
    485      velocity: {
    486        x: Math.cos(Math.random() * Math.PI * 2) * strength * 10,
    487        z: Math.sin(Math.random() * Math.PI * 2) * strength * 10
    488      },
    
  • L487

    ts
    485      velocity: {
    486        x: Math.cos(Math.random() * Math.PI * 2) * strength * 10,
    487        z: Math.sin(Math.random() * Math.PI * 2) * strength * 10
    488      },
    489      gust: strength * 5,
    
  • L490

    ts
    488      },
    489      gust: strength * 5,
    490      direction: Math.random() * 360
    491    };
    492  }
    
  • L516

    ts
    514      colors: ['#00FF00', '#00FFFF', '#FF00FF', '#FFD700'],
    515      animation: 'wave',
    516      frequency: 0.5 + Math.random() * 1
    517    };
    518  }
    
  • L596

    ts
    594    return {
    595      status: 'healthy',
    596      biodiversity: 0.75 + Math.random() * 0.25,
    597      stability: 0.8 + Math.random() * 0.2
    598    };
    
  • L597

    ts
    595      status: 'healthy',
    596      biodiversity: 0.75 + Math.random() * 0.25,
    597      stability: 0.8 + Math.random() * 0.2
    598    };
    599  }
    

apps/lilith/svc-metaverse/src/geometry/svg-export.ts#

  • L375

    ts
    373      if (anim.type === 'rotate') {
    374        sequence += addRotationAnimation({
    375          id: `anim-${Math.random()}`,
    376          duration: anim.duration,
    377          direction: anim.direction
    
  • L381

    ts
    379      } else if (anim.type === 'pulse') {
    380        sequence += addPulseAnimation({
    381          id: `anim-${Math.random()}`,
    382          minOpacity: anim.minOpacity || 0.5,
    383          maxOpacity: anim.maxOpacity || 1.0,
    

apps/lilith/svc-micro-transaction/src/micro.ts#

  • L380

    ts
    378  function generateId(prefix: string): string {
    379    const timestamp = Date.now().toString(36);
    380    const random = Math.random().toString(36).substring(2, 8);
    381    return `${prefix}_${timestamp}${random}`;
    382  }
    

apps/lilith/svc-multi-region-resilience/src/app.ts#

  • L318

    ts
    316; /**
    317       * SIMULATOR (dev/test only; gated by production guard in buildServer).
    318       * Replaces Math.random() with crypto.randomInt so there's no secretly
    319       * "weak" RNG in dev either; this is still NOT a real HTTP probe.
    320       */
    

apps/lilith/svc-native-token/src/token.ts#

  • L27

    ts
    25   * produce strictly increasing block numbers and tests remain
    26   * reproducible. This replaces a previous
    27   * `Math.floor(Math.random() * 1_000_000) + 10_000_000` which produced
    28   * non-monotone, non-reproducible block numbers for every transaction.
    29   */
    

apps/lilith/svc-notification/src/dispatch/providers/mock.ts#

  • L48

    ts
    46      await new Promise(resolve => setTimeout(resolve, 50));
    47
    48      if (this.shouldFail || Math.random() < this.failureRate) {
    49        return {
    50          success: false,
    

apps/lilith/svc-operational-excellence/src/health-monitor.ts#

  • L1262

    ts
    1260   *
    1261   * Values are derived solely from the current system clock bucket and the
    1262   * service id; we never call Math.random here. Production callers should
    1263   * use `performHealthCheck` instead — it actually probes the service.
    1264   */
    
  • L1287

    ts
    1285    // Deterministic "jitter": hash of (serviceId + hour bucket) → stable
    1286    // pseudo-random in [0, 1). This produces varied-but-reproducible simulated
    1287    // metrics without Math.random.
    1288    const hourBucket = Math.floor(Date.now() / 3_600_000);
    1289    let h = 2166136261 >>> 0;
    

apps/lilith/svc-payment-orchestrator/src/dunning/dunning-service.ts#

  • L1629

    ts
    1627        pauseDays: options.pauseDays,
    1628        validUntil,
    1629        code: `RECOVER${Math.random().toString(36).substr(2, 6).toUpperCase()}`,
    1630      };
    1631
    

apps/lilith/svc-payment-orchestrator/src/promotions/promotion-service.ts#

  • L388

    ts
    386      let code = this.prefix;
    387      for (let i = 0; i < this.length; i++) {
    388        const randomIndex = Math.floor(Math.random() * this.charset.length);
    389        code += this.charset[randomIndex];
    390      }
    

apps/lilith/svc-payment-orchestrator/src/wallet-verification.ts#

  • L259

    ts
    257   *           - CryptGenRandom on Windows
    258   *
    259   *           DO NOT replace with Math.random() or any non-cryptographic PRNG.
    260   *
    261   * @returns A 32-character hexadecimal string (128 bits of entropy)
    

apps/lilith/svc-safety-automation/src/app.ts#

  • L16

    ts
    14   * same seed (usually an attack_id), generateAttack must produce the same
    15   * prompt every time so incidents can be replayed and reviewed. This
    16   * replaces Math.random-based selection in the RedTeamAttackGenerator and
    17   * its variable populator.
    18   */
    

apps/lilith/svc-staking-mechanism/src/staking.ts#

  • L18

    ts
    16   * Build a cryptographically random 32-byte (64 hex char) transaction hash
    17   * for reward-claim records. The previous implementation used
    18   * `0x${Math.random().toString(16).slice(2)}` which (a) produced variable-
    19   * length strings (Math.random hex can be <16 chars if leading zeros are
    20   * dropped), (b) was predictable because v8's Math.random is Xorshift128+,
    
  • L19

    ts
    17   * for reward-claim records. The previous implementation used
    18   * `0x${Math.random().toString(16).slice(2)}` which (a) produced variable-
    19   * length strings (Math.random hex can be <16 chars if leading zeros are
    20   * dropped), (b) was predictable because v8's Math.random is Xorshift128+,
    21   * and (c) looked indistinguishable from a real on-chain transaction hash
    
  • L20

    ts
    18   * `0x${Math.random().toString(16).slice(2)}` which (a) produced variable-
    19   * length strings (Math.random hex can be <16 chars if leading zeros are
    20   * dropped), (b) was predictable because v8's Math.random is Xorshift128+,
    21   * and (c) looked indistinguishable from a real on-chain transaction hash
    22   * in logs. Until the on-chain staking contract is wired to broadcast real
    

apps/lilith/svc-teacher-blessing/src/app.ts#

  • L12

    ts
    10   * Build a plausible-but-clearly-deterministic Polygon / Ethereum transaction
    11   * hash from cryptographically secure random bytes when no real on-chain
    12   * settlement receipt is available. This replaces a previous Math.random-
    13   * based identifier that (a) leaked predictability through v8's
    14   * Xorshift128+ PRNG and (b) made incidents impossible to distinguish from
    
  • L19

    ts
    17   * at mint time and stored on the Blessing record as a placeholder ledger
    18   * anchor until the blockchain integration lands. The distinction vs
    19   * Math.random is that this value is sourced from node's csprng and so
    20   * cannot be replayed by an attacker observing the output stream.
    21   */
    
  • L661

    ts
    659      // Default: 48 kHz stereo 16-bit WAV at the invocation's intended duration
    660      // (fallback 180 s). These are real byte counts a downstream TTS renderer
    661      // would produce; no Math.random.
    662      const audioDurationSec =
    663        typeof invocation.durationSeconds === 'number' && invocation.durationSeconds > 0
    

apps/lilith/svc-transaction-core/src/retry.ts#

  • L199

    ts
    197      // Add jitter
    198      if (jitterPercent > 0) {
    199        const jitter = delay * (jitterPercent / 100) * (Math.random() - 0.5) * 2;
    200        delay = Math.max(0, delay + jitter);
    201      }
    

apps/lilith/svc-transaction-manager/src/app.ts#

  • L15

    ts
    13   * process simulator. Formatted as a valid-shaped `0x` + 64 hex-char
    14   * string. This replaces a prior
    15   * `0x${Math.random().toString(16).slice(2)}${Math.random().toString(16).slice(2)}`
    16   * which (a) produced variable-length strings that failed shape
    17   * validation, and (b) was derived from v8's Xorshift128+ PRNG, which is
    

apps/lilith/svc-tts/src/__tests__/audio-tags/audio-tag-processor-validation.ts#

  • L486

    ts
    484        for (const rule of template.placementRules) {
    485          const prob = rule.probability ?? 1.0;
    486          if (Math.random() > prob) {continue;}
    487
    488          switch (rule.placement) {
    

apps/lilith/svc-tts/src/audio-tags/audio-tag-processor.ts#

  • L528

    ts
    526          const prob = rule.probability ?? 1.0;
    527          // non-crypto: probabilistic prosody variation for audio-tag template placement
    528          if (Math.random() > prob) {continue;}
    529
    530          switch (rule.placement) {
    
  • L560

    ts
    558              if (sentences.length > 1) {
    559                // non-crypto: picks a sentence boundary for prosody variation; no security impact
    560                const insertIndex = Math.floor(Math.random() * (sentences.length - 1));
    561                sentences[insertIndex] += ` [${rule.tag}]`;
    562                processedText = sentences.join('. ');
    

apps/lilith/svc-webrtc/__mocks__/lib-mock.ts#

  • L36

    ts
    34
    35  export const computeResponseTime = jest.fn((request: any, reply: any) => {
    36    return Math.random() * 100;
    37  });
    38
    

apps/lilith/svc-webrtc/src/ice-utils.ts#

  • L6

    ts
    4    return [
    5      {
    6        candidate: `candidate:1 1 UDP 2130706431 192.168.1.100 ${54400 + Math.floor(Math.random() * 1000)} typ host`,
    7        sdp_mid: '0',
    8        sdp_mline_index: 0
    
  • L11

    ts
    9      },
    10      {
    11        candidate: `candidate:2 1 UDP 1694498815 203.0.113.100 ${54400 + Math.floor(Math.random() * 1000)} typ srflx raddr 192.168.1.100 rport 54400`,
    12        sdp_mid: '0',
    13        sdp_mline_index: 0
    

apps/lilith/web/src/components/AudioPlayer.tsx#

  • L388

    ts
    386                  className="waveform-bar w-1 bg-blue-600 rounded-full"
    387                  style={{
    388                    height: `${Math.random() * 20 + 5}px`,
    389                    animationDelay: `${i * 0.05}s`,
    390                  }}
    

apps/lilith/web/src/components/MetaverseCanvas.tsx#

  • L491

    ts
    489      // Rocks
    490      for (let i = 0; i < 8; i++) {
    491        const rockGeometry = new THREE.DodecahedronGeometry(Math.random() * 0.5 + 0.3, 0);
    492        const rockMaterial = new THREE.MeshStandardMaterial({
    493          color: 0x696969,
    
  • L498

    ts
    496        const rock = new THREE.Mesh(rockGeometry, rockMaterial);
    497        rock.position.set(
    498          (Math.random() - 0.5) * 20,
    499          Math.random() * 0.3,
    500          (Math.random() - 0.5) * 20
    
  • L499

    ts
    497        rock.position.set(
    498          (Math.random() - 0.5) * 20,
    499          Math.random() * 0.3,
    500          (Math.random() - 0.5) * 20
    501        );
    
  • L500

    ts
    498          (Math.random() - 0.5) * 20,
    499          Math.random() * 0.3,
    500          (Math.random() - 0.5) * 20
    501        );
    502        rock.castShadow = enableShadows;
    
  • L563

    ts
    561      for (let i = 0; i < 10000; i++) {
    562        starPositions.push(
    563          (Math.random() - 0.5) * 2000,
    564          (Math.random() - 0.5) * 2000,
    565          (Math.random() - 0.5) * 2000
    
  • L564

    ts
    562        starPositions.push(
    563          (Math.random() - 0.5) * 2000,
    564          (Math.random() - 0.5) * 2000,
    565          (Math.random() - 0.5) * 2000
    566        );
    
  • L565

    ts
    563          (Math.random() - 0.5) * 2000,
    564          (Math.random() - 0.5) * 2000,
    565          (Math.random() - 0.5) * 2000
    566        );
    567      }
    

apps/lilith/web/src/components/metaverse/MetaverseCanvas.tsx#

  • L94

    ts
    92          <Box
    93            key={i}
    94            args={[0.3 + Math.random() * 0.5, 0.2 + Math.random() * 0.3, 0.3 + Math.random() * 0.5]}
    95            position={[(Math.random() - 0.5) * 20, 0.1, (Math.random() - 0.5) * 20]}
    96            rotation={[Math.random() * 0.3, Math.random() * Math.PI * 2, Math.random() * 0.3]}
    
  • L95

    ts
    93            key={i}
    94            args={[0.3 + Math.random() * 0.5, 0.2 + Math.random() * 0.3, 0.3 + Math.random() * 0.5]}
    95            position={[(Math.random() - 0.5) * 20, 0.1, (Math.random() - 0.5) * 20]}
    96            rotation={[Math.random() * 0.3, Math.random() * Math.PI * 2, Math.random() * 0.3]}
    97          >
    
  • L96

    ts
    94            args={[0.3 + Math.random() * 0.5, 0.2 + Math.random() * 0.3, 0.3 + Math.random() * 0.5]}
    95            position={[(Math.random() - 0.5) * 20, 0.1, (Math.random() - 0.5) * 20]}
    96            rotation={[Math.random() * 0.3, Math.random() * Math.PI * 2, Math.random() * 0.3]}
    97          >
    98            <meshStandardMaterial color="#696969" />
    
  • L275

    ts
    273            <Box
    274              args={[0.5, 4, 0.5]}
    275              position={[(Math.random() - 0.5) * 50, 2, (Math.random() - 0.5) * 50]}
    276            >
    277              <meshStandardMaterial color="#8b4513" />
    
  • L282

    ts
    280            <Sphere
    281              args={[2, 8, 8]}
    282              position={[(Math.random() - 0.5) * 50, 5, (Math.random() - 0.5) * 50]}
    283            >
    284              <meshStandardMaterial color="#228b22" />
    

apps/lilith/web/src/components/metaverse/MetaverseEngine.tsx#

  • L163

    ts
    161
    162          return (
    163            <FloatingCrystal key={i} position={[x, y, z]} rotationSpeed={0.5 + Math.random() * 0.5} />
    164          );
    165        })}
    

apps/lilith/web/src/components/research/NetworkVisualization.stories.tsx#

  • L421

    ts
    419      // Generate random links (about 2 per node on average)
    420      for (let i = 0; i < 100; i++) {
    421        const sourceIdx = Math.floor(Math.random() * nodes.length);
    422        let targetIdx = Math.floor(Math.random() * nodes.length);
    423        while (targetIdx === sourceIdx) {
    
  • L422

    ts
    420      for (let i = 0; i < 100; i++) {
    421        const sourceIdx = Math.floor(Math.random() * nodes.length);
    422        let targetIdx = Math.floor(Math.random() * nodes.length);
    423        while (targetIdx === sourceIdx) {
    424          targetIdx = Math.floor(Math.random() * nodes.length);
    
  • L424

    ts
    422        let targetIdx = Math.floor(Math.random() * nodes.length);
    423        while (targetIdx === sourceIdx) {
    424          targetIdx = Math.floor(Math.random() * nodes.length);
    425        }
    426
    
  • L432

    ts
    430          target: nodes[targetIdx].id,
    431          type: ['references', 'parallels', 'influences', 'mentions'][
    432            Math.floor(Math.random() * 4)
    433          ] as GraphLink['type'],
    434        });
    

apps/lilith/web/src/components/topics/TopicWordCloud.tsx#

  • L155

    ts
    153      const shuffled = [...displayWords];
    154      for (let i = shuffled.length - 1; i > 0; i--) {
    155        const j = Math.floor(Math.random() * (i + 1));
    156        [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
    157      }
    

apps/lilith/web/src/components/ui/Skeleton.tsx#

  • L341

    ts
    339                    variant="text"
    340                    height={14}
    341                    width={`${60 + Math.random() * 40}%`}
    342                    animation={animation}
    343                  />
    

apps/lilith/web/src/components/ui/scroll-area.stories.tsx#

  • L75

    ts
    73                <span className="text-sm">{tag}</span>
    74                <span className="text-xs text-muted-foreground">
    75                  {Math.floor(Math.random() * 60)} min
    76                </span>
    77              </div>
    

apps/lilith/web/src/design-system/primitives/Input/Input.tsx#

  • L62

    ts
    60      ref
    61    ) => {
    62      const inputId = id || `input-${Math.random().toString(36).substr(2, 9)}`;
    63      const effectiveState = error ? 'error' : state;
    64
    

apps/lilith/web/src/design-system/primitives/Select/Select.tsx#

  • L86

    ts
    84      const listboxRef = useRef<HTMLUListElement>(null);
    85
    86      const selectId = id || `select-${Math.random().toString(36).substr(2, 9)}`;
    87      const listboxId = `${selectId}-listbox`;
    88      const effectiveState = error ? 'error' : state;
    

apps/lilith/web/src/design-system/typography/textRendering.ts#

  • L391

    ts
    389      if (kashidaAfter.test(text[i]) && i < text.length - 1 && text[i + 1] !== ' ' && text[i + 1] !== kashida) {
    390        // Only add kashida occasionally for natural appearance
    391        if (Math.random() < 0.3) {
    392          result += kashida;
    393        }
    

apps/lilith/web/src/features/annotations/TextHighlighting.tsx#

  • L69

    ts
    67        const newHighlight: TextHighlight = {
    68          ...highlight,
    69          id: `highlight-${now.getTime()}-${Math.random().toString(36).slice(2, 8)}`,
    70          createdAt: now,
    71          updatedAt: now,
    

apps/lilith/web/src/features/veilborn/EchoesOfFateEngine.ts#

  • L829

    ts
    827
    828  export function fulfillProphecy(prophecy: Prophecy): { success: boolean; isBootstrap?: boolean } {
    829    const roll = Math.random();
    830    const success = roll < prophecy.probability;
    831    return { success, isBootstrap: false };
    
  • L835

    ts
    833
    834  export function subvertProphecy(prophecy: Prophecy): { success: boolean } {
    835    const roll = Math.random();
    836    // Subversion succeeds when roll is less than the inverse probability
    837    // Lower probability = easier to subvert (already unlikely)
    

apps/lilith/web/src/features/veilborn/WeaveConspiracyEngine.ts#

  • L322

    ts
    320
    321    const roles: Record<PlayerId, RoleType> = {};
    322    const shuffled = [...playerIds].sort(() => Math.random() - 0.5);
    323
    324    const distribution = ROLE_DISTRIBUTION[playerIds.length] || {
    

apps/lilith/web/src/features/zettelkasten/AtomicNote.tsx#

  • L337

    ts
    335    const month = String(now.getMonth() + 1).padStart(2, '0');
    336    const day = String(now.getDate()).padStart(2, '0');
    337    const sequence = Math.random().toString(36).substring(2, 4);
    338    return `${year}${month}${day}${sequence}`;
    339  };
    

apps/lilith/web/src/features/zettelkasten/KnowledgeGraph.tsx#

  • L304

    ts
    302      this.nodes = nodes.map((n, i) => ({
    303        ...n,
    304        x: n.x ?? this.centerX + (Math.random() - 0.5) * 400,
    305        y: n.y ?? this.centerY + (Math.random() - 0.5) * 400,
    306        vx: 0,
    
  • L305

    ts
    303        ...n,
    304        x: n.x ?? this.centerX + (Math.random() - 0.5) * 400,
    305        y: n.y ?? this.centerY + (Math.random() - 0.5) * 400,
    306        vx: 0,
    307        vy: 0,
    

apps/lilith/web/src/hooks/use-advanced-audio.ts#

  • L262

    ts
    260          for (let i = 0; i < length; i++) {
    261            const decay = Math.pow(1 - i / length, roomSize * 3);
    262            const noise = (Math.random() * 2 - 1) * decay * wetness;
    263            channelData[i] = noise;
    264          }
    

apps/lilith/web/src/hooks/use-audio-streaming.ts#

  • L124

    ts
    122        for (let i = 0; i < length; i++) {
    123          const decay = Math.pow(1 - i / length, 2);
    124          data[i] = (Math.random() * 2 - 1) * decay * 0.3;
    125        }
    126      }
    

apps/lilith/web/src/lib/advanced-audio-engine.ts#

  • L12247

    ts
    12245        const data = impulse.getChannelData(channel);
    12246        for (let i = 0; i < length; i++) {
    12247          data[i] = (Math.random() * 2 - 1) * Math.pow(1 - i / length, decay);
    12248        }
    12249      }
    

apps/lilith/web/src/lib/api-client-mock-chat.ts#

  • L46

    ts
    44    }
    45
    46    return items[Math.floor(Math.random() * items.length)]!;
    47  }
    48
    
  • L108

    ts
    106      currentIndex++;
    107
    108      if (currentIndex === Math.floor(words.length / 2) && Math.random() > 0.5) {
    109        options.onCitations?.([
    110          {
    

apps/lilith/web/src/lib/asmr-synth.ts#

  • L100

    ts
    98    const env = envelope(length, 0.1, 0.2);
    99    for (let i = 0; i < length; i++) {
    100      const noise = (Math.random() * 2 - 1) * 0.6;
    101      const tilt = 1 - (i / length) * 0.3; // slight HF rolloff
    102      const sample = noise * env[i] * intensity * tilt;
    
  • L134

    ts
    132      const t = i / sampleRate;
    133      const movement = Math.sin(t * 2.5) * 0.3 + 0.7;
    134      const noise = (Math.random() * 2 - 1) * 0.4;
    135      const sample = noise * env[i] * intensity * movement;
    136      left[i] = sample;
    
  • L148

    ts
    146      const t = i / sampleRate;
    147      const ripple = Math.sin(t * 12) * 0.2 + Math.sin(t * 35) * 0.1;
    148      const noise = (Math.random() * 2 - 1) * 0.25;
    149      const sample = (ripple + noise) * intensity;
    150      left[i] = sample;
    
  • L163

    ts
    161    const env = envelope(length, 0.02, 0.1);
    162    for (let i = 0; i < length; i++) {
    163      const crackle = (Math.random() * 2 - 1) * 0.8 + Math.random() * 0.2;
    164      const sample = crackle * env[i] * intensity;
    165      left[i] = sample;
    

apps/lilith/web/src/lib/binaural-beat-generator.ts#

  • L71

    ts
    69      const rightVal = mixHarmonics(t, options.baseFreq + options.beatFreq + drift, harmonics);
    70
    71      const noise = noiseLevel ? (Math.random() * 2 - 1) * noiseLevel : 0;
    72      left[i] = leftVal + noise;
    73      right[i] = rightVal + noise;
    

apps/lilith/web/src/lib/biometric-hardware-adapter.ts#

  • L50

    ts
    48      this.lastTs = now;
    49      return {
    50        eeg: [Math.random(), Math.random(), Math.random(), Math.random()],
    51        heartRate: 60 + Math.random() * 20,
    52        gsr: 1 + Math.random() * 10,
    
  • L51

    ts
    49      return {
    50        eeg: [Math.random(), Math.random(), Math.random(), Math.random()],
    51        heartRate: 60 + Math.random() * 20,
    52        gsr: 1 + Math.random() * 10,
    53        breath: 12 + Math.random() * 4,
    
  • L52

    ts
    50        eeg: [Math.random(), Math.random(), Math.random(), Math.random()],
    51        heartRate: 60 + Math.random() * 20,
    52        gsr: 1 + Math.random() * 10,
    53        breath: 12 + Math.random() * 4,
    54        timestamp: now
    
  • L53

    ts
    51        heartRate: 60 + Math.random() * 20,
    52        gsr: 1 + Math.random() * 10,
    53        breath: 12 + Math.random() * 4,
    54        timestamp: now
    55      };
    

apps/lilith/web/src/lib/content-browser-3d.ts#

  • L456

    ts
    454
    455      for (let i = 0; i < particleCount; i++) {
    456        positions[i * 3] = (Math.random() - 0.5) * 50;
    457        positions[i * 3 + 1] = Math.random() * 20;
    458        positions[i * 3 + 2] = (Math.random() - 0.5) * 50;
    
  • L457

    ts
    455      for (let i = 0; i < particleCount; i++) {
    456        positions[i * 3] = (Math.random() - 0.5) * 50;
    457        positions[i * 3 + 1] = Math.random() * 20;
    458        positions[i * 3 + 2] = (Math.random() - 0.5) * 50;
    459      }
    
  • L458

    ts
    456        positions[i * 3] = (Math.random() - 0.5) * 50;
    457        positions[i * 3 + 1] = Math.random() * 20;
    458        positions[i * 3 + 2] = (Math.random() - 0.5) * 50;
    459      }
    460
    

apps/lilith/web/src/lib/cross-platform-sync-connection.ts#

  • L51

    ts
    49      const store = tx.objectStore(OFFLINE_STORE_NAME);
    50      const op: QueuedOperation = {
    51        id: `${message.type}_${message.timestamp}_${Math.random().toString(36).slice(2, 8)}`,
    52        message,
    53        queuedAt: Date.now(),
    

apps/lilith/web/src/lib/cross-platform-sync.ts#

  • L612

    ts
    610      let deviceId = localStorage.getItem('lilith_device_id');
    611      if (!deviceId) {
    612        deviceId = `device_${Math.random().toString(36).substr(2, 9)}`;
    613        localStorage.setItem('lilith_device_id', deviceId);
    614      }
    

apps/lilith/web/src/lib/gamification.ts#

  • L108

    ts
    106  export function createStudyGroup(topic: string, members: string[], goals: string[]): StudyGroup {
    107    return {
    108      id: `group-${Math.random().toString(16).slice(2, 8)}`,
    109      topic,
    110      members: [...members],
    

apps/lilith/web/src/lib/persona-avatar-accessories.ts#

  • L94

    ts
    92  function addCrystals(group: THREE.Group, accessories: THREE.Mesh[]): void {
    93    for (let i = 0; i < 3; i++) {
    94      const crystalGeometry = new THREE.OctahedronGeometry(0.03 + Math.random() * 0.02, 0);
    95      const crystalMaterial = new THREE.MeshStandardMaterial({
    96        color: [0xff69b4, 0x9370db, 0x00ced1][i],
    
  • L106

    ts
    104        (i - 1) * 0.15,
    105        0.05,
    106        0.4 + Math.random() * 0.1
    107      );
    108      group.add(crystal);
    

apps/lilith/web/src/lib/persona-avatar-aura.ts#

  • L15

    ts
    13
    14    for (let i = 0; i < particleCount; i++) {
    15      const theta = Math.random() * Math.PI * 2;
    16      const phi = Math.random() * Math.PI;
    17      const radius = 0.5 + Math.random() * 0.3;
    
  • L16

    ts
    14    for (let i = 0; i < particleCount; i++) {
    15      const theta = Math.random() * Math.PI * 2;
    16      const phi = Math.random() * Math.PI;
    17      const radius = 0.5 + Math.random() * 0.3;
    18
    
  • L17

    ts
    15      const theta = Math.random() * Math.PI * 2;
    16      const phi = Math.random() * Math.PI;
    17      const radius = 0.5 + Math.random() * 0.3;
    18
    19      positions[i * 3] = radius * Math.sin(phi) * Math.cos(theta);
    

apps/lilith/web/src/lib/progress-store.ts#

  • L164

    ts
    162          websocket: null,
    163          userId: null,
    164          deviceId: get()?._generateDeviceId() || `web_${Math.random().toString(36).substr(2, 9)}`,
    165          authToken: null,
    166
    
  • L610

    ts
    608          // Internal methods
    609          _generateId: () => {
    610            return Math.random().toString(36).substr(2, 9) + Date.now().toString(36);
    611          },
    612
    
  • L614

    ts
    612
    613          _generateDeviceId: () => {
    614            return `web_${Math.random().toString(36).substr(2, 9)}`;
    615          },
    616
    

apps/lilith/web/src/lib/seamless-auth-store.ts#

  • L101

    ts
    99          isLoading: false,
    100          lastError: null,
    101          deviceId: get()?._generateDeviceId() || `web_${Math.random().toString(36).substr(2, 9)}`,
    102          websocket: null,
    103          isConnected: false,
    
  • L662

    ts
    660            const platform = 'web';
    661            const timestamp = Date.now().toString(36);
    662            const random = Math.random().toString(36).substr(2, 5);
    663            return `${platform}_${timestamp}_${random}`;
    664          },
    

apps/lilith/web/src/lib/social-features.ts#

  • L53

    ts
    51
    52  export function createForumThread(topic: string, tags: string[]): ForumThread {
    53    return { id: `thread-${Math.random().toString(16).slice(2, 8)}`, topic, tags, posts: [] };
    54  }
    55
    
  • L66

    ts
    64
    65  export function startResearch(title: string, hypothesis: string): ResearchProject {
    66    return { id: `res-${Math.random().toString(16).slice(2, 8)}`, title, contributors: [], hypothesis, status: 'draft' };
    67  }
    68
    
  • L74

    ts
    72
    73  export function buildCeremony(name: string, steps: string[]): Ceremony {
    74    return { id: `ceremony-${Math.random().toString(16).slice(2, 8)}`, name, steps };
    75  }
    76
    
  • L78

    ts
    76
    77  export function composeSacredMusic(mood: string): MusicDraft {
    78    return { id: `music-${Math.random().toString(16).slice(2, 8)}`, mood, seed: Math.random().toString(36).slice(2, 8) };
    79  }
    80
    
  • L82

    ts
    80
    81  export function writeVisionQuest(userId: string, entry: string, insights: string[]): VisionJournal {
    82    return { id: `vision-${Math.random().toString(16).slice(2, 8)}`, userId, entry, insights };
    83  }
    

apps/lilith/web/src/lib/spatial-audio-3d.ts#

  • L503

    ts
    501        for (let i = 0; i < birdCount; i++) {
    502          const position = new THREE.Vector3(
    503            (Math.random() - 0.5) * 100,
    504            Math.random() * 20 + 5,
    505            (Math.random() - 0.5) * 100
    
  • L504

    ts
    502          const position = new THREE.Vector3(
    503            (Math.random() - 0.5) * 100,
    504            Math.random() * 20 + 5,
    505            (Math.random() - 0.5) * 100
    506          );
    
  • L505

    ts
    503            (Math.random() - 0.5) * 100,
    504            Math.random() * 20 + 5,
    505            (Math.random() - 0.5) * 100
    506          );
    507
    

apps/lilith/web/src/lib/teacher-training.ts#

  • L43

    ts
    41
    42  export function buildCertification(name: string, criteria: string[]): Certification {
    43    return { id: `cert-${Math.random().toString(16).slice(2, 8)}`, name, criteria, awardedTo: [] };
    44  }
    45
    
  • L60

    ts
    58  export function createCurriculum(title: string, lessons: string[]): CurriculumModule {
    59    return {
    60      id: `module-${Math.random().toString(16).slice(2, 8)}`,
    61      title,
    62      lessons
    

apps/lilith/web/src/lib/virtual-retreats.ts#

  • L40

    ts
    38      days,
    39      progress: {},
    40      forumId: `forum-${Math.random().toString(16).slice(2, 8)}`
    41    };
    42  }
    
  • L45

    ts
    43
    44  export function addSession(day: RetreatDay, session: Omit<RetreatSession, 'id'>): RetreatDay {
    45    const id = `session-${Math.random().toString(16).slice(2, 8)}`;
    46    return { ...day, sessions: [...day.sessions, { ...session, id }] };
    47  }
    

apps/lilith/web/src/pwa/background-sync.ts#

  • L575

    ts
    573      );
    574      // Add jitter
    575      return delay + Math.random() * 1000;
    576    }
    577  }
    

apps/lilith/web/src/services/CrossDeviceHandoffManager.ts#

  • L1000

    ts
    998        const channelData = impulse.getChannelData(channel);
    999        for (let i = 0; i < length; i++) {
    1000          channelData[i] = (Math.random() * 2 - 1) * Math.pow(1 - i / length, 2);
    1001        }
    1002      }
    

apps/maat/agent-console/src/lib/agent-data.ts#

  • L669

    ts
    667        trends: Array.from({ length: 30 }, (_, i) => ({
    668          dateIso: new Date(Date.now() - (29 - i) * 86_400_000).toISOString().slice(0, 10),
    669          successRatePct: 94 + Math.random() * 6,
    670          avgLatencyMs: 2_400 + Math.random() * 800,
    671          tasksCompleted: Math.floor(8 + Math.random() * 6),
    
  • L670

    ts
    668          dateIso: new Date(Date.now() - (29 - i) * 86_400_000).toISOString().slice(0, 10),
    669          successRatePct: 94 + Math.random() * 6,
    670          avgLatencyMs: 2_400 + Math.random() * 800,
    671          tasksCompleted: Math.floor(8 + Math.random() * 6),
    672          costUsd: 3.5 + Math.random() * 2,
    
  • L671

    ts
    669          successRatePct: 94 + Math.random() * 6,
    670          avgLatencyMs: 2_400 + Math.random() * 800,
    671          tasksCompleted: Math.floor(8 + Math.random() * 6),
    672          costUsd: 3.5 + Math.random() * 2,
    673        })),
    
  • L672

    ts
    670          avgLatencyMs: 2_400 + Math.random() * 800,
    671          tasksCompleted: Math.floor(8 + Math.random() * 6),
    672          costUsd: 3.5 + Math.random() * 2,
    673        })),
    674        topFailureReasons: [
    
  • L696

    ts
    694        trends: Array.from({ length: 30 }, (_, i) => ({
    695          dateIso: new Date(Date.now() - (29 - i) * 86_400_000).toISOString().slice(0, 10),
    696          successRatePct: 95 + Math.random() * 4,
    697          avgLatencyMs: 10_000 + Math.random() * 4_000,
    698          tasksCompleted: Math.floor(2 + Math.random() * 3),
    
  • L697

    ts
    695          dateIso: new Date(Date.now() - (29 - i) * 86_400_000).toISOString().slice(0, 10),
    696          successRatePct: 95 + Math.random() * 4,
    697          avgLatencyMs: 10_000 + Math.random() * 4_000,
    698          tasksCompleted: Math.floor(2 + Math.random() * 3),
    699          costUsd: 2.2 + Math.random() * 1.8,
    
  • L698

    ts
    696          successRatePct: 95 + Math.random() * 4,
    697          avgLatencyMs: 10_000 + Math.random() * 4_000,
    698          tasksCompleted: Math.floor(2 + Math.random() * 3),
    699          costUsd: 2.2 + Math.random() * 1.8,
    700        })),
    
  • L699

    ts
    697          avgLatencyMs: 10_000 + Math.random() * 4_000,
    698          tasksCompleted: Math.floor(2 + Math.random() * 3),
    699          costUsd: 2.2 + Math.random() * 1.8,
    700        })),
    701        topFailureReasons: [{ reason: 'Sub-agent timeout', count: 2 }],
    

apps/maat/api-gateway/src/app.ts#

  • L214

    ts
    212  function createRequestId(): string {
    213    const timestamp = Date.now().toString(36);
    214    const random = Math.random().toString(36).slice(2, 10);
    215    return `req_${timestamp}${random}`;
    216  }
    

apps/maat/api-gateway/src/middleware/rate-limit.ts#

  • L106

    ts
    104    ): Promise<SlidingWindowResult> {
    105      const windowStart = now - windowMs;
    106      const member = `${now}-${Math.random().toString(36).slice(2, 10)}`;
    107
    108      const pipeline = this.redis.pipeline();
    

apps/maat/intel/src/lib/price-monitoring-data.ts#

  • L21

    ts
    19    const history: ProductPriceMonitor['history'] = [];
    20    for (let i = -(months - 1); i <= 0; i++) {
    21      const noise = () => 1 + (Math.random() - 0.5) * 0.06;
    22      history.push({
    23        monthIso: monthLabel(i),
    

apps/metis/admin/src/components/DataTable.tsx#

  • L154

    ts
    152              {sortedData.map((row) => (
    153                <tr
    154                  key={String(row[keyField] ?? Math.random())}
    155                  onClick={onRowClick ? () => onRowClick(row) : undefined}
    156                  style={{
    

apps/metis/api-gateway/src/proxy/backend-proxy.ts#

  • L215

    ts
    213    // Exponential backoff with jitter
    214    const exponentialDelay = baseDelay * Math.pow(2, attempt);
    215    const jitter = Math.random() * baseDelay;
    216    return exponentialDelay + jitter;
    217  }
    

apps/metis/web/src/app/assessments/[assessmentId]/page.tsx#

  • L899

    ts
    897    const shuffled = [...questionIds];
    898    for (let index = shuffled.length - 1; index > 0; index -= 1) {
    899      const swapIndex = Math.floor(Math.random() * (index + 1));
    900      const current = shuffled[index];
    901      const next = shuffled[swapIndex];
    

apps/metis/web/src/lib/authoring-data.ts#

  • L43

    ts
    41
    42  export function createDraftId(prefix: string): string {
    43    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    44  }
    45
    

apps/metis/worker/src/queues/job-queue.ts#

  • L342

    ts
    340        // Schedule retry with exponential backoff
    341        const backoffDelay = job.retryDelay * Math.pow(2, job.attempts - 1);
    342        const jitter = Math.random() * backoffDelay * 0.1;
    343        job.status = JobStatus.RETRYING;
    344        // Re-insert with scheduled time for the backoff
    

apps/nyx/api/src/middleware/request-id.ts#

  • L14

    ts
    12  function generateRequestId(): string {
    13    const timestamp = Date.now().toString(36);
    14    const random = Math.random().toString(36).substring(2, 10);
    15    return `req_${timestamp}${random}`;
    16  }
    

apps/nyx/education/challenges/orbital-mechanics/src/challenge-service.ts#

  • L174

    ts
    172     */
    173    private generateSessionId(): string {
    174      return `session_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    175    }
    176
    
  • L218

    ts
    216      for (let i = 0; i < questionCount; i++) {
    217        // Select a random challenge type from the config
    218        const challengeType = config.types[Math.floor(Math.random() * config.types.length)];
    219
    220        // Get generators for this type
    
  • L233

    ts
    231          generator =
    232            mcGenerators.length > 0
    233              ? mcGenerators[Math.floor(Math.random() * mcGenerators.length)]
    234              : generators[0];
    235        } else {
    
  • L237

    ts
    235        } else {
    236          // Use any generator
    237          generator = generators[Math.floor(Math.random() * generators.length)];
    238        }
    239
    
  • L242

    ts
    240        // Get central body if configured
    241        const centralBody = config.centralBodies?.length
    242          ? config.centralBodies[Math.floor(Math.random() * config.centralBodies.length)]
    243          : undefined;
    244
    

apps/nyx/education/challenges/orbital-mechanics/src/conjunction-prediction.ts#

  • L203

    ts
    201    switch (difficulty) {
    202      case 'beginner':
    203        planet = ['mars', 'venus'][Math.floor(Math.random() * 2)] as CelestialBodyId;
    204        break;
    205      case 'intermediate':
    
  • L206

    ts
    204        break;
    205      case 'intermediate':
    206        planet = ['mercury', 'mars', 'jupiter'][Math.floor(Math.random() * 3)] as CelestialBodyId;
    207        break;
    208      case 'advanced':
    
  • L210

    ts
    208      case 'advanced':
    209        planet = ['mercury', 'venus', 'mars', 'jupiter', 'saturn'][
    210          Math.floor(Math.random() * 5)
    211        ] as CelestialBodyId;
    212        break;
    
  • L216

    ts
    214        planet =
    215          OUTER_PLANETS.concat(INNER_PLANETS)[
    216            Math.floor(Math.random() * (OUTER_PLANETS.length + INNER_PLANETS.length))
    217          ];
    218        break;
    
  • L282

    ts
    280  ): NumericQuestion {
    281    // Generate a random semi-major axis or period
    282    const calculatePeriod = Math.random() < 0.5;
    283
    284    let semiMajorAxisAU: number;
    
  • L289

    ts
    287      case 'beginner':
    288        // Use a nice round number
    289        semiMajorAxisAU = [1, 2, 4][Math.floor(Math.random() * 3)];
    290        break;
    291      case 'intermediate':
    
  • L379

    ts
    377  ): NumericQuestion {
    378    // Select planet
    379    const planet = OUTER_PLANETS[Math.floor(Math.random() * Math.min(3, OUTER_PLANETS.length))];
    380    const planetName = PLANET_NAMES[planet];
    381
    
  • L455

    ts
    453    synodicPeriods.sort((a, b) => a.period - b.period);
    454
    455    const questionType = Math.random() < 0.5 ? 'longest' : 'shortest';
    456    const correctPlanet =
    457      questionType === 'longest'
    
  • L511

    ts
    509    questionId: string
    510  ): MultipleChoiceQuestion {
    511    const orderingType = Math.random() < 0.5 ? 'orbital_period' : 'orbital_velocity';
    512
    513    if (orderingType === 'orbital_period') {
    
  • L684

    ts
    682
    683  function randomInRange(min: number, max: number): number {
    684    return min + Math.random() * (max - min);
    685  }
    686
    

apps/nyx/education/challenges/orbital-mechanics/src/escape-velocity.ts#

  • L324

    ts
    322        // Planetary transfers
    323        const bodies: CentralBody[] = ['mercury', 'venus', 'earth', 'mars', 'jupiter'];
    324        const body1 = bodies[Math.floor(Math.random() * bodies.length)];
    325        let body2 = bodies[Math.floor(Math.random() * bodies.length)];
    326        while (body2 === body1) {
    
  • L325

    ts
    323        const bodies: CentralBody[] = ['mercury', 'venus', 'earth', 'mars', 'jupiter'];
    324        const body1 = bodies[Math.floor(Math.random() * bodies.length)];
    325        let body2 = bodies[Math.floor(Math.random() * bodies.length)];
    326        while (body2 === body1) {
    327          body2 = bodies[Math.floor(Math.random() * bodies.length)];
    
  • L327

    ts
    325        let body2 = bodies[Math.floor(Math.random() * bodies.length)];
    326        while (body2 === body1) {
    327          body2 = bodies[Math.floor(Math.random() * bodies.length)];
    328        }
    329        initialRadius = getOrbitalDistance(body1) ?? 1.5e11;
    
  • L361

    ts
    359        break;
    360      case 'intermediate':
    361        calculateProperty = Math.random() < 0.5 ? 'totalDeltaV' : 'transferTime';
    362        break;
    363      default:
    
  • L364

    ts
    362        break;
    363      default:
    364        calculateProperty = properties[Math.floor(Math.random() * properties.length)];
    365    }
    366
    
  • L468

    ts
    466    escapeVelocities.sort((a, b) => b.velocity - a.velocity);
    467
    468    const questionType = Math.random() < 0.5 ? 'highest' : 'lowest';
    469    const correctBody =
    470      questionType === 'highest'
    
  • L638

    ts
    636
    637  function randomInRange(min: number, max: number): number {
    638    return min + Math.random() * (max - min);
    639  }
    640
    

apps/nyx/education/challenges/orbital-mechanics/src/orbit-classification.ts#

  • L222

    ts
    220   */
    221  function randomInRange(min: number, max: number): number {
    222    return min + Math.random() * (max - min);
    223  }
    224
    
  • L251

    ts
    249      case 'expert': {
    250        // Include parabolic and hyperbolic
    251        const orbitTypeRoll = Math.random();
    252        if (orbitTypeRoll < 0.7) {
    253          eccentricity = randomInRange(0, 0.95);
    
  • L457

    ts
    455
    456    // Pick a point in the orbit (periapsis, apoapsis, or random true anomaly)
    457    const pointType = ['periapsis', 'apoapsis', 'radius'][Math.floor(Math.random() * 3)];
    458    let radius: number;
    459    let pointDescription: string;
    

apps/nyx/education/challenges/star-identification/src/challenge-service.ts#

  • L441

    ts
    439
    440      const code =
    441        availableConstellations[Math.floor(Math.random() * availableConstellations.length)]!;
    442      return generateConstellationNamingQuestion(code, config.difficulty, questionId);
    443    }
    
  • L482

    ts
    480      }
    481
    482      const star = availableStars[Math.floor(Math.random() * availableStars.length)]!;
    483      return generateStarIdentificationQuestion(star, config.difficulty, questionId);
    484    }
    
  • L697

    ts
    695   */
    696  function generateId(): string {
    697    return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    698  }
    699
    

apps/nyx/education/challenges/star-identification/src/constellations.ts#

  • L2083

    ts
    2081    const difficultyConfig = {
    2082      beginner: { showNeighbors: true, showStarNames: true, rotation: 0 },
    2083      intermediate: { showNeighbors: true, showStarNames: false, rotation: Math.random() * 30 - 15 },
    2084      advanced: { showNeighbors: false, showStarNames: false, rotation: Math.random() * 60 - 30 },
    2085      expert: { showNeighbors: false, showStarNames: false, rotation: Math.random() * 180 },
    
  • L2084

    ts
    2082      beginner: { showNeighbors: true, showStarNames: true, rotation: 0 },
    2083      intermediate: { showNeighbors: true, showStarNames: false, rotation: Math.random() * 30 - 15 },
    2084      advanced: { showNeighbors: false, showStarNames: false, rotation: Math.random() * 60 - 30 },
    2085      expert: { showNeighbors: false, showStarNames: false, rotation: Math.random() * 180 },
    2086    };
    
  • L2085

    ts
    2083      intermediate: { showNeighbors: true, showStarNames: false, rotation: Math.random() * 30 - 15 },
    2084      advanced: { showNeighbors: false, showStarNames: false, rotation: Math.random() * 60 - 30 },
    2085      expert: { showNeighbors: false, showStarNames: false, rotation: Math.random() * 180 },
    2086    };
    2087
    

apps/nyx/education/challenges/star-identification/src/coordinate-pointing.ts#

  • L201

    ts
    199  export function generateRandomCoordinates(): EquatorialCoordinates {
    200    return {
    201      ra: Math.random() * 360,
    202      dec: Math.random() * 180 - 90,
    203    };
    
  • L202

    ts
    200    return {
    201      ra: Math.random() * 360,
    202      dec: Math.random() * 180 - 90,
    203    };
    204  }
    
  • L212

    ts
    210    const star = starName
    211      ? NAMED_STARS.find((s) => s.name === starName)
    212      : NAMED_STARS[Math.floor(Math.random() * NAMED_STARS.length)];
    213
    214    if (!star) {
    
  • L219

    ts
    217
    218    // Add small random offset (within 10 degrees)
    219    const raOffset = (Math.random() - 0.5) * 20;
    220    const decOffset = (Math.random() - 0.5) * 20;
    221
    
  • L220

    ts
    218    // Add small random offset (within 10 degrees)
    219    const raOffset = (Math.random() - 0.5) * 20;
    220    const decOffset = (Math.random() - 0.5) * 20;
    221
    222    return {
    
  • L363

    ts
    361      });
    362
    363      const notable = suitableCoords[Math.floor(Math.random() * suitableCoords.length)]!;
    364      target = notable.coords;
    365    } else {
    

apps/nyx/education/demos/distance-ladder/src/parallax.ts#

  • L426

    ts
    424    for (let i = 0; i < numMeasurements; i++) {
    425      // Box-Muller transform for Gaussian noise
    426      const u1 = Math.random();
    427      const u2 = Math.random();
    428      const noise = measurementPrecision * Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L427

    ts
    425      // Box-Muller transform for Gaussian noise
    426      const u1 = Math.random();
    427      const u2 = Math.random();
    428      const noise = measurementPrecision * Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    429      measurements.push(trueParallaxArcsec + noise);
    

apps/nyx/star-map/src/bookmarks/bookmarks.ts#

  • L501

    ts
    499   */
    500  export function generateBookmarkId(): string {
    501    return `bm_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 9)}`;
    502  }
    503
    
  • L508

    ts
    506   */
    507  export function generateFolderId(): string {
    508    return `folder_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 9)}`;
    509  }
    510
    

apps/nyx/star-map/src/components/LoadingScreen.tsx#

  • L36

    ts
    34            style={{
    35              position: 'absolute',
    36              width: Math.random() * 2 + 1 + 'px',
    37              height: Math.random() * 2 + 1 + 'px',
    38              backgroundColor: `rgba(255, 255, 255, ${Math.random() * 0.5 + 0.3})`,
    
  • L37

    ts
    35              position: 'absolute',
    36              width: Math.random() * 2 + 1 + 'px',
    37              height: Math.random() * 2 + 1 + 'px',
    38              backgroundColor: `rgba(255, 255, 255, ${Math.random() * 0.5 + 0.3})`,
    39              borderRadius: '50%',
    
  • L38

    ts
    36              width: Math.random() * 2 + 1 + 'px',
    37              height: Math.random() * 2 + 1 + 'px',
    38              backgroundColor: `rgba(255, 255, 255, ${Math.random() * 0.5 + 0.3})`,
    39              borderRadius: '50%',
    40              left: Math.random() * 100 + '%',
    
  • L40

    ts
    38              backgroundColor: `rgba(255, 255, 255, ${Math.random() * 0.5 + 0.3})`,
    39              borderRadius: '50%',
    40              left: Math.random() * 100 + '%',
    41              top: Math.random() * 100 + '%',
    42              animation: `pulse ${Math.random() * 3 + 2}s ease-in-out infinite`,
    
  • L41

    ts
    39              borderRadius: '50%',
    40              left: Math.random() * 100 + '%',
    41              top: Math.random() * 100 + '%',
    42              animation: `pulse ${Math.random() * 3 + 2}s ease-in-out infinite`,
    43              animationDelay: Math.random() * 2 + 's',
    
  • L42

    ts
    40              left: Math.random() * 100 + '%',
    41              top: Math.random() * 100 + '%',
    42              animation: `pulse ${Math.random() * 3 + 2}s ease-in-out infinite`,
    43              animationDelay: Math.random() * 2 + 's',
    44            }}
    
  • L43

    ts
    41              top: Math.random() * 100 + '%',
    42              animation: `pulse ${Math.random() * 3 + 2}s ease-in-out infinite`,
    43              animationDelay: Math.random() * 2 + 's',
    44            }}
    45          />
    

apps/nyx/star-map/src/filters/filters.ts#

  • L1067

    ts
    1065   */
    1066  export function generateFilterId(type: FilterType): string {
    1067    return `${type}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    1068  }
    1069
    
  • L1935

    ts
    1933
    1934      const preset: FilterPreset = {
    1935        id: `custom-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    1936        name,
    1937        description,
    

apps/nyx/star-map/src/journal/journal.ts#

  • L871

    ts
    869  export function generateId(): string {
    870    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    871      const r = (Math.random() * 16) | 0;
    872      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    873      return v.toString(16);
    
  • L1130

    ts
    1128  export function getRandomPrompt(type: keyof typeof JOURNAL_PROMPTS): string {
    1129    const prompts = JOURNAL_PROMPTS[type];
    1130    return prompts[Math.floor(Math.random() * prompts.length)];
    1131  }
    1132
    

apps/nyx/star-map/src/modes/discovery.ts#

  • L974

    ts
    972        if (allObjects.length === 0) return null;
    973
    974        const obj = allObjects[Math.floor(Math.random() * allObjects.length)];
    975        return {
    976          object: obj,
    
  • L986

    ts
    984      const weights = candidates.map((obj) => calculateInterestScore(obj));
    985      const totalWeight = weights.reduce((a, b) => a + b, 0);
    986      let random = Math.random() * totalWeight;
    987
    988      for (let i = 0; i < candidates.length; i++) {
    

apps/nyx/star-map/src/modes/eclipse/eclipse.ts#

  • L465

    ts
    463   */
    464  function generateId(): string {
    465    return `ecl_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    466  }
    467
    

apps/nyx/star-map/src/modes/orrery/asteroid-belt.ts#

  • L914

    ts
    912   */
    913  export function generateId(): string {
    914    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    915  }
    916
    

apps/nyx/star-map/src/modes/orrery/lagrange-points.ts#

  • L938

    ts
    936   */
    937  export function generateId(): string {
    938    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    939  }
    940
    

apps/nyx/star-map/src/modes/orrery/moon-system.ts#

  • L840

    ts
    838   */
    839  export function generateId(): string {
    840    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    841  }
    842
    

apps/nyx/star-map/src/modes/orrery/planet-detail.ts#

  • L996

    ts
    994   */
    995  export function generateId(): string {
    996    return Math.random().toString(36).substring(2, 11);
    997  }
    998
    

apps/nyx/star-map/src/modes/overview-effect/overview-effect.ts#

  • L745

    ts
    743    const quotes = theme ? ASTRONAUT_QUOTES.filter((q) => q.theme === theme) : ASTRONAUT_QUOTES;
    744
    745    const index = Math.floor(Math.random() * quotes.length);
    746    return quotes[index];
    747  }
    

apps/nyx/star-map/src/modes/pale-blue-dot/pale-blue-dot.ts#

  • L621

    ts
    619  export function getRandomFact(category?: FactCategory): (typeof COSMIC_CONTEXT)[number] {
    620    const facts = category ? COSMIC_CONTEXT.filter((f) => f.category === category) : COSMIC_CONTEXT;
    621    const index = Math.floor(Math.random() * facts.length);
    622    return facts[index];
    623  }
    

apps/nyx/star-map/src/modes/transits/iss.ts#

  • L426

    ts
    424   */
    425  function generateId(): string {
    426    return `iss_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    427  }
    428
    

apps/nyx/star-map/src/navigation/view-presets.ts#

  • L553

    ts
    551     */
    552    addCustomPreset(preset: Omit<ViewPreset, 'id' | 'category'>): ViewPreset {
    553      const id = `custom-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    554      const customPreset: ViewPreset = {
    555        ...preset,
    
  • L695

    ts
    693          const preset: ViewPreset = {
    694            ...presetData,
    695            id: `imported-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    696            position: new THREE.Vector3().fromArray(presetData.position),
    697            target: new THREE.Vector3().fromArray(presetData.target),
    

apps/nyx/star-map/src/notifications/notifications.ts#

  • L303

    ts
    301   */
    302  function generateNotificationId(): string {
    303    return `notif_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    304  }
    305
    

apps/nyx/star-map/src/overlays/astrology.ts#

  • L888

    ts
    886   */
    887  export function generateId(): string {
    888    return Math.random().toString(36).substring(2, 11);
    889  }
    890
    

apps/nyx/star-map/src/overlays/constellations.ts#

  • L1780

    ts
    1778  export function generateId(): string {
    1779    const timestamp = Date.now().toString(36);
    1780    const random = Math.random().toString(36).substring(2, 10);
    1781    return `${timestamp}-${random}`;
    1782  }
    

apps/nyx/star-map/src/overlays/grids.ts#

  • L968

    ts
    966  export function generateId(): string {
    967    const timestamp = Date.now().toString(36);
    968    const random = Math.random().toString(36).substring(2, 10);
    969    return `${timestamp}-${random}`;
    970  }
    

apps/nyx/star-map/src/overlays/markers.ts#

  • L615

    ts
    613  export function generateId(): string {
    614    const timestamp = Date.now().toString(36);
    615    const random = Math.random().toString(36).substring(2, 10);
    616    return `marker-${timestamp}-${random}`;
    617  }
    

apps/nyx/star-map/src/overlays/orbits.ts#

  • L885

    ts
    883  export function generateId(): string {
    884    const timestamp = Date.now().toString(36);
    885    const random = Math.random().toString(36).substring(2, 10);
    886    return `orbit-${timestamp}-${random}`;
    887  }
    

apps/nyx/star-map/src/overlays/you-are-here.ts#

  • L690

    ts
    688  export function getRandomFact(level: CosmicScaleLevel): string {
    689    const scale = COSMIC_SCALES[level];
    690    const randomIndex = Math.floor(Math.random() * scale.facts.length);
    691    return scale.facts[randomIndex];
    692  }
    

apps/nyx/star-map/src/planning/observation-planner.ts#

  • L1053

    ts
    1051  export function generateId(): string {
    1052    const timestamp = Date.now().toString(36);
    1053    const random = Math.random().toString(36).substring(2, 10);
    1054    return `${timestamp}-${random}`;
    1055  }
    

apps/nyx/star-map/src/scenes/StarMapScene.tsx#

  • L32

    ts
    30      for (let i = 0; i < count; i++) {
    31        // Distribute stars in a sphere
    32        const theta = Math.random() * Math.PI * 2;
    33        const phi = Math.acos(2 * Math.random() - 1);
    34        const radius = 500 + Math.random() * 9500; // 500 to 10000 units
    
  • L33

    ts
    31        // Distribute stars in a sphere
    32        const theta = Math.random() * Math.PI * 2;
    33        const phi = Math.acos(2 * Math.random() - 1);
    34        const radius = 500 + Math.random() * 9500; // 500 to 10000 units
    35
    
  • L34

    ts
    32        const theta = Math.random() * Math.PI * 2;
    33        const phi = Math.acos(2 * Math.random() - 1);
    34        const radius = 500 + Math.random() * 9500; // 500 to 10000 units
    35
    36        positions[i * 3] = radius * Math.sin(phi) * Math.cos(theta);
    
  • L41

    ts
    39
    40        // Star color based on temperature (simplified)
    41        const temp = Math.random();
    42        if (temp < 0.1) {
    43          // Blue-white hot stars
    
  • L44

    ts
    42        if (temp < 0.1) {
    43          // Blue-white hot stars
    44          colors[i * 3] = 0.7 + Math.random() * 0.3;
    45          colors[i * 3 + 1] = 0.7 + Math.random() * 0.3;
    46          colors[i * 3 + 2] = 1;
    
  • L45

    ts
    43          // Blue-white hot stars
    44          colors[i * 3] = 0.7 + Math.random() * 0.3;
    45          colors[i * 3 + 1] = 0.7 + Math.random() * 0.3;
    46          colors[i * 3 + 2] = 1;
    47        } else if (temp < 0.3) {
    
  • L51

    ts
    49          colors[i * 3] = 1;
    50          colors[i * 3 + 1] = 1;
    51          colors[i * 3 + 2] = 0.9 + Math.random() * 0.1;
    52        } else if (temp < 0.6) {
    53          // Yellow stars (like Sun)
    
  • L55

    ts
    53          // Yellow stars (like Sun)
    54          colors[i * 3] = 1;
    55          colors[i * 3 + 1] = 0.9 + Math.random() * 0.1;
    56          colors[i * 3 + 2] = 0.6 + Math.random() * 0.2;
    57        } else if (temp < 0.85) {
    
  • L56

    ts
    54          colors[i * 3] = 1;
    55          colors[i * 3 + 1] = 0.9 + Math.random() * 0.1;
    56          colors[i * 3 + 2] = 0.6 + Math.random() * 0.2;
    57        } else if (temp < 0.85) {
    58          // Orange stars
    
  • L60

    ts
    58          // Orange stars
    59          colors[i * 3] = 1;
    60          colors[i * 3 + 1] = 0.6 + Math.random() * 0.2;
    61          colors[i * 3 + 2] = 0.3 + Math.random() * 0.2;
    62        } else {
    
  • L61

    ts
    59          colors[i * 3] = 1;
    60          colors[i * 3 + 1] = 0.6 + Math.random() * 0.2;
    61          colors[i * 3 + 2] = 0.3 + Math.random() * 0.2;
    62        } else {
    63          // Red stars
    
  • L65

    ts
    63          // Red stars
    64          colors[i * 3] = 1;
    65          colors[i * 3 + 1] = 0.3 + Math.random() * 0.3;
    66          colors[i * 3 + 2] = 0.2 + Math.random() * 0.2;
    67        }
    
  • L66

    ts
    64          colors[i * 3] = 1;
    65          colors[i * 3 + 1] = 0.3 + Math.random() * 0.3;
    66          colors[i * 3 + 2] = 0.2 + Math.random() * 0.2;
    67        }
    68
    
  • L70

    ts
    68
    69        // Size based on "brightness" (closer = bigger)
    70        sizes[i] = Math.random() * settings.starPointSize + 0.5;
    71      }
    72
    

apps/nyx/star-map/src/search/query-builder.ts#

  • L382

    ts
    380   */
    381  export function generateNodeId(): string {
    382    return `node-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    383  }
    384
    
  • L389

    ts
    387   */
    388  export function generateQueryId(): string {
    389    return `query-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    390  }
    391
    

apps/nyx/star-map/src/spacecraft/mission-timeline.ts#

  • L342

    ts
    340   */
    341  function generateId(): string {
    342    return `tl_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    343  }
    344
    

apps/nyx/star-map/src/spacecraft/visualization.ts#

  • L771

    ts
    769   */
    770  function _generateId(): string {
    771    return `viz-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    772  }
    773
    

apps/nyx/star-map/src/time/event-timeline.ts#

  • L762

    ts
    760   */
    761  export function generateId(): string {
    762    return `event_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    763  }
    764
    

apps/nyx/star-map/src/time/time-controls.ts#

  • L507

    ts
    505   */
    506  export function generateId(): string {
    507    return `time_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    508  }
    509
    

apps/nyx/star-map/src/tonight/tonight.ts#

  • L718

    ts
    716    ): number {
    717      // Simplified: based on latitude and ecliptic
    718      return 90 - Math.abs(location.latitude) + Math.random() * 20 - 10;
    719    }
    720
    
  • L1045

    ts
    1043      // Simplified visibility calculation
    1044      const isVisible = true; // Assume seasonal objects are visible
    1045      const transitAltitude = 90 - Math.abs(location.latitude - 30) + Math.random() * 20;
    1046
    1047      // Calculate visibility rating based on magnitude and moon
    

apps/nyx/star-map/src/ui/context-menu.ts#

  • L354

    ts
    352  export function createSeparator(): ContextMenuItem {
    353    return {
    354      id: `separator-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    355      type: 'separator',
    356    };
    

apps/nyx/star-map/src/ui/time-slider.ts#

  • L344

    ts
    342   */
    343  export function generateId(): string {
    344    return `slider_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    345  }
    346
    

apps/nyx/star-map/src/utils/index.ts#

  • L137

    ts
    135   */
    136  export function generateId(): string {
    137    return `${Date.now().toString(36)}-${Math.random().toString(36).substr(2, 9)}`;
    138  }
    139
    

apps/nyx/tools/orbit-determination/src/index.ts#

  • L1997

    ts
    1995   */
    1996  function gaussianRandom(): number {
    1997    const u1 = Math.random();
    1998    const u2 = Math.random();
    1999    return Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L1998

    ts
    1996  function gaussianRandom(): number {
    1997    const u1 = Math.random();
    1998    const u2 = Math.random();
    1999    return Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    2000  }
    

apps/nyx/vr-planetarium/src/dome/star-dome.ts#

  • L139

    ts
    137      // Random position on celestial sphere
    138      // Use uniform sphere distribution
    139      const ra = Math.random() * 360;
    140      // Use acos distribution for uniform coverage
    141      const dec = (Math.acos(2 * Math.random() - 1) - Math.PI / 2) * (180 / Math.PI);
    
  • L141

    ts
    139      const ra = Math.random() * 360;
    140      // Use acos distribution for uniform coverage
    141      const dec = (Math.acos(2 * Math.random() - 1) - Math.PI / 2) * (180 / Math.PI);
    142
    143      // Magnitude distribution (most stars are dim)
    
  • L145

    ts
    143      // Magnitude distribution (most stars are dim)
    144      // Logarithmic distribution favoring dimmer stars
    145      const magRandom = Math.random();
    146      const magnitude = -1.5 + Math.pow(magRandom, 0.5) * 8; // Range -1.5 to 6.5
    147
    
  • L150

    ts
    148      // Temperature distribution based on magnitude
    149      // Brighter stars tend to be hotter
    150      const tempBase = 3000 + Math.random() * 7000;
    151      const tempBonus = magnitude < 2 ? (2 - magnitude) * 2000 : 0;
    152      const colorTemp = Math.min(30000, tempBase + tempBonus);
    
  • L188

    ts
    186  function weightedRandom<T>(items: T[], weights: number[]): T {
    187    const totalWeight = weights.reduce((sum, w) => sum + w, 0);
    188    let random = Math.random() * totalWeight;
    189
    190    for (let i = 0; i < items.length; i++) {
    
  • L249

    ts
    247
    248      // Random twinkle phase
    249      twinklePhases[i] = Math.random() * Math.PI * 2;
    250    }
    251
    

apps/nyx/vr-planetarium/src/scenes/PlanetariumScene.tsx#

  • L209

    ts
    207      for (let i = 0; i < count; i++) {
    208        // Use same distribution as StarDome
    209        const theta = Math.random() * Math.PI * 2;
    210        const phi = Math.acos(2 * Math.random() - 1);
    211
    
  • L210

    ts
    208        // Use same distribution as StarDome
    209        const theta = Math.random() * Math.PI * 2;
    210        const phi = Math.acos(2 * Math.random() - 1);
    211
    212        const ra = (theta * 180) / Math.PI;
    
  • L215

    ts
    213        const dec = 90 - (phi * 180) / Math.PI;
    214
    215        const magnitude = -1.5 + Math.pow(Math.random(), 0.5) * 8;
    216        const spectralTypes = ['O', 'B', 'A', 'F', 'G', 'K', 'M'];
    217        const weights = [0.003, 0.01, 0.02, 0.05, 0.1, 0.15, 0.667];
    
  • L220

    ts
    218
    219        let spectralType = 'G';
    220        const r = Math.random();
    221        let cumulative = 0;
    222        for (let j = 0; j < weights.length; j++) {
    

apps/oshun/admin/src/middleware.ts#

  • L13

    ts
    11  function generateRequestId(): string {
    12    const timestamp = Date.now().toString(36);
    13    const random = Math.random().toString(36).slice(2, 10);
    14    return `req_${timestamp}_${random}`;
    15  }
    

apps/oshun/bff/src/admin/admin-cross-links.ts#

  • L543

    ts
    541      return `explicit:${globalThis.crypto.randomUUID()}`;
    542    }
    543    return `explicit:${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
    544  }
    

apps/oshun/bff/src/admin/admin-entity-comments.ts#

  • L326

    ts
    324      return `comment-${globalThis.crypto.randomUUID()}`;
    325    }
    326    return `comment-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
    327  }
    

apps/oshun/bff/src/admin/admin-investigation-bundle-store.ts#

  • L524

    ts
    522      return `bundle-${globalThis.crypto.randomUUID()}`;
    523    }
    524    return `bundle-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
    525  }
    526
    

apps/oshun/bff/src/admin/admin-notifications-store.ts#

  • L252

    ts
    250      return `notif-${globalThis.crypto.randomUUID()}`;
    251    }
    252    return `notif-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
    253  }
    254
    

apps/oshun/bff/src/admin/saved-views-store.ts#

  • L305

    ts
    303    }
    304    // Deterministic fallback for test doubles; not used in production runtime.
    305    return `view-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
    306  }
    

apps/oshun/bff/src/admin/state.ts#

  • L29613

    ts
    29611    record: AdminUserRecord
    29612  ): string {
    29613    const random = Math.floor(Math.random() * 1e10)
    29614      .toString(36)
    29615      .padStart(8, '0');
    

apps/oshun/bff/src/routes/admin-session.ts#

  • L250

    ts
    248      return globalThis.crypto.randomUUID();
    249    }
    250    return `admin-sess-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
    251  }
    

apps/oshun/mobile/src/network/http-client.ts#

  • L134

    ts
    132
    133  function delayWithBackoff(baseMs: number, multiplier: number, attempt: number): Promise<void> {
    134    const jitterMs = Math.floor(Math.random() * 100);
    135    const delayMs = Math.max(0, Math.floor(baseMs * Math.pow(multiplier, attempt)) + jitterMs);
    136
    

apps/oshun/mobile/src/notifications/registration.ts#

  • L768

    ts
    766      let id = typeof localStorage !== 'undefined' ? localStorage.getItem('@oshun/device-id') : null;
    767      if (!id) {
    768        id = `web-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    769        if (typeof localStorage !== 'undefined') {
    770          localStorage.setItem('@oshun/device-id', id);
    
  • L775

    ts
    773      return id;
    774    }
    775    return `${Platform.OS}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    776  }
    777
    

apps/oshun/web/src/components/activity/ActivityDashboard.tsx#

  • L2022

    ts
    2020      >
    2021        {pieces.map((_, i) => {
    2022          const x = Math.random() * 200 - 100;
    2023          const y = Math.random() * -150 - 50;
    2024          const r = Math.random() * 720;
    
  • L2023

    ts
    2021        {pieces.map((_, i) => {
    2022          const x = Math.random() * 200 - 100;
    2023          const y = Math.random() * -150 - 50;
    2024          const r = Math.random() * 720;
    2025          const delay = Math.random() * 0.3;
    
  • L2024

    ts
    2022          const x = Math.random() * 200 - 100;
    2023          const y = Math.random() * -150 - 50;
    2024          const r = Math.random() * 720;
    2025          const delay = Math.random() * 0.3;
    2026          const color = colors[i % colors.length];
    
  • L2025

    ts
    2023          const y = Math.random() * -150 - 50;
    2024          const r = Math.random() * 720;
    2025          const delay = Math.random() * 0.3;
    2026          const color = colors[i % colors.length];
    2027          return (
    
  • L2038

    ts
    2036                  width: 6,
    2037                  height: 6,
    2038                  borderRadius: Math.random() > 0.5 ? tokens.radii.full : '1px',
    2039                  background: color,
    2040                  animation: !disableAnimation
    

apps/oshun/web/src/components/assistant/AssistantPanel.tsx#

  • L1482

    ts
    1480        let progress = 0;
    1481        const progressInterval = setInterval(() => {
    1482          progress += Math.random() * 30 + 10;
    1483          if (progress >= 100) {
    1484            progress = 100;
    
  • L1675

    ts
    1673      // Simulate voice amplitude visualization
    1674      voiceAmplitudeRef.current = setInterval(() => {
    1675        const bars = Array.from({ length: 12 }, () => Math.random() * 24 + 4);
    1676        setVoiceAmplitude(bars);
    1677      }, 100);
    

apps/oshun/web/src/components/domains/arete/AreteBalance.tsx#

  • L450

    ts
    448  function ConfettiBurst(): JSX.Element {
    449    const particles = Array.from({ length: 24 }, (_, i) => {
    450      const angle = (Math.PI * 2 * i) / 24 + (Math.random() - 0.5) * 0.4;
    451      const dist = 40 + Math.random() * 60;
    452      const cx = Math.cos(angle) * dist;
    
  • L451

    ts
    449    const particles = Array.from({ length: 24 }, (_, i) => {
    450      const angle = (Math.PI * 2 * i) / 24 + (Math.random() - 0.5) * 0.4;
    451      const dist = 40 + Math.random() * 60;
    452      const cx = Math.cos(angle) * dist;
    453      const cy = Math.sin(angle) * dist - 20;
    
  • L454

    ts
    452      const cx = Math.cos(angle) * dist;
    453      const cy = Math.sin(angle) * dist - 20;
    454      const size = 4 + Math.random() * 5;
    455      const colors = ['#F59E0B', '#22C55E', '#3B82F6', '#EC4899', '#8B5CF6', ACCENT];
    456      const color = colors[i % colors.length];
    
  • L457

    ts
    455      const colors = ['#F59E0B', '#22C55E', '#3B82F6', '#EC4899', '#8B5CF6', ACCENT];
    456      const color = colors[i % colors.length];
    457      const delay = Math.random() * 0.3;
    458      return (
    459        <div
    
  • L465

    ts
    463            width: size,
    464            height: size,
    465            borderRadius: Math.random() > 0.5 ? '50%' : '2px',
    466            background: color,
    467            left: '50%',
    

apps/oshun/web/src/components/domains/arete/AreteCoach.tsx#

  • L341

    ts
    339    }
    340
    341    const content = responses[Math.floor(Math.random() * responses.length)];
    342    const suggestions = [
    343      'Tell me more',
    
  • L875

    ts
    873            setIsTyping(false);
    874          },
    875          1200 + Math.random() * 800
    876        );
    877      },
    

apps/oshun/web/src/components/domains/arete/AreteGoalSystem.tsx#

  • L851

    ts
    849    // Update score based on form fill
    850    const updateScore = useCallback((key: string, filled: boolean) => {
    851      setScores((prev) => ({ ...prev, [key]: filled ? 80 + Math.floor(Math.random() * 20) : 0 }));
    852    }, []);
    853
    
  • L1645

    ts
    1643            id: `t-${i}-1`,
    1644            title: 'Daily writing session',
    1645            completed: i < 7 ? Math.random() > 0.2 : false,
    1646          },
    1647          {
    
  • L1650

    ts
    1648            id: `t-${i}-2`,
    1649            title: 'Draft blog post',
    1650            completed: i < 7 ? Math.random() > 0.3 : false,
    1651          },
    1652          {
    
  • L1655

    ts
    1653            id: `t-${i}-3`,
    1654            title: 'Edit and publish',
    1655            completed: i < 7 ? Math.random() > 0.5 : false,
    1656          },
    1657        ],
    
  • L1658

    ts
    1656          },
    1657        ],
    1658        score: i < 7 ? 0.5 + Math.random() * 0.4 : 0,
    1659        accountabilityNote: i < 7 ? 'Good week, maintained consistency' : undefined,
    1660      })),
    

apps/oshun/web/src/components/domains/arete/AreteGoals.tsx#

  • L172

    ts
    170      const dateStr = d.toISOString().slice(0, 10);
    171      const baseProgress = currentProgress * ((60 - i) / 60);
    172      const jitter = (Math.random() - 0.5) * 10;
    173      entries.push({
    174        date: dateStr,
    

apps/oshun/web/src/components/domains/arete/AreteHabits.tsx#

  • L194

    ts
    192
    193  const CELEBRATION_CONFETTI = Array.from({ length: 16 }, (_, i) => ({
    194    ccx: `${(Math.random() - 0.5) * 200}px`,
    195    ccy: `${-80 - Math.random() * 120}px`,
    196    cr: `${Math.random() * 720 - 360}deg`,
    
  • L195

    ts
    193  const CELEBRATION_CONFETTI = Array.from({ length: 16 }, (_, i) => ({
    194    ccx: `${(Math.random() - 0.5) * 200}px`,
    195    ccy: `${-80 - Math.random() * 120}px`,
    196    cr: `${Math.random() * 720 - 360}deg`,
    197    color: ['#F59E0B', '#EF4444', '#22C55E', '#3B82F6', '#EC4899', '#8B5CF6', '#06B6D4'][i % 7],
    
  • L196

    ts
    194    ccx: `${(Math.random() - 0.5) * 200}px`,
    195    ccy: `${-80 - Math.random() * 120}px`,
    196    cr: `${Math.random() * 720 - 360}deg`,
    197    color: ['#F59E0B', '#EF4444', '#22C55E', '#3B82F6', '#EC4899', '#8B5CF6', '#06B6D4'][i % 7],
    198    delay: `${Math.random() * 0.3}s`,
    
  • L198

    ts
    196    cr: `${Math.random() * 720 - 360}deg`,
    197    color: ['#F59E0B', '#EF4444', '#22C55E', '#3B82F6', '#EC4899', '#8B5CF6', '#06B6D4'][i % 7],
    198    delay: `${Math.random() * 0.3}s`,
    199    size: 4 + Math.random() * 4,
    200  }));
    
  • L199

    ts
    197    color: ['#F59E0B', '#EF4444', '#22C55E', '#3B82F6', '#EC4899', '#8B5CF6', '#06B6D4'][i % 7],
    198    delay: `${Math.random() * 0.3}s`,
    199    size: 4 + Math.random() * 4,
    200  }));
    201
    
  • L210

    ts
    208      d.setDate(d.getDate() - i);
    209      const dateStr = d.toISOString().slice(0, 10);
    210      history.push({ date: dateStr, done: Math.random() < completionRate });
    211    }
    212    return history;
    
  • L524

    ts
    522                    borderRadius: 2,
    523                    background: day.done
    524                      ? `color-mix(in srgb, ${ACCENT} ${60 + Math.random() * 40}%, transparent)`
    525                      : 'rgba(255,255,255,0.04)',
    526                    animation: `habit-heatmap-cell 0.2s ease-out ${flatIdx * 0.003}s both`,
    

apps/oshun/web/src/components/domains/arete/AreteJournal.tsx#

  • L261

    ts
    259
    260    for (let i = 0; i < 15; i++) {
    261      const wordCount = 150 + Math.floor(Math.random() * 600);
    262      entries.push({
    263        id: `je-${i + 1}`,
    
  • L278

    ts
    276        wordCount,
    277        readingTimeMin: Math.max(1, Math.round(wordCount / 200)),
    278        createdAt: Date.now() - 86400000 * i - Math.random() * 43200000,
    279        updatedAt: Date.now() - 86400000 * i,
    280        gratitudes:
    

apps/oshun/web/src/components/domains/arete/AreteJournalSystem.tsx#

  • L1792

    ts
    1790      const pool = filteredPrompts.filter((p) => p.id !== currentPrompt.id);
    1791      if (pool.length > 0) {
    1792        setCurrentPrompt(pool[Math.floor(Math.random() * pool.length)]);
    1793        setResponse('');
    1794      }
    

apps/oshun/web/src/components/domains/arete/AreteTime.tsx#

  • L312

    ts
    310    const particles = Array.from({ length: 12 }, (_, i) => {
    311      const angle = (i / 12) * 360;
    312      const distance = 30 + Math.random() * 30;
    313      const dx = Math.cos((angle * Math.PI) / 180) * distance;
    314      const dy = Math.sin((angle * Math.PI) / 180) * distance;
    
  • L315

    ts
    313      const dx = Math.cos((angle * Math.PI) / 180) * distance;
    314      const dy = Math.sin((angle * Math.PI) / 180) * distance;
    315      const rotation = Math.random() * 720 - 360;
    316      const colors = [ACCENT, BREAK_COLOR, '#F59E0B', '#8B5CF6', '#3B82F6', '#EF4444'];
    317      const color = colors[i % colors.length];
    
  • L318

    ts
    316      const colors = [ACCENT, BREAK_COLOR, '#F59E0B', '#8B5CF6', '#3B82F6', '#EF4444'];
    317      const color = colors[i % colors.length];
    318      const size = 4 + Math.random() * 4;
    319      return (
    320        <div
    
  • L328

    ts
    326            width: size,
    327            height: size,
    328            borderRadius: Math.random() > 0.5 ? '50%' : '2px',
    329            background: color,
    330            // eslint-disable-next-line @typescript-eslint/no-explicit-any
    
  • L362

    ts
    360  function AmbientParticles(): JSX.Element {
    361    const particles = Array.from({ length: 8 }, (_, i) => {
    362      const left = 10 + Math.random() * 80;
    363      const top = 10 + Math.random() * 80;
    364      const dx = (Math.random() - 0.5) * 20;
    
  • L363

    ts
    361    const particles = Array.from({ length: 8 }, (_, i) => {
    362      const left = 10 + Math.random() * 80;
    363      const top = 10 + Math.random() * 80;
    364      const dx = (Math.random() - 0.5) * 20;
    365      const size = 3 + Math.random() * 3;
    
  • L364

    ts
    362      const left = 10 + Math.random() * 80;
    363      const top = 10 + Math.random() * 80;
    364      const dx = (Math.random() - 0.5) * 20;
    365      const size = 3 + Math.random() * 3;
    366      const delay = Math.random() * 3;
    
  • L365

    ts
    363      const top = 10 + Math.random() * 80;
    364      const dx = (Math.random() - 0.5) * 20;
    365      const size = 3 + Math.random() * 3;
    366      const delay = Math.random() * 3;
    367      const duration = 3 + Math.random() * 2;
    
  • L366

    ts
    364      const dx = (Math.random() - 0.5) * 20;
    365      const size = 3 + Math.random() * 3;
    366      const delay = Math.random() * 3;
    367      const duration = 3 + Math.random() * 2;
    368      return (
    
  • L367

    ts
    365      const size = 3 + Math.random() * 3;
    366      const delay = Math.random() * 3;
    367      const duration = 3 + Math.random() * 2;
    368      return (
    369        <div
    

apps/oshun/web/src/components/domains/arete/AreteVision.tsx#

  • L574

    ts
    572                  style={{
    573                    position: 'absolute',
    574                    top: `${10 + Math.random() * 30}%`,
    575                    left: `${10 + Math.random() * 80}%`,
    576                    width: 6 + Math.random() * 6,
    
  • L575

    ts
    573                    position: 'absolute',
    574                    top: `${10 + Math.random() * 30}%`,
    575                    left: `${10 + Math.random() * 80}%`,
    576                    width: 6 + Math.random() * 6,
    577                    height: 6 + Math.random() * 6,
    
  • L576

    ts
    574                    top: `${10 + Math.random() * 30}%`,
    575                    left: `${10 + Math.random() * 80}%`,
    576                    width: 6 + Math.random() * 6,
    577                    height: 6 + Math.random() * 6,
    578                    borderRadius: Math.random() > 0.5 ? '50%' : '2px',
    
  • L577

    ts
    575                    left: `${10 + Math.random() * 80}%`,
    576                    width: 6 + Math.random() * 6,
    577                    height: 6 + Math.random() * 6,
    578                    borderRadius: Math.random() > 0.5 ? '50%' : '2px',
    579                    background: [ACCENT, '#FFD700', '#EC4899', '#3B82F6', '#22C55E'][i % 5],
    
  • L578

    ts
    576                    width: 6 + Math.random() * 6,
    577                    height: 6 + Math.random() * 6,
    578                    borderRadius: Math.random() > 0.5 ? '50%' : '2px',
    579                    background: [ACCENT, '#FFD700', '#EC4899', '#3B82F6', '#22C55E'][i % 5],
    580                    animation: `vis-confetti-fall ${0.8 + Math.random() * 0.8}s ease-out ${i * 0.05}s forwards`,
    
  • L580

    ts
    578                    borderRadius: Math.random() > 0.5 ? '50%' : '2px',
    579                    background: [ACCENT, '#FFD700', '#EC4899', '#3B82F6', '#22C55E'][i % 5],
    580                    animation: `vis-confetti-fall ${0.8 + Math.random() * 0.8}s ease-out ${i * 0.05}s forwards`,
    581                    opacity: 0.9,
    582                  }}
    

apps/oshun/web/src/components/domains/nyx/NyxAnalysisTools.tsx#

  • L702

    ts
    700                            cx={70 + Math.cos(i * 0.8) * 30}
    701                            cy={55 + Math.sin(i * 1.1) * 20}
    702                            r={2 + Math.random() * 3}
    703                            fill={`${morphTypeColor('irregular')}66`}
    704                          />
    

apps/oshun/web/src/components/domains/nyx/NyxCelestialEvents.tsx#

  • L460

    ts
    458
    459    // Planets visible tonight (simulated)
    460    const visiblePlanets = ['Jupiter', 'Saturn', 'Mars'].filter(() => Math.random() > 0.3);
    461
    462    return (
    

apps/oshun/web/src/components/domains/nyx/NyxLearningCenter.tsx#

  • L81

    ts
    79      title: t,
    80      order: i + 1,
    81      readingTimeMinutes: 5 + Math.floor(Math.random() * 10),
    82      content: buildLessonContent(t),
    83      keyTakeaways: takeaways[i] ?? ['Key concept covered in this lesson.'],
    

apps/oshun/web/src/components/domains/nyx/NyxSatelliteTracker.tsx#

  • L1020

    ts
    1018              r={0.5}
    1019              fill="white"
    1020              opacity={0.3 + Math.random() * 0.4}
    1021            />
    1022          ))}
    

apps/oshun/web/src/components/domains/nyx/NyxSolarMonitor.tsx#

  • L209

    ts
    207        ...SOLAR_ACTIVITY_DATA,
    208        lastUpdated: new Date().toISOString(),
    209        kpIndex: Math.round(3 + Math.random() * 4),
    210      });
    211      setLastRefresh(new Date());
    

apps/oshun/web/src/components/domains/nyx/NyxSonification.tsx#

  • L1236

    ts
    1234      // Add some dimmer unnamed stars
    1235      for (let i = 0; i < 40; i++) {
    1236        const mag = 2.5 + Math.random() * 3;
    1237        stars.push({
    1238          id: `dim-${i}`,
    
  • L1240

    ts
    1238          id: `dim-${i}`,
    1239          name: '',
    1240          x: 20 + Math.random() * 360,
    1241          y: 20 + Math.random() * 260,
    1242          magnitude: mag,
    
  • L1241

    ts
    1239          name: '',
    1240          x: 20 + Math.random() * 360,
    1241          y: 20 + Math.random() * 260,
    1242          magnitude: mag,
    1243          spectralClass: ['A', 'F', 'G', 'K', 'M'][Math.floor(Math.random() * 5)] ?? 'G',
    
  • L1243

    ts
    1241          y: 20 + Math.random() * 260,
    1242          magnitude: mag,
    1243          spectralClass: ['A', 'F', 'G', 'K', 'M'][Math.floor(Math.random() * 5)] ?? 'G',
    1244          color:
    1245            ['#CAD7FF', '#F8F7FF', '#FFF4EA', '#FFD2A1', '#FFCC6F'][Math.floor(Math.random() * 5)] ??
    
  • L1245

    ts
    1243          spectralClass: ['A', 'F', 'G', 'K', 'M'][Math.floor(Math.random() * 5)] ?? 'G',
    1244          color:
    1245            ['#CAD7FF', '#F8F7FF', '#FFF4EA', '#FFD2A1', '#FFCC6F'][Math.floor(Math.random() * 5)] ??
    1246            '#FFF4EA',
    1247          frequency: 300 + mag * 100,
    

apps/oshun/web/src/components/domains/nyx/NyxTelescopeControl.tsx#

  • L601

    ts
    599          currentRa: targetRa,
    600          currentDec: targetDec,
    601          currentAltitude: 30 + Math.random() * 50,
    602          currentAzimuth: Math.random() * 360,
    603        }));
    
  • L602

    ts
    600          currentDec: targetDec,
    601          currentAltitude: 30 + Math.random() * 50,
    602          currentAzimuth: Math.random() * 360,
    603        }));
    604        setConnection((prev) => ({ ...prev, lastCommunication: new Date() }));
    

apps/oshun/web/src/components/domains/nyx/education/EducationDashboard.tsx#

  • L249

    ts
    247    const particles = Array.from({ length: 20 }, (_, i) => ({
    248      id: i,
    249      left: Math.random() * 100,
    250      delay: Math.random() * 0.5,
    251      size: 4 + Math.random() * 6,
    
  • L250

    ts
    248      id: i,
    249      left: Math.random() * 100,
    250      delay: Math.random() * 0.5,
    251      size: 4 + Math.random() * 6,
    252      color: ['#818cf8', '#22c55e', '#fbbf24', '#f472b6', '#38bdf8'][i % 5],
    
  • L251

    ts
    249      left: Math.random() * 100,
    250      delay: Math.random() * 0.5,
    251      size: 4 + Math.random() * 6,
    252      color: ['#818cf8', '#22c55e', '#fbbf24', '#f472b6', '#38bdf8'][i % 5],
    253      duration: 1 + Math.random() * 1.5,
    
  • L253

    ts
    251      size: 4 + Math.random() * 6,
    252      color: ['#818cf8', '#22c55e', '#fbbf24', '#f472b6', '#38bdf8'][i % 5],
    253      duration: 1 + Math.random() * 1.5,
    254    }));
    255
    

apps/oshun/web/src/components/domains/nyx/solar-activity/data/solar-simulation.ts#

  • L522

    ts
    520      const dist = Math.abs(lat - ovalCenter);
    521      let prob: number;
    522      if (dist <= 3) prob = 90 + Math.round(Math.random() * 10);
    523      else if (dist <= 8) prob = 60 + Math.round(Math.random() * 15);
    524      else if (dist <= 15) prob = 25 + Math.round(Math.random() * 10);
    
  • L523

    ts
    521      let prob: number;
    522      if (dist <= 3) prob = 90 + Math.round(Math.random() * 10);
    523      else if (dist <= 8) prob = 60 + Math.round(Math.random() * 15);
    524      else if (dist <= 15) prob = 25 + Math.round(Math.random() * 10);
    525      else if (dist <= 22) prob = 5 + Math.round(Math.random() * 5);
    
  • L524

    ts
    522      if (dist <= 3) prob = 90 + Math.round(Math.random() * 10);
    523      else if (dist <= 8) prob = 60 + Math.round(Math.random() * 15);
    524      else if (dist <= 15) prob = 25 + Math.round(Math.random() * 10);
    525      else if (dist <= 22) prob = 5 + Math.round(Math.random() * 5);
    526      else prob = 0;
    
  • L525

    ts
    523      else if (dist <= 8) prob = 60 + Math.round(Math.random() * 15);
    524      else if (dist <= 15) prob = 25 + Math.round(Math.random() * 10);
    525      else if (dist <= 22) prob = 5 + Math.round(Math.random() * 5);
    526      else prob = 0;
    527
    

apps/oshun/web/src/components/domains/nyx/sonification/SonificationDashboard.tsx#

  • L58

    ts
    56                  '--bar-index': i,
    57                  '--bar-color': accentColor,
    58                  '--bar-height': `${20 + Math.sin(i * 0.7) * 15 + Math.random() * 10}px`,
    59                } as CSSProperties
    60              }
    

apps/oshun/web/src/components/domains/tara/BreathworkTimer.tsx#

  • L364

    ts
    362      id: i,
    363      color: colors[i % colors.length] ?? ACCENT,
    364      x: Math.random() * 300 - 150,
    365      delay: Math.random() * 0.4,
    366      duration: 1.5 + Math.random() * 1,
    
  • L365

    ts
    363      color: colors[i % colors.length] ?? ACCENT,
    364      x: Math.random() * 300 - 150,
    365      delay: Math.random() * 0.4,
    366      duration: 1.5 + Math.random() * 1,
    367      size: 4 + Math.random() * 6,
    
  • L366

    ts
    364      x: Math.random() * 300 - 150,
    365      delay: Math.random() * 0.4,
    366      duration: 1.5 + Math.random() * 1,
    367      size: 4 + Math.random() * 6,
    368      rotation: Math.random() * 360,
    
  • L367

    ts
    365      delay: Math.random() * 0.4,
    366      duration: 1.5 + Math.random() * 1,
    367      size: 4 + Math.random() * 6,
    368      rotation: Math.random() * 360,
    369    }));
    
  • L368

    ts
    366      duration: 1.5 + Math.random() * 1,
    367      size: 4 + Math.random() * 6,
    368      rotation: Math.random() * 360,
    369    }));
    370
    

apps/oshun/web/src/components/domains/tara/SessionPlayer.tsx#

  • L553

    ts
    551      id: i,
    552      color: colors[i % colors.length] ?? accent,
    553      x: Math.random() * 300 - 150,
    554      delay: Math.random() * 0.4,
    555      duration: 1.5 + Math.random() * 1,
    
  • L554

    ts
    552      color: colors[i % colors.length] ?? accent,
    553      x: Math.random() * 300 - 150,
    554      delay: Math.random() * 0.4,
    555      duration: 1.5 + Math.random() * 1,
    556      size: 4 + Math.random() * 6,
    
  • L555

    ts
    553      x: Math.random() * 300 - 150,
    554      delay: Math.random() * 0.4,
    555      duration: 1.5 + Math.random() * 1,
    556      size: 4 + Math.random() * 6,
    557      rotation: Math.random() * 360,
    
  • L556

    ts
    554      delay: Math.random() * 0.4,
    555      duration: 1.5 + Math.random() * 1,
    556      size: 4 + Math.random() * 6,
    557      rotation: Math.random() * 360,
    558    }));
    
  • L557

    ts
    555      duration: 1.5 + Math.random() * 1,
    556      size: 4 + Math.random() * 6,
    557      rotation: Math.random() * 360,
    558    }));
    559
    

apps/oshun/web/src/components/domains/tara/TaraCourseDetail.tsx#

  • L220

    ts
    218            style={{
    219              position: 'absolute',
    220              left: `${10 + Math.random() * 80}%`,
    221              top: `${-5 - Math.random() * 10}%`,
    222              width: 6 + Math.random() * 4,
    
  • L221

    ts
    219              position: 'absolute',
    220              left: `${10 + Math.random() * 80}%`,
    221              top: `${-5 - Math.random() * 10}%`,
    222              width: 6 + Math.random() * 4,
    223              height: 6 + Math.random() * 4,
    
  • L222

    ts
    220              left: `${10 + Math.random() * 80}%`,
    221              top: `${-5 - Math.random() * 10}%`,
    222              width: 6 + Math.random() * 4,
    223              height: 6 + Math.random() * 4,
    224              borderRadius: Math.random() > 0.5 ? '50%' : '2px',
    
  • L223

    ts
    221              top: `${-5 - Math.random() * 10}%`,
    222              width: 6 + Math.random() * 4,
    223              height: 6 + Math.random() * 4,
    224              borderRadius: Math.random() > 0.5 ? '50%' : '2px',
    225              background: burstColors[i % burstColors.length],
    
  • L224

    ts
    222              width: 6 + Math.random() * 4,
    223              height: 6 + Math.random() * 4,
    224              borderRadius: Math.random() > 0.5 ? '50%' : '2px',
    225              background: burstColors[i % burstColors.length],
    226              animation: `tcd-confetti-fall ${1.5 + Math.random() * 1.5}s ease ${Math.random() * 0.5}s both`,
    
  • L226

    ts
    224              borderRadius: Math.random() > 0.5 ? '50%' : '2px',
    225              background: burstColors[i % burstColors.length],
    226              animation: `tcd-confetti-fall ${1.5 + Math.random() * 1.5}s ease ${Math.random() * 0.5}s both`,
    227            }}
    228          />
    

apps/oshun/web/src/components/domains/tara/TaraCourses.tsx#

  • L648

    ts
    646            style={{
    647              position: 'absolute',
    648              left: `${10 + Math.random() * 80}%`,
    649              top: `${-5 - Math.random() * 10}%`,
    650              width: 6 + Math.random() * 4,
    
  • L649

    ts
    647              position: 'absolute',
    648              left: `${10 + Math.random() * 80}%`,
    649              top: `${-5 - Math.random() * 10}%`,
    650              width: 6 + Math.random() * 4,
    651              height: 6 + Math.random() * 4,
    
  • L650

    ts
    648              left: `${10 + Math.random() * 80}%`,
    649              top: `${-5 - Math.random() * 10}%`,
    650              width: 6 + Math.random() * 4,
    651              height: 6 + Math.random() * 4,
    652              borderRadius: Math.random() > 0.5 ? '50%' : '2px',
    
  • L651

    ts
    649              top: `${-5 - Math.random() * 10}%`,
    650              width: 6 + Math.random() * 4,
    651              height: 6 + Math.random() * 4,
    652              borderRadius: Math.random() > 0.5 ? '50%' : '2px',
    653              background: colors[i % colors.length],
    
  • L652

    ts
    650              width: 6 + Math.random() * 4,
    651              height: 6 + Math.random() * 4,
    652              borderRadius: Math.random() > 0.5 ? '50%' : '2px',
    653              background: colors[i % colors.length],
    654              animation: `tc-confetti-fall ${1.5 + Math.random() * 1.5}s ease ${Math.random() * 0.5}s both`,
    
  • L654

    ts
    652              borderRadius: Math.random() > 0.5 ? '50%' : '2px',
    653              background: colors[i % colors.length],
    654              animation: `tc-confetti-fall ${1.5 + Math.random() * 1.5}s ease ${Math.random() * 0.5}s both`,
    655            }}
    656          />
    

apps/oshun/web/src/components/domains/tara/TaraTeacherProfile.tsx#

  • L127

    ts
    125      id: `${teacherId}-review-${i}`,
    126      userName: name,
    127      rating: 4.5 + Math.round(Math.random() * 5) / 10,
    128      text: texts[i],
    129      date: `2025-${String(12 - i).padStart(2, '0')}-${String(10 + i).padStart(2, '0')}`,
    
  • L143

    ts
    141    return days.map((day) => ({
    142      day,
    143      available: Math.random() > 0.3,
    144    }));
    145  }
    

apps/oshun/web/src/components/domains/veritas/VeritasArticleAnalyzer.tsx#

  • L777

    ts
    775      setTimeout(() => {
    776        // Pick a random article to simulate analysis result
    777        const idx = Math.floor(Math.random() * SAMPLE_ARTICLES.length);
    778        setSelectedArticle({ ...SAMPLE_ARTICLES[idx], url: urlInput });
    779        setAnalyzing(false);
    

apps/oshun/web/src/components/domains/veritas/VeritasClaimChecker.tsx#

  • L1937

    ts
    1935      const particles: ConfettiParticle[] = Array.from({ length: 30 }, (_, i) => ({
    1936        id: i,
    1937        left: 20 + Math.random() * 60,
    1938        color: colors[Math.floor(Math.random() * colors.length)] ?? ACCENT,
    1939        delay: Math.random() * 0.5,
    
  • L1938

    ts
    1936        id: i,
    1937        left: 20 + Math.random() * 60,
    1938        color: colors[Math.floor(Math.random() * colors.length)] ?? ACCENT,
    1939        delay: Math.random() * 0.5,
    1940        size: 6 + Math.random() * 8,
    
  • L1939

    ts
    1937        left: 20 + Math.random() * 60,
    1938        color: colors[Math.floor(Math.random() * colors.length)] ?? ACCENT,
    1939        delay: Math.random() * 0.5,
    1940        size: 6 + Math.random() * 8,
    1941      }));
    
  • L1940

    ts
    1938        color: colors[Math.floor(Math.random() * colors.length)] ?? ACCENT,
    1939        delay: Math.random() * 0.5,
    1940        size: 6 + Math.random() * 8,
    1941      }));
    1942      setConfettiParticles(particles);
    

apps/oshun/web/src/components/domains/veritas/VeritasKnowledgeGraph.tsx#

  • L180

    ts
    178      const initial = nodes.map((n) => ({
    179        id: n.id,
    180        x: n.x * (width / 800) + (Math.random() - 0.5) * 20,
    181        y: n.y * (height / 600) + (Math.random() - 0.5) * 20,
    182        vx: 0,
    
  • L181

    ts
    179        id: n.id,
    180        x: n.x * (width / 800) + (Math.random() - 0.5) * 20,
    181        y: n.y * (height / 600) + (Math.random() - 0.5) * 20,
    182        vx: 0,
    183        vy: 0,
    

apps/oshun/web/src/components/domains/veritas/VeritasSourceDirectory.tsx#

  • L563

    ts
    561    const needleAngle = -90 + scoreRatio * 180;
    562
    563    const gradId = `arc-grad-${score}-${Math.random().toString(36).slice(2, 6)}`;
    564
    565    // Arc path (semicircle)
    

apps/oshun/web/src/components/onboarding/OnboardingWizard.tsx#

  • L3393

    ts
    3391
    3392      for (let index = 0; index < 60; index += 1) {
    3393        const angle = Math.random() * Math.PI * 2;
    3394        const speed = 2 + Math.random() * 5;
    3395        particles.push({
    
  • L3394

    ts
    3392      for (let index = 0; index < 60; index += 1) {
    3393        const angle = Math.random() * Math.PI * 2;
    3394        const speed = 2 + Math.random() * 5;
    3395        particles.push({
    3396          x: cx,
    
  • L3400

    ts
    3398          vx: Math.cos(angle) * speed,
    3399          vy: Math.sin(angle) * speed - 2,
    3400          size: 4 + Math.random() * 6,
    3401          color: colors[Math.floor(Math.random() * colors.length)] ?? tokens.domainAccents.tara,
    3402          rotation: Math.random() * Math.PI * 2,
    
  • L3401

    ts
    3399          vy: Math.sin(angle) * speed - 2,
    3400          size: 4 + Math.random() * 6,
    3401          color: colors[Math.floor(Math.random() * colors.length)] ?? tokens.domainAccents.tara,
    3402          rotation: Math.random() * Math.PI * 2,
    3403          rotSpeed: (Math.random() - 0.5) * 0.2,
    
  • L3402

    ts
    3400          size: 4 + Math.random() * 6,
    3401          color: colors[Math.floor(Math.random() * colors.length)] ?? tokens.domainAccents.tara,
    3402          rotation: Math.random() * Math.PI * 2,
    3403          rotSpeed: (Math.random() - 0.5) * 0.2,
    3404          life: 1,
    
  • L3403

    ts
    3401          color: colors[Math.floor(Math.random() * colors.length)] ?? tokens.domainAccents.tara,
    3402          rotation: Math.random() * Math.PI * 2,
    3403          rotSpeed: (Math.random() - 0.5) * 0.2,
    3404          life: 1,
    3405          decay: 0.008 + Math.random() * 0.012,
    
  • L3405

    ts
    3403          rotSpeed: (Math.random() - 0.5) * 0.2,
    3404          life: 1,
    3405          decay: 0.008 + Math.random() * 0.012,
    3406          shape:
    3407            (['square', 'circle', 'triangle'] as const)[Math.floor(Math.random() * 3)] ?? 'square',
    
  • L3407

    ts
    3405          decay: 0.008 + Math.random() * 0.012,
    3406          shape:
    3407            (['square', 'circle', 'triangle'] as const)[Math.floor(Math.random() * 3)] ?? 'square',
    3408        });
    3409      }
    

apps/oshun/web/src/components/routines/RoutineExecutionUI.tsx#

  • L876

    ts
    874          {Array.from({ length: 12 }).map((_, i) => {
    875            const colors = ['#fbbf24', '#67E8F9', '#34D399', '#a78bfa', '#fb7185', '#38bdf8'];
    876            const cx = (Math.random() * 200 - 100).toFixed(0);
    877            const cy = (Math.random() * -120 - 20).toFixed(0);
    878            return (
    
  • L877

    ts
    875            const colors = ['#fbbf24', '#67E8F9', '#34D399', '#a78bfa', '#fb7185', '#38bdf8'];
    876            const cx = (Math.random() * 200 - 100).toFixed(0);
    877            const cy = (Math.random() * -120 - 20).toFixed(0);
    878            return (
    879              <div
    

apps/oshun/web/src/components/search/SearchResultsView.tsx#

  • L4592

    ts
    4590            {/* Title skeleton */}
    4591            <SkeletonBar
    4592              width={200 + Math.random() * 200}
    4593              height={16}
    4594              disableAnimation={disableAnimation}
    

apps/oshun/web/src/components/studio/StudioAccessibilityGovernanceWorkspace.tsx#

  • L497

    ts
    495        {
    496          ...entry,
    497          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    498        },
    499      ]);
    

apps/oshun/web/src/components/studio/StudioActivityChangeFeedsWorkspace.tsx#

  • L390

    ts
    388        {
    389          ...entry,
    390          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    391        },
    392      ]);
    

apps/oshun/web/src/components/studio/StudioApiGatewayBffCompositionWorkspace.tsx#

  • L511

    ts
    509        {
    510          ...entry,
    511          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    512        },
    513      ]);
    

apps/oshun/web/src/components/studio/StudioAssetPreviewPipelineWorkspace.tsx#

  • L419

    ts
    417        {
    418          ...entry,
    419          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    420        },
    421      ]);
    
  • L633

    ts
    631      const span = startStudioAssetPreviewPipelineFlowSpan(flow, telemetryContext);
    632      const previousState = previews.map((entry) => ({ ...entry }));
    633      const createdPreviewId = `prv-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    634
    635      setFlow(flow, {
    

apps/oshun/web/src/components/studio/StudioAuditComplianceSurfacesWorkspace.tsx#

  • L178

    ts
    176        {
    177          ...entry,
    178          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    179        },
    180      ]);
    

apps/oshun/web/src/components/studio/StudioAuthenticationArchitectureWorkspace.tsx#

  • L165

    ts
    163        {
    164          ...entry,
    165          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    166        },
    167      ]);
    

apps/oshun/web/src/components/studio/StudioBackgroundJobsProgressUxWorkspace.tsx#

  • L488

    ts
    486        {
    487          ...entry,
    488          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    489        },
    490      ]);
    
  • L814

    ts
    812      const span = startStudioBackgroundJobsProgressUxFlowSpan(flow, telemetryContext);
    813      const previousState = jobs.map((entry) => ({ ...entry }));
    814      const createdJobId = `job-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    815
    816      setFlow(flow, {
    
  • L828

    ts
    826            jobId: createdJobId,
    827            workflowId: `wf-${context.workspaceId.trim()}-${Date.now()}`,
    828            correlationId: `corr-${Math.random().toString(36).slice(2, 10)}`,
    829            workloadRef: context.workloadRef.trim(),
    830            sourceDomain: selectedJob?.sourceDomain ?? 'oshun',
    

apps/oshun/web/src/components/studio/StudioBackupDisasterRecoveryUxWorkspace.tsx#

  • L613

    ts
    611        {
    612          ...entry,
    613          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    614        },
    615      ]);
    

apps/oshun/web/src/components/studio/StudioBellonaAssetInterchangeFormatsWorkspace.tsx#

  • L1261

    ts
    1259          ...previous.slice(-11),
    1260          {
    1261            sampleId: `obs-${Date.now()}-${Math.random().toString(36).slice(2, 5)}`,
    1262            at: toUtcClockLabel(),
    1263            ...next,
    
  • L1311

    ts
    1309      setTelemetryEvents((previous) => [
    1310        {
    1311          eventId: `telemetry-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1312          action,
    1313          outcome,
    
  • L1331

    ts
    1329      setChangeHistory((previous) => [
    1330        {
    1331          historyId: `format-history-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1332          occurredAt: new Date().toISOString(),
    1333          ...entry,
    

apps/oshun/web/src/components/studio/StudioBellonaBlenderBridgeCommandsWorkspace.tsx#

  • L1373

    ts
    1371      setChangeHistory((previous) => [
    1372        {
    1373          historyId: `history-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1374          occurredAt: new Date().toISOString(),
    1375          ...entry,
    

apps/oshun/web/src/components/studio/StudioBellonaBridgeProtocolAndSessionsWorkspace.tsx#

  • L1295

    ts
    1293      setChangeHistory((previous) => [
    1294        {
    1295          historyId: `session-history-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1296          occurredAt: new Date().toISOString(),
    1297          ...entry,
    

apps/oshun/web/src/components/studio/StudioBellonaBuildTemplatesWorkspace.tsx#

  • L855

    ts
    853    ): void => {
    854      const entry: BuildTemplateTelemetryEvent = {
    855        eventId: `telemetry-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    856        at: new Date().toISOString(),
    857        action,
    
  • L2180

    ts
    2178                  typeof comment.commentId === 'string' && comment.commentId.trim().length > 0
    2179                    ? comment.commentId
    2180                    : `import-comment-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    2181                templateId: comment.templateId,
    2182                author:
    
  • L2374

    ts
    2372              return record;
    2373            }
    2374            const delta = Math.round(Math.random() * 16) - 6;
    2375            const nextLag = Math.max(24, Math.min(260, record.streamLagMs + delta));
    2376            return {
    

apps/oshun/web/src/components/studio/StudioBellonaBuildToExportOrchestrationWorkspace.tsx#

  • L1620

    ts
    1618      const windowMultiplier =
    1619        observabilityWindow === '15m' ? 0.55 : observabilityWindow === '24h' ? 1.45 : 1;
    1620      const varianceSeed = Math.random() * 8 - 4;
    1621      setLatencySeriesMs((previous) => [
    1622        ...previous.slice(-4),
    
  • L2208

    ts
    2206              return record;
    2207            }
    2208            const delta = Math.floor(Math.random() * 19) - 9;
    2209            const nextLag = Math.max(24, Math.min(280, record.streamLagMs + delta));
    2210            return {
    

apps/oshun/web/src/components/studio/StudioBellonaCliSurfacesWorkspace.tsx#

  • L1047

    ts
    1045    ): void => {
    1046      const nextEntry: CliSurfacesAuditEntry = {
    1047        entryId: `cli-audit-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1048        action,
    1049        actor: policyRole,
    
  • L1066

    ts
    1064    ): void => {
    1065      const nextEntry: CliSurfacesChangeHistoryEntry = {
    1066        changeId: `cli-change-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1067        action,
    1068        target,
    
  • L1082

    ts
    1080    ): void => {
    1081      const nextEvent: CliSurfacesTelemetryEvent = {
    1082        eventId: `cli-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1083        action,
    1084        outcome,
    

apps/oshun/web/src/components/studio/StudioBellonaContentAddressableBuildCacheWorkspace.tsx#

  • L784

    ts
    782    ): void => {
    783      const event: BuildCacheTelemetryEvent = {
    784        eventId: `cache-telemetry-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    785        at: new Date().toISOString(),
    786        action,
    
  • L2132

    ts
    2130                  typeof comment.commentId === 'string' && comment.commentId.trim().length > 0
    2131                    ? comment.commentId
    2132                    : `import-comment-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    2133                cacheKey: comment.cacheKey,
    2134                author:
    
  • L2322

    ts
    2320              return record;
    2321            }
    2322            const delta = Math.round(Math.random() * 14) - 5;
    2323            const nextLag = Math.max(24, Math.min(280, record.streamLagMs + delta));
    2324            return {
    

apps/oshun/web/src/components/studio/StudioBellonaCppSdkWorkspace.tsx#

  • L1050

    ts
    1048    const captureReversibleSnapshot = (label: string): void => {
    1049      const snapshot: CppSdkReversibleSnapshot = {
    1050        snapshotId: `cpp-sdk-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1051        atIso: new Date().toISOString(),
    1052        label,
    
  • L1087

    ts
    1085      setAuditTrail((current) => [
    1086        {
    1087          entryId: `cpp-sdk-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1088          atIso: new Date().toISOString(),
    1089          actor: operatorRole,
    
  • L1103

    ts
    1101      setChangeHistory((current) => [
    1102        {
    1103          changeId: `cpp-sdk-change-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1104          atIso: new Date().toISOString(),
    1105          summary,
    
  • L1121

    ts
    1119      setTelemetryEvents((current) => [
    1120        {
    1121          eventId: `cpp-sdk-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1122          atIso: new Date().toISOString(),
    1123          eventName,
    
  • L1655

    ts
    1653        [
    1654          {
    1655            eventId: `cpp-sdk-stream-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1656            recordId: activeRecordId,
    1657            summary: `Stream tick updated ${activeRecordId}.`,
    
  • L1723

    ts
    1721          [
    1722            {
    1723              eventId: `cpp-sdk-stream-reconnect-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1724              recordId,
    1725              summary: `Reconnect completed for ${recordId}.`,
    
  • L1863

    ts
    1861
    1862      const nextComment: CppSdkCollaborationComment = {
    1863        commentId: `cpp-sdk-collab-comment-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1864        recordId: selectedRecord.recordId,
    1865        author: trimmedAuthor,
    

apps/oshun/web/src/components/studio/StudioBellonaCrossDomainAssetIngestionWorkspace.tsx#

  • L1017

    ts
    1015    ): void => {
    1016      const nextEntry: CrossDomainAssetIngestionAuditEntry = {
    1017        entryId: `cross-domain-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1018        action,
    1019        actor: policyRole,
    
  • L1034

    ts
    1032    ): void => {
    1033      const nextEvent: CrossDomainAssetIngestionTelemetryEvent = {
    1034        eventId: `cross-domain-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1035        action,
    1036        outcome,
    
  • L1046

    ts
    1044    const captureReversibleSnapshot = (action: string): void => {
    1045      const snapshot: CrossDomainAssetIngestionReversibleSnapshot = {
    1046        snapshotId: `cross-domain-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1047        action,
    1048        records: records.map((record) => ({ ...record })),
    
  • L1951

    ts
    1949      const mentions = [...message.matchAll(/@([a-z0-9-_]+)/gi)].map((match) => match[1] ?? '');
    1950      const nextComment: CrossDomainAssetIngestionCollaborationComment = {
    1951        commentId: `cross-domain-collab-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1952        recordId: activeRecord.recordId,
    1953        author: 'ingestion-operator',
    

apps/oshun/web/src/components/studio/StudioBellonaDaVinciIntegrationWorkspace.tsx#

  • L1105

    ts
    1103    ): void => {
    1104      const nextEntry: DaVinciIntegrationAuditEntry = {
    1105        entryId: `dv-audit-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1106        action,
    1107        actor: policyRole,
    
  • L1124

    ts
    1122    ): void => {
    1123      const nextEntry: DaVinciIntegrationChangeHistoryEntry = {
    1124        changeId: `dv-change-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1125        action,
    1126        target,
    
  • L1191

    ts
    1189    ): void => {
    1190      const nextEvent: DaVinciIntegrationTelemetryEvent = {
    1191        eventId: `dv-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1192        action,
    1193        outcome,
    

apps/oshun/web/src/components/studio/StudioBellonaEngineSynchronizationWorkspace.tsx#

  • L1011

    ts
    1009      const baseline = baselineByWindow[observabilityWindow];
    1010      setObservabilityMetrics({
    1011        p95Latency: 58 + baseline * 6 + Math.floor(Math.random() * 8),
    1012        failureRate: Number((0.7 + baseline * 0.4 + Math.random() * 0.3).toFixed(2)),
    1013        throughputPerHour: 120 + baseline * 24 + Math.floor(Math.random() * 15),
    
  • L1012

    ts
    1010      setObservabilityMetrics({
    1011        p95Latency: 58 + baseline * 6 + Math.floor(Math.random() * 8),
    1012        failureRate: Number((0.7 + baseline * 0.4 + Math.random() * 0.3).toFixed(2)),
    1013        throughputPerHour: 120 + baseline * 24 + Math.floor(Math.random() * 15),
    1014        costPerHour: Number((82 + baseline * 4.5 + Math.random() * 3.2).toFixed(2)),
    
  • L1013

    ts
    1011        p95Latency: 58 + baseline * 6 + Math.floor(Math.random() * 8),
    1012        failureRate: Number((0.7 + baseline * 0.4 + Math.random() * 0.3).toFixed(2)),
    1013        throughputPerHour: 120 + baseline * 24 + Math.floor(Math.random() * 15),
    1014        costPerHour: Number((82 + baseline * 4.5 + Math.random() * 3.2).toFixed(2)),
    1015      });
    
  • L1014

    ts
    1012        failureRate: Number((0.7 + baseline * 0.4 + Math.random() * 0.3).toFixed(2)),
    1013        throughputPerHour: 120 + baseline * 24 + Math.floor(Math.random() * 15),
    1014        costPerHour: Number((82 + baseline * 4.5 + Math.random() * 3.2).toFixed(2)),
    1015      });
    1016      setObservabilityNotice(`Observability refreshed for ${observabilityWindow} window.`);
    
  • L1934

    ts
    1932              return record;
    1933            }
    1934            const delta = Math.floor(Math.random() * 19) - 9;
    1935            const nextLag = Math.max(24, Math.min(240, record.lagMs + delta));
    1936            return {
    

apps/oshun/web/src/components/studio/StudioBellonaExportPipelineWorkspace.tsx#

  • L1778

    ts
    1776      const windowMultiplier =
    1777        observabilityWindow === '15m' ? 0.55 : observabilityWindow === '24h' ? 1.45 : 1;
    1778      const varianceSeed = Math.random() * 8 - 4;
    1779      setLatencySeriesMs((previous) => [
    1780        ...previous.slice(-4),
    
  • L2145

    ts
    2143              return record;
    2144            }
    2145            const delta = Math.round(Math.random() * 14) - 5;
    2146            const nextLag = Math.max(24, Math.min(280, record.streamLagMs + delta));
    2147            return {
    

apps/oshun/web/src/components/studio/StudioBellonaFormatRegistryWorkspace.tsx#

  • L1192

    ts
    1190      setTelemetryEvents((previous) => [
    1191        {
    1192          eventId: `fmt-telemetry-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1193          action,
    1194          outcome,
    
  • L1212

    ts
    1210      setChangeHistory((previous) => [
    1211        {
    1212          historyId: `fmt-history-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1213          occurredAt: new Date().toISOString(),
    1214          ...entry,
    
  • L2427

    ts
    2425          ...previous.slice(-11),
    2426          {
    2427            sampleId: `fmt-observability-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    2428            at: new Date().toISOString(),
    2429            ...next,
    

apps/oshun/web/src/components/studio/StudioBellonaGameplayRuntimeAiBehaviorWorkspace.tsx#

  • L953

    ts
    951    ): void => {
    952      const nextEntry: GameplayRuntimeAiBehaviorAuditEntry = {
    953        entryId: `ai-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    954        action,
    955        actor: policyRole,
    
  • L970

    ts
    968    ): void => {
    969      const nextEvent: GameplayRuntimeAiBehaviorTelemetryEvent = {
    970        eventId: `ai-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    971        action,
    972        outcome,
    
  • L981

    ts
    979    const captureReversibleSnapshot = (action: string): void => {
    980      const snapshot: GameplayRuntimeAiBehaviorReversibleSnapshot = {
    981        snapshotId: `ai-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    982        action,
    983        records: records.map((record) => ({ ...record })),
    
  • L1306

    ts
    1304    const appendStreamEvent = (behaviorId: string, summary: string): void => {
    1305      const nextEvent: GameplayRuntimeAiBehaviorStreamEvent = {
    1306        eventId: `ai-stream-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1307        behaviorId,
    1308        summary,
    
  • L1539

    ts
    1537      );
    1538      const nextComment: GameplayRuntimeAiBehaviorCollaborationComment = {
    1539        commentId: `collab-comment-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1540        behaviorId: activeBehaviorId,
    1541        author: 'runtime-operator',
    

apps/oshun/web/src/components/studio/StudioBellonaGameplayRuntimeCombatWorkspace.tsx#

  • L878

    ts
    876    ): void => {
    877      const nextEntry: GameplayRuntimeCombatAuditEntry = {
    878        entryId: `combat-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    879        action,
    880        actor: policyRole,
    
  • L895

    ts
    893    ): void => {
    894      const nextEvent: GameplayRuntimeCombatTelemetryEvent = {
    895        eventId: `combat-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    896        action,
    897        outcome,
    
  • L906

    ts
    904    const captureReversibleSnapshot = (action: string): void => {
    905      const snapshot: GameplayRuntimeCombatReversibleSnapshot = {
    906        snapshotId: `combat-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    907        action,
    908        records: records.map((record) => ({ ...record })),
    

apps/oshun/web/src/components/studio/StudioBellonaGameplayRuntimeInputWorkspace.tsx#

  • L600

    ts
    598
    599  function uniqueId(prefix: string): string {
    600    return `${prefix}-${Math.random().toString(36).slice(2, 10)}`;
    601  }
    602
    

apps/oshun/web/src/components/studio/StudioBellonaGameplayRuntimeInventoryWorkspace.tsx#

  • L885

    ts
    883      setAuditTrail((previous) => [
    884        {
    885          entryId: `inventory-audit-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    886          action,
    887          actor: policyRole,
    
  • L911

    ts
    909      setTelemetryEvents((previous) => [
    910        {
    911          eventId: `inventory-telemetry-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    912          at: new Date().toISOString(),
    913          action,
    

apps/oshun/web/src/components/studio/StudioBellonaGameplayRuntimeSaveLoadWorkspace.tsx#

  • L745

    ts
    743
    744  function uniqueId(prefix: string): string {
    745    return `${prefix}-${Math.random().toString(36).slice(2, 10)}`;
    746  }
    747
    

apps/oshun/web/src/components/studio/StudioBellonaGodotBridgeCommandsWorkspace.tsx#

  • L1213

    ts
    1211      setChangeHistory((previous) => [
    1212        {
    1213          historyId: `history-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1214          occurredAt: new Date().toISOString(),
    1215          ...entry,
    

apps/oshun/web/src/components/studio/StudioBellonaHoudiniIntegrationWorkspace.tsx#

  • L1087

    ts
    1085    ): void => {
    1086      const nextEntry: HoudiniIntegrationAuditEntry = {
    1087        entryId: `hd-audit-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1088        action,
    1089        actor: policyRole,
    
  • L1106

    ts
    1104    ): void => {
    1105      const nextEntry: HoudiniIntegrationChangeHistoryEntry = {
    1106        changeId: `hd-change-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1107        action,
    1108        target,
    
  • L1129

    ts
    1127    ): void => {
    1128      const nextEvent: HoudiniIntegrationTelemetryEvent = {
    1129        eventId: `hd-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1130        action,
    1131        outcome,
    

apps/oshun/web/src/components/studio/StudioBellonaInterchangeAssetCacheWorkspace.tsx#

  • L1058

    ts
    1056      setChangeHistory((previous) => [
    1057        {
    1058          historyId: `cache-history-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1059          occurredAt: toUtcClockLabel(),
    1060          ...entry,
    
  • L1073

    ts
    1071      setTelemetryEvents((previous) => [
    1072        {
    1073          eventId: `cache-telemetry-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1074          at: toUtcClockLabel(),
    1075          action,
    
  • L2094

    ts
    2092          ...previous.slice(-11),
    2093          {
    2094            sampleId: `cache-obs-${Date.now()}-${Math.random().toString(36).slice(2, 5)}`,
    2095            at: toUtcClockLabel(),
    2096            ...next,
    

apps/oshun/web/src/components/studio/StudioBellonaInterchangeBatchConversionWorkspace.tsx#

  • L1195

    ts
    1193      setChangeHistory((previous) => [
    1194        {
    1195          historyId: `batch-history-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1196          occurredAt: toUtcClockLabel(),
    1197          ...entry,
    
  • L1210

    ts
    1208      setTelemetryEvents((previous) => [
    1209        {
    1210          eventId: `batch-telemetry-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1211          at: toUtcClockLabel(),
    1212          action,
    

apps/oshun/web/src/components/studio/StudioBellonaLiveEngineBridgesWorkspace.tsx#

  • L1153

    ts
    1151      setChangeHistory((previous) => [
    1152        {
    1153          historyId: `history-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1154          occurredAt: new Date().toISOString(),
    1155          ...entry,
    

apps/oshun/web/src/components/studio/StudioBellonaLoreToEngineCompilationWorkspace.tsx#

  • L1185

    ts
    1183    ): void => {
    1184      const nextEntry: LoreToEngineCompilationAuditEntry = {
    1185        entryId: `lore-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1186        action,
    1187        actor: policyRole,
    
  • L1203

    ts
    1201    ): void => {
    1202      const nextEntry: LoreToEngineCompilationChangeHistoryEntry = {
    1203        changeId: `lore-change-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1204        action,
    1205        target,
    
  • L1220

    ts
    1218    ): void => {
    1219      const nextEvent: LoreToEngineCompilationTelemetryEvent = {
    1220        eventId: `lore-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1221        action,
    1222        target,
    
  • L1481

    ts
    1479    const captureReversibleSnapshot = (action: string): void => {
    1480      const snapshot: LoreToEngineCompilationReversibleSnapshot = {
    1481        snapshotId: `lore-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1482        action,
    1483        records: records.map((record) => ({ ...record })),
    
  • L2136

    ts
    2134      const mentions = parseLoreToEngineCompilationMentions(message);
    2135      const nextComment: LoreToEngineCompilationCollaborationComment = {
    2136        commentId: `lore-collab-comment-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    2137        recordId: activeRecord.recordId,
    2138        author,
    

apps/oshun/web/src/components/studio/StudioBellonaMetaHumanPipelineWorkspace.tsx#

  • L1479

    ts
    1477      const windowMultiplier =
    1478        observabilityWindow === '15m' ? 0.7 : observabilityWindow === '24h' ? 1.35 : 1;
    1479      const variance = Math.random() * 12 - 6;
    1480      const nextSample: MetaHumanPipelineObservabilitySample = {
    1481        sampleId: `metahuman-obs-${Date.now()}`,
    
  • L2555

    ts
    2553              return record;
    2554            }
    2555            const lagDelta = Math.round(Math.random() * 18) - 6;
    2556            const nextLag = Math.max(24, Math.min(340, record.streamLagMs + lagDelta));
    2557            return {
    

apps/oshun/web/src/components/studio/StudioBellonaMetaQuestFeaturesWorkspace.tsx#

  • L929

    ts
    927    ): void => {
    928      const nextEntry: MetaQuestAuditEntry = {
    929        entryId: `metaquest-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    930        action,
    931        actor: policyRole,
    
  • L946

    ts
    944    ): void => {
    945      const nextEvent: MetaQuestTelemetryEvent = {
    946        eventId: `metaquest-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    947        action,
    948        outcome,
    
  • L958

    ts
    956    const captureReversibleSnapshot = (action: string): void => {
    957      const snapshot: MetaQuestReversibleSnapshot = {
    958        snapshotId: `metaquest-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    959        action,
    960        records: records.map((record) => ({ ...record })),
    
  • L1701

    ts
    1699    ): void => {
    1700      const nextEvent: MetaQuestStreamEvent = {
    1701        eventId: `metaquest-stream-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1702        featureId,
    1703        summary,
    
  • L1989

    ts
    1987      captureReversibleSnapshot('collaboration comment add');
    1988      const nextComment: MetaQuestCollaborationComment = {
    1989        commentId: `metaquest-collab-comment-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1990        featureId: activeRecord.featureId,
    1991        author: activeCollaboration.assignee || activeRecord.owner,
    

apps/oshun/web/src/components/studio/StudioBellonaMotionCaptureSkeletonManagementWorkspace.tsx#

  • L1130

    ts
    1128    ): void => {
    1129      const entry: SkeletonAuditEntry = {
    1130        entryId: `skeleton-audit-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    1131        action,
    1132        target,
    
  • L1143

    ts
    1141      (action: string, outcome: SkeletonTelemetryOutcome, detail?: string): void => {
    1142        const event: SkeletonTelemetryEvent = {
    1143          eventId: `skeleton-telemetry-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    1144          action,
    1145          outcome,
    
  • L1157

    ts
    1155    const captureReversibleSnapshot = (action: string): void => {
    1156      const snapshot: SkeletonReversibleSnapshot = {
    1157        snapshotId: `skeleton-snapshot-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    1158        action,
    1159        records: records.map((record) => ({
    
  • L1881

    ts
    1879    const appendStreamEvent = (skeletonId: string, message: string): void => {
    1880      const event: SkeletonStreamEvent = {
    1881        eventId: `skeleton-stream-event-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    1882        skeletonId,
    1883        message,
    
  • L2172

    ts
    2170      );
    2171      const comment: SkeletonCollaborationComment = {
    2172        commentId: `skeleton-comment-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    2173        skeletonId: focusedRecord.skeletonId,
    2174        author: 'skeleton-operator',
    

apps/oshun/web/src/components/studio/StudioBellonaMotionCaptureStreamingWorkspace.tsx#

  • L991

    ts
    989    ): void => {
    990      const entry: MotionCaptureStreamingAuditEntry = {
    991        entryId: `mocap-audit-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    992        action,
    993        target,
    
  • L1007

    ts
    1005    ): void => {
    1006      const event: MotionCaptureStreamingTelemetryEvent = {
    1007        eventId: `mocap-telemetry-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    1008        action,
    1009        outcome,
    
  • L1018

    ts
    1016    const captureReversibleSnapshot = (action: string): void => {
    1017      const snapshot: MotionCaptureStreamingReversibleSnapshot = {
    1018        snapshotId: `mocap-snapshot-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    1019        action,
    1020        records: records.map((record) => ({ ...record })),
    
  • L1726

    ts
    1724    const appendStreamEvent = (streamId: string, summary: string): void => {
    1725      const nextEvent: MotionCaptureStreamingStreamEvent = {
    1726        eventId: `stream-event-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    1727        streamId,
    1728        summary,
    
  • L1983

    ts
    1981      );
    1982      const comment: MotionCaptureStreamingCollaborationComment = {
    1983        commentId: `mocap-comment-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    1984        streamId: activeStreamId,
    1985        author: 'mocap-operator',
    

apps/oshun/web/src/components/studio/StudioBellonaMotionRetargetingWorkspace.tsx#

  • L1090

    ts
    1088          [
    1089            {
    1090              entryId: `motion-retargeting-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1091              action,
    1092              actor: policyRole,
    
  • L1117

    ts
    1115          [
    1116            {
    1117              changeId: `motion-retargeting-change-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1118              action,
    1119              target,
    
  • L1137

    ts
    1135          [
    1136            {
    1137              eventId: `motion-retargeting-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1138              action,
    1139              outcome,
    
  • L1524

    ts
    1522
    1523    const captureReversibleSnapshot = (action: string, target: string): string => {
    1524      const snapshotId = `motion-retargeting-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`;
    1525      const snapshot: MotionRetargetingReversibleSnapshot = {
    1526        snapshotId,
    

apps/oshun/web/src/components/studio/StudioBellonaOpenUsdLayerCompositionWorkspace.tsx#

  • L763

    ts
    761
    762  function createOpenUsdLayerCompositionId(prefix: string): string {
    763    return `${prefix}-${Math.random().toString(36).slice(2, 10)}`;
    764  }
    765
    
  • L2221

    ts
    2219              };
    2220            }
    2221            const lagDelta = Math.round(Math.random() * 20) - 10;
    2222            const nextLag = Math.max(24, Math.min(340, record.streamLagMs + lagDelta));
    2223            return {
    

apps/oshun/web/src/components/studio/StudioBellonaOpenUsdMaterialXWorkspace.tsx#

  • L719

    ts
    717  function createOpenUsdMaterialXId(prefix: string): string {
    718    const timestamp = Date.now().toString(36);
    719    const random = Math.random().toString(36).slice(2, 8);
    720    return `${prefix}-${timestamp}-${random}`;
    721  }
    
  • L2212

    ts
    2210              };
    2211            }
    2212            const lagDelta = Math.round(Math.random() * 20) - 10;
    2213            const nextLag = Math.max(20, Math.min(340, record.streamLagMs + lagDelta));
    2214            return {
    

apps/oshun/web/src/components/studio/StudioBellonaOpenUsdStageManagementWorkspace.tsx#

  • L765

    ts
    763
    764  function createOpenUsdStageManagementId(prefix: string): string {
    765    return `${prefix}-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`;
    766  }
    767
    
  • L2402

    ts
    2400              };
    2401            }
    2402            const lagDelta = Math.round(Math.random() * 18) - 6;
    2403            const nextLag = Math.max(24, Math.min(340, record.streamLagMs + lagDelta));
    2404            return {
    

apps/oshun/web/src/components/studio/StudioBellonaOpenUsdVariantManagementWorkspace.tsx#

  • L760

    ts
    758
    759  function createOpenUsdVariantManagementId(prefix: string): string {
    760    return `${prefix}-${Math.random().toString(36).slice(2, 10)}`;
    761  }
    762
    
  • L2225

    ts
    2223              };
    2224            }
    2225            const lagDelta = Math.round(Math.random() * 20) - 10;
    2226            const nextLag = Math.max(20, Math.min(340, record.streamLagMs + lagDelta));
    2227            return {
    

apps/oshun/web/src/components/studio/StudioBellonaRecordingAndPlaybackWorkspace.tsx#

  • L1094

    ts
    1092        [
    1093          {
    1094            entryId: `recording-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1095            action,
    1096            actor: policyRole,
    
  • L1118

    ts
    1116        [
    1117          {
    1118            changeId: `recording-change-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1119            action,
    1120            target,
    
  • L1139

    ts
    1137        [
    1138          {
    1139            eventId: `recording-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1140            action,
    1141            outcome,
    
  • L1525

    ts
    1523
    1524    const captureReversibleSnapshot = (action: string, target: string): string => {
    1525      const snapshotId = `recording-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`;
    1526      const snapshot: RecordingAndPlaybackReversibleSnapshot = {
    1527        snapshotId,
    

apps/oshun/web/src/components/studio/StudioBellonaRenderQueueManagementWorkspace.tsx#

  • L1027

    ts
    1025    const captureReversibleSnapshot = (label: string): void => {
    1026      const snapshot: RenderQueueReversibleSnapshot = {
    1027        snapshotId: `snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1028        atIso: new Date().toISOString(),
    1029        label,
    
  • L1061

    ts
    1059      setAuditTrail((previous) => [
    1060        {
    1061          entryId: `audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1062          atIso: new Date().toISOString(),
    1063          actor: operatorRole,
    
  • L1077

    ts
    1075      setChangeHistory((previous) => [
    1076        {
    1077          changeId: `change-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1078          atIso: new Date().toISOString(),
    1079          summary,
    
  • L1095

    ts
    1093      setTelemetryEvents((previous) => [
    1094        {
    1095          eventId: `telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1096          atIso: new Date().toISOString(),
    1097          eventName,
    
  • L2187

    ts
    2185            [
    2186              {
    2187                eventId: `stream-event-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    2188                queueId: selectedQueue.queueId,
    2189                summary:
    
  • L2240

    ts
    2238        [
    2239          {
    2240            eventId: `stream-reconnect-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    2241            queueId,
    2242            summary: 'Reconnect initiated for render queue stream lane.',
    
  • L2380

    ts
    2378
    2379      const nextComment: RenderQueueCollaborationComment = {
    2380        commentId: `collab-comment-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    2381        queueId: selectedQueue.queueId,
    2382        author: trimmedAuthor,
    

apps/oshun/web/src/components/studio/StudioBellonaSharedXrCapabilitiesWorkspace.tsx#

  • L960

    ts
    958    ): void => {
    959      const entry: SharedXrAuditEntry = {
    960        entryId: `sharedxr-audit-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    961        action,
    962        target,
    
  • L972

    ts
    970    const captureReversibleSnapshot = (action: string): void => {
    971      const snapshot: SharedXrReversibleSnapshot = {
    972        snapshotId: `sharedxr-snapshot-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    973        action,
    974        records: records.map((record) => ({ ...record })),
    
  • L1001

    ts
    999    ): void => {
    1000      const event: SharedXrTelemetryEvent = {
    1001        eventId: `sharedxr-telemetry-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    1002        action,
    1003        outcome,
    
  • L1321

    ts
    1319    const appendStreamEvent = (capabilityId: string, summary: string): void => {
    1320      const nextEvent: SharedXrStreamEvent = {
    1321        eventId: `stream-event-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    1322        capabilityId,
    1323        summary,
    
  • L1576

    ts
    1574      );
    1575      const comment: SharedXrCollaborationComment = {
    1576        commentId: `sharedxr-comment-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    1577        capabilityId: activeCapabilityId,
    1578        author: 'shared-xr-operator',
    

apps/oshun/web/src/components/studio/StudioBellonaSyncConflictResolutionWorkspace.tsx#

  • L759

    ts
    757
    758  function uniqueId(prefix: string): string {
    759    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    760  }
    761
    
  • L1091

    ts
    1089      const baseline = baselineByWindow[observabilityWindow];
    1090      setObservabilityMetrics({
    1091        p95Latency: 64 + baseline * 8 + Math.floor(Math.random() * 7),
    1092        failureRate: Number((0.8 + baseline * 0.45 + Math.random() * 0.35).toFixed(2)),
    1093        throughputPerHour: 88 + baseline * 22 + Math.floor(Math.random() * 14),
    
  • L1092

    ts
    1090      setObservabilityMetrics({
    1091        p95Latency: 64 + baseline * 8 + Math.floor(Math.random() * 7),
    1092        failureRate: Number((0.8 + baseline * 0.45 + Math.random() * 0.35).toFixed(2)),
    1093        throughputPerHour: 88 + baseline * 22 + Math.floor(Math.random() * 14),
    1094        costPerHour: Number((66 + baseline * 4.1 + Math.random() * 2.8).toFixed(2)),
    
  • L1093

    ts
    1091        p95Latency: 64 + baseline * 8 + Math.floor(Math.random() * 7),
    1092        failureRate: Number((0.8 + baseline * 0.45 + Math.random() * 0.35).toFixed(2)),
    1093        throughputPerHour: 88 + baseline * 22 + Math.floor(Math.random() * 14),
    1094        costPerHour: Number((66 + baseline * 4.1 + Math.random() * 2.8).toFixed(2)),
    1095      });
    
  • L1094

    ts
    1092        failureRate: Number((0.8 + baseline * 0.45 + Math.random() * 0.35).toFixed(2)),
    1093        throughputPerHour: 88 + baseline * 22 + Math.floor(Math.random() * 14),
    1094        costPerHour: Number((66 + baseline * 4.1 + Math.random() * 2.8).toFixed(2)),
    1095      });
    1096      setObservabilityNotice(`Observability refreshed for ${observabilityWindow} window.`);
    
  • L2210

    ts
    2208              continue;
    2209            }
    2210            const delta = Math.floor(Math.random() * 19) - 9;
    2211            const nextLag = Math.max(24, Math.min(240, status.lagMs + delta));
    2212            next[conflictId] = {
    

apps/oshun/web/src/components/studio/StudioBellonaTypeScriptSdkWorkspace.tsx#

  • L1259

    ts
    1257        ...current.slice(-39),
    1258        {
    1259          entryId: `sdk-audit-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    1260          action,
    1261          actor: policyRole,
    
  • L1279

    ts
    1277        ...current.slice(-39),
    1278        {
    1279          changeId: `sdk-change-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    1280          action,
    1281          target,
    
  • L1296

    ts
    1294    ): void => {
    1295      const event: TypeScriptSdkTelemetryEvent = {
    1296        eventId: `sdk-telemetry-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    1297        action,
    1298        target,
    
  • L1926

    ts
    1924          ...current.slice(-39),
    1925          {
    1926            entryId: `sdk-audit-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    1927            action: 'stream.reconnect.settled',
    1928            actor: policyRole,
    
  • L1938

    ts
    1936          ...current.slice(-39),
    1937          {
    1938            changeId: `sdk-change-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    1939            action: 'stream.reconnect.settled',
    1940            target: reconnectRecordId,
    
  • L1949

    ts
    1947          ...current.slice(-79),
    1948          {
    1949            eventId: `sdk-telemetry-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    1950            action: 'stream.reconnect.settled',
    1951            target: reconnectRecordId,
    

apps/oshun/web/src/components/studio/StudioBellonaUnityBridgeCommandsWorkspace.tsx#

  • L1225

    ts
    1223      setChangeHistory((previous) => [
    1224        {
    1225          historyId: `history-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1226          occurredAt: new Date().toISOString(),
    1227          ...entry,
    

apps/oshun/web/src/components/studio/StudioBellonaUnrealBridgeCommandsWorkspace.tsx#

  • L1192

    ts
    1190      setChangeHistory((previous) => [
    1191        {
    1192          historyId: `history-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1193          occurredAt: new Date().toISOString(),
    1194          ...entry,
    

apps/oshun/web/src/components/studio/StudioBellonaVirtualProductionCameraTrackingWorkspace.tsx#

  • L996

    ts
    994    ): void => {
    995      const nextEntry: CameraTrackingAuditEntry = {
    996        entryId: `camera-tracking-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    997        action,
    998        actor: policyRole,
    
  • L1013

    ts
    1011    ): void => {
    1012      const nextEvent: CameraTrackingTelemetryEvent = {
    1013        eventId: `camera-tracking-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1014        action,
    1015        outcome,
    
  • L1353

    ts
    1351    const captureReversibleSnapshot = (action: string): void => {
    1352      const snapshot: CameraTrackingReversibleSnapshot = {
    1353        snapshotId: `camera-tracking-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1354        action,
    1355        records: records.map((record) => ({ ...record })),
    
  • L1675

    ts
    1673    const appendStreamEvent = (trackId: string, summary: string): void => {
    1674      const nextEvent: CameraTrackingStreamEvent = {
    1675        eventId: `camera-stream-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1676        trackId,
    1677        summary,
    
  • L1943

    ts
    1941      );
    1942      const nextComment: CameraTrackingCollaborationComment = {
    1943        commentId: `collab-comment-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1944        trackId: activeTrackId,
    1945        author: 'vp-operator',
    

apps/oshun/web/src/components/studio/StudioBellonaVirtualProductionGenlockTimecodeWorkspace.tsx#

  • L961

    ts
    959    ): void => {
    960      const nextEntry: GenlockAuditEntry = {
    961        entryId: `genlock-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    962        action,
    963        actor: policyRole,
    
  • L978

    ts
    976    ): void => {
    977      const nextEvent: GenlockTelemetryEvent = {
    978        eventId: `genlock-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    979        action,
    980        outcome,
    
  • L1314

    ts
    1312    const captureReversibleSnapshot = (action: string): void => {
    1313      const snapshot: GenlockReversibleSnapshot = {
    1314        snapshotId: `genlock-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1315        action,
    1316        records: records.map((record) => ({ ...record })),
    
  • L1598

    ts
    1596      }
    1597      const nextEvent: GenlockStreamEvent = {
    1598        eventId: `genlock-stream-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1599        sourceId,
    1600        summary: `Simulated stream tick for ${sourceId}.`,
    
  • L1685

    ts
    1683      const mentions = [...message.matchAll(/@([a-z0-9-_]+)/gi)].map((match) => match[1] ?? '');
    1684      const nextComment: GenlockCollaborationComment = {
    1685        commentId: `genlock-comment-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1686        sourceId: activeSourceId,
    1687        author: 'genlock-operator',
    

apps/oshun/web/src/components/studio/StudioBellonaVirtualProductionIcvfxWorkspace.tsx#

  • L968

    ts
    966    ): void => {
    967      const entry: IcvfxAuditEntry = {
    968        entryId: `icvfx-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    969        action,
    970        actor: policyRole,
    
  • L985

    ts
    983    ): void => {
    984      const event: IcvfxTelemetryEvent = {
    985        eventId: `icvfx-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    986        action,
    987        outcome,
    
  • L1297

    ts
    1295    const captureReversibleSnapshot = (action: string): void => {
    1296      const snapshot: IcvfxReversibleSnapshot = {
    1297        snapshotId: `icvfx-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1298        action,
    1299        records: records.map((record) => ({ ...record })),
    

apps/oshun/web/src/components/studio/StudioBellonaVirtualProductionLedWallWorkspace.tsx#

  • L996

    ts
    994    ): void => {
    995      const nextEntry: LedWallAuditEntry = {
    996        entryId: `led-wall-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    997        action,
    998        actor: policyRole,
    
  • L1013

    ts
    1011    ): void => {
    1012      const nextEvent: LedWallTelemetryEvent = {
    1013        eventId: `led-wall-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1014        action,
    1015        outcome,
    
  • L1347

    ts
    1345    const captureReversibleSnapshot = (action: string): void => {
    1346      const snapshot: LedWallReversibleSnapshot = {
    1347        snapshotId: `led-wall-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1348        action,
    1349        records: records.map((record) => ({ ...record })),
    

apps/oshun/web/src/components/studio/StudioBellonaVisionOsFeaturesWorkspace.tsx#

  • L912

    ts
    910    ): void => {
    911      const nextEntry: VisionAuditEntry = {
    912        entryId: `visionos-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    913        action,
    914        actor: policyRole,
    
  • L929

    ts
    927    ): void => {
    928      const nextEvent: VisionTelemetryEvent = {
    929        eventId: `visionos-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    930        action,
    931        outcome,
    
  • L941

    ts
    939    const captureReversibleSnapshot = (action: string): void => {
    940      const snapshot: VisionReversibleSnapshot = {
    941        snapshotId: `visionos-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    942        action,
    943        records: records.map((record) => ({ ...record })),
    
  • L1707

    ts
    1705    ): void => {
    1706      const nextEvent: VisionStreamEvent = {
    1707        eventId: `visionos-stream-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1708        featureId,
    1709        summary,
    
  • L2068

    ts
    2066        .filter((mention) => mention.length > 0);
    2067      const nextComment: VisionCollaborationComment = {
    2068        commentId: `visionos-collab-comment-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    2069        featureId: activeFeatureId,
    2070        author: 'visionos-collab-operator',
    

apps/oshun/web/src/components/studio/StudioBellonaXrPlatformSupportWorkspace.tsx#

  • L933

    ts
    931    ): void => {
    932      const nextEntry: XrAuditEntry = {
    933        entryId: `xr-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    934        action,
    935        actor: policyRole,
    
  • L950

    ts
    948    ): void => {
    949      const nextEvent: XrTelemetryEvent = {
    950        eventId: `xr-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    951        action,
    952        outcome,
    
  • L962

    ts
    960    const captureReversibleSnapshot = (action: string): void => {
    961      const snapshot: XrReversibleSnapshot = {
    962        snapshotId: `xr-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    963        action,
    964        records: records.map((record) => ({ ...record })),
    
  • L1762

    ts
    1760      }
    1761      const nextEvent: XrStreamEvent = {
    1762        eventId: `xr-stream-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1763        resourceId,
    1764        summary: `Simulated stream tick for ${resourceId}.`,
    
  • L1850

    ts
    1848      const mentions = [...message.matchAll(/@([a-z0-9-_]+)/gi)].map((match) => match[1] ?? '');
    1849      const nextComment: XrCollaborationComment = {
    1850        commentId: `xr-comment-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1851        resourceId: activeResourceId,
    1852        author: 'xr-operator',
    

apps/oshun/web/src/components/studio/StudioColorSystemWorkspace.tsx#

  • L162

    ts
    160        {
    161          ...entry,
    162          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    163        },
    164      ]);
    

apps/oshun/web/src/components/studio/StudioCommentingAnnotationSystemWorkspace.tsx#

  • L442

    ts
    440        {
    441          ...entry,
    442          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    443        },
    444      ]);
    
  • L705

    ts
    703      const span = startStudioCommentingAnnotationSystemFlowSpan(flow, telemetryContext);
    704      const previousState = annotations.map((entry) => ({ ...entry }));
    705      const createdAnnotationId = `ann-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    706
    707      setFlow(flow, {
    

apps/oshun/web/src/components/studio/StudioComplexInteractionPatternsWorkspace.tsx#

  • L169

    ts
    167        {
    168          ...entry,
    169          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    170        },
    171      ]);
    

apps/oshun/web/src/components/studio/StudioComponentPrimitivesWorkspace.tsx#

  • L166

    ts
    164        {
    165          ...entry,
    166          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    167        },
    168      ]);
    

apps/oshun/web/src/components/studio/StudioCrossDomainEntityModelWorkspace.tsx#

  • L177

    ts
    175        {
    176          ...entry,
    177          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    178        },
    179      ]);
    

apps/oshun/web/src/components/studio/StudioDataRetentionLifecycleControlsWorkspace.tsx#

  • L557

    ts
    555        {
    556          ...entry,
    557          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    558        },
    559      ]);
    

apps/oshun/web/src/components/studio/StudioDesignLanguageWorkspace.tsx#

  • L742

    ts
    740        {
    741          ...entry,
    742          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    743        },
    744      ]);
    

apps/oshun/web/src/components/studio/StudioEnterpriseTenantIsolationWorkspace.tsx#

  • L178

    ts
    176        {
    177          ...entry,
    178          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    179        },
    180      ]);
    

apps/oshun/web/src/components/studio/StudioExperimentationFeatureFlagsWorkspace.tsx#

  • L511

    ts
    509        {
    510          ...entry,
    511          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    512        },
    513      ]);
    

apps/oshun/web/src/components/studio/StudioFileMediaIngestionWorkspace.tsx#

  • L444

    ts
    442        {
    443          ...entry,
    444          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    445        },
    446      ]);
    
  • L669

    ts
    667      const span = startStudioFileMediaIngestionFlowSpan(flow, telemetryContext);
    668      const previousState = ingestions.map((entry) => ({ ...entry }));
    669      const createdIngestionId = `ing-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    670
    671      setFlow(flow, {
    

apps/oshun/web/src/components/studio/StudioHathorCharacterModelingWorkspace.tsx#

  • L994

    ts
    992    ): void => {
    993      const nextEvent: CharacterTelemetryEvent = {
    994        telemetryId: `character-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    995        eventName,
    996        status,
    
  • L1010

    ts
    1008    ): void => {
    1009      const nextEntry: CharacterAuditEntry = {
    1010        auditId: `character-audit-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1011        action,
    1012        target,
    
  • L1022

    ts
    1020    const appendChangeHistoryEntry = (summary: string, target: string, reversible: boolean): void => {
    1021      const nextEntry: CharacterChangeHistoryEntry = {
    1022        changeId: `character-change-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1023        summary,
    1024        target,
    
  • L1033

    ts
    1031    const captureReversibleSnapshot = (reason: string): void => {
    1032      const snapshot: CharacterReversibleSnapshot = {
    1033        snapshotId: `character-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1034        reason,
    1035        records: cloneCharacterRecords(records),
    
  • L1781

    ts
    1779      captureReversibleSnapshot(`collaboration.comment.${characterId}`);
    1780      const nextComment: CharacterCollaborationComment = {
    1781        commentId: `character-collab-comment-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1782        characterId,
    1783        author,
    

apps/oshun/web/src/components/studio/StudioHathorCultureModelingWorkspace.tsx#

  • L814

    ts
    812      (eventName: string, status: 'success' | 'blocked' | 'error', detail: string): void => {
    813        const nextEvent: CultureTelemetryEvent = {
    814          telemetryId: `culture-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    815          eventName,
    816          status,
    
  • L832

    ts
    830    ): void => {
    831      const nextEntry: CultureAuditEntry = {
    832        auditId: `culture-audit-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    833        action,
    834        target,
    
  • L844

    ts
    842    const appendChangeHistoryEntry = (summary: string, target: string, reversible: boolean): void => {
    843      const nextEntry: CultureChangeHistoryEntry = {
    844        changeId: `culture-change-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    845        summary,
    846        target,
    
  • L855

    ts
    853    const captureReversibleSnapshot = (reason: string): void => {
    854      const snapshot: CultureReversibleSnapshot = {
    855        snapshotId: `culture-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    856        reason,
    857        records: cloneCultureRecords(records),
    

apps/oshun/web/src/components/studio/StudioHathorEconomyModelingWorkspace.tsx#

  • L766

    ts
    764      (name: string, status: TelemetryEvent['status'], detail: string): void => {
    765        const event: TelemetryEvent = {
    766          eventId: `${name}-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    767          name,
    768          status,
    

apps/oshun/web/src/components/studio/StudioHathorFactionModelingWorkspace.tsx#

  • L658

    ts
    656    ): void => {
    657      const event: TelemetryEvent = {
    658        eventId: `${name}-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    659        name,
    660        status,
    

apps/oshun/web/src/components/studio/StudioHathorGeographyModelingWorkspace.tsx#

  • L1190

    ts
    1188    ): void => {
    1189      const nextEvent: GeographyModelingTelemetryEvent = {
    1190        telemetryId: `geo-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1191        eventName,
    1192        status,
    
  • L1206

    ts
    1204    ): void => {
    1205      const nextEntry: GeographyModelingAuditEntry = {
    1206        auditId: `geo-audit-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1207        action,
    1208        target,
    
  • L1218

    ts
    1216    const appendChangeHistoryEntry = (summary: string, target: string, reversible: boolean): void => {
    1217      const nextEntry: GeographyModelingChangeHistoryEntry = {
    1218        changeId: `geo-change-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1219        summary,
    1220        target,
    
  • L1229

    ts
    1227    const captureReversibleSnapshot = (reason: string): void => {
    1228      const snapshot: GeographyModelingReversibleSnapshot = {
    1229        snapshotId: `geo-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1230        reason,
    1231        records: records.map((record) => ({ ...record })),
    
  • L1909

    ts
    1907      captureReversibleSnapshot(`collaboration-comment-${collaborationRecordId}`);
    1908      const nextComment: GeographyModelingCollaborationComment = {
    1909        commentId: `geo-collab-comment-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1910        geographyId: collaborationRecordId,
    1911        author: trimmedAuthor,
    

apps/oshun/web/src/components/studio/StudioHathorLegalSystemsModelingWorkspace.tsx#

  • L780

    ts
    778      (name: string, status: TelemetryEvent['status'], detail: string): void => {
    779        const event: TelemetryEvent = {
    780          eventId: `${name}-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    781          name,
    782          status,
    

apps/oshun/web/src/components/studio/StudioHathorLocationModelingWorkspace.tsx#

  • L1151

    ts
    1149    ): void => {
    1150      const nextEvent: LocationTelemetryEvent = {
    1151        telemetryId: `location-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1152        eventName,
    1153        status,
    
  • L1167

    ts
    1165    ): void => {
    1166      const nextEntry: LocationAuditEntry = {
    1167        auditId: `location-audit-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1168        action,
    1169        target,
    
  • L1179

    ts
    1177    const appendChangeHistoryEntry = (summary: string, target: string, reversible: boolean): void => {
    1178      const nextEntry: LocationChangeHistoryEntry = {
    1179        changeId: `location-change-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1180        summary,
    1181        target,
    
  • L1190

    ts
    1188    const captureReversibleSnapshot = (reason: string): void => {
    1189      const snapshot: LocationReversibleSnapshot = {
    1190        snapshotId: `location-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1191        reason,
    1192        records: cloneLocationRecords(records),
    
  • L1911

    ts
    1909      const mentions = extractMentions(message);
    1910      const nextComment: LocationCollaborationComment = {
    1911        commentId: `location-collab-comment-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1912        locationId,
    1913        author,
    
  • L2134

    ts
    2132                  typeof comment.commentId === 'string' && comment.commentId.trim().length > 0
    2133                    ? comment.commentId
    2134                    : `location-collab-comment-import-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    2135                locationId: comment.locationId,
    2136                author: comment.author,
    

apps/oshun/web/src/components/studio/StudioHathorQuestAuthoringWorkspace.tsx#

  • L1095

    ts
    1093      setAuditEntries((current) => [
    1094        {
    1095          auditId: `quest-audit-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1096          action,
    1097          target,
    
  • L1109

    ts
    1107      setChangeHistoryEntries((current) => [
    1108        {
    1109          changeId: `quest-change-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1110          summary,
    1111          target,
    
  • L1126

    ts
    1124      setTelemetryEvents((current) => [
    1125        {
    1126          telemetryId: `quest-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1127          eventName,
    1128          status,
    
  • L1138

    ts
    1136    const captureReversibleSnapshot = (reason: string): void => {
    1137      const snapshot: QuestReversibleSnapshot = {
    1138        snapshotId: `quest-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1139        reason,
    1140        records: cloneQuestRecords(records),
    
  • L1732

    ts
    1730      const mentions = extractQuestMentions(message);
    1731      const nextComment: QuestCollaborationComment = {
    1732        commentId: `quest-collab-comment-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1733        questId,
    1734        author,
    
  • L1942

    ts
    1940                  typeof comment.commentId === 'string' && comment.commentId.trim().length > 0
    1941                    ? comment.commentId
    1942                    : `quest-collab-comment-import-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1943                questId: comment.questId,
    1944                author: comment.author,
    

apps/oshun/web/src/components/studio/StudioHathorTimelineModelingWorkspace.tsx#

  • L1082

    ts
    1080      setAuditEntries((current) => [
    1081        {
    1082          auditId: `timeline-audit-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1083          action,
    1084          target,
    
  • L1096

    ts
    1094      setChangeHistoryEntries((current) => [
    1095        {
    1096          changeId: `timeline-change-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1097          summary,
    1098          target,
    
  • L1113

    ts
    1111      setTelemetryEvents((current) => [
    1112        {
    1113          telemetryId: `timeline-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1114          eventName,
    1115          status,
    
  • L1125

    ts
    1123    const captureReversibleSnapshot = (reason: string): void => {
    1124      const snapshot: TimelineReversibleSnapshot = {
    1125        snapshotId: `timeline-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1126        reason,
    1127        records: cloneTimelineRecords(records),
    
  • L1755

    ts
    1753      const mentions = extractMentions(message);
    1754      const nextComment: TimelineCollaborationComment = {
    1755        commentId: `timeline-collab-comment-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1756        timelineId,
    1757        author,
    
  • L1971

    ts
    1969                  typeof comment.commentId === 'string' && comment.commentId.trim().length > 0
    1970                    ? comment.commentId
    1971                    : `timeline-collab-comment-import-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    1972                timelineId: comment.timelineId,
    1973                author: comment.author,
    

apps/oshun/web/src/components/studio/StudioHathorWorldConfigurationWorkspace.tsx#

  • L819

    ts
    817            commentId:
    818              String(comment.commentId ?? '').trim() ||
    819              `world-collab-comment-import-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    820            recordId: String(comment.recordId ?? '').trim(),
    821            author: String(comment.author ?? 'import').trim() || 'import',
    
  • L1261

    ts
    1259    const captureReversibleSnapshot = (label: string): void => {
    1260      const snapshot: WorldConfigurationReversibleSnapshot = {
    1261        snapshotId: `world-configuration-snapshot-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1262        atIso: new Date().toISOString(),
    1263        label,
    
  • L1288

    ts
    1286      setAuditTrail((current) => [
    1287        {
    1288          entryId: `world-configuration-audit-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1289          atIso: new Date().toISOString(),
    1290          actor: policyRole,
    
  • L1304

    ts
    1302      setChangeHistory((current) => [
    1303        {
    1304          changeId: `world-configuration-change-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1305          atIso: new Date().toISOString(),
    1306          summary,
    
  • L1322

    ts
    1320      setTelemetryEvents((current) => [
    1321        {
    1322          eventId: `world-configuration-telemetry-${Date.now()}-${Math.random().toString(16).slice(2, 8)}`,
    1323          atIso: new Date().toISOString(),
    1324          eventName,
    
  • L2028

    ts
    2026      const mentions = mentionMatches.map((match) => match[1]).filter(Boolean) as string[];
    2027      const nextComment: WorldConfigurationCollaborationComment = {
    2028        commentId: `world-collab-comment-${Date.now()}-${Math.random().toString(16).slice(2, 6)}`,
    2029        recordId: collaborationRecordId,
    2030        author: trimmedAuthor,
    

apps/oshun/web/src/components/studio/StudioInformationArchitectureWorkspace.tsx#

  • L143

    ts
    141        {
    142          ...entry,
    143          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    144        },
    145      ]);
    

apps/oshun/web/src/components/studio/StudioInternationalizationLocalizationWorkspace.tsx#

  • L493

    ts
    491        {
    492          ...entry,
    493          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    494        },
    495      ]);
    

apps/oshun/web/src/components/studio/StudioLaunchReadinessGovernanceDashboard.tsx#

  • L1225

    ts
    1223        {
    1224          ...entry,
    1225          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    1226        },
    1227      ]);
    

apps/oshun/web/src/components/studio/StudioMetricsAnalyticsInstrumentationWorkspace.tsx#

  • L496

    ts
    494        {
    495          ...entry,
    496          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    497        },
    498      ]);
    
  • L770

    ts
    768      const span = startStudioMetricsAnalyticsInstrumentationFlowSpan(flow, telemetryContext);
    769      const previousState = metrics.map((entry) => ({ ...entry }));
    770      const createdMetricId = `met-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    771
    772      setFlow(flow, {
    

apps/oshun/web/src/components/studio/StudioMultiProjectOperationsWorkspace.tsx#

  • L174

    ts
    172        {
    173          ...entry,
    174          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    175        },
    176      ]);
    

apps/oshun/web/src/components/studio/StudioNavigationCommandWorkspace.tsx#

  • L166

    ts
    164        {
    165          ...entry,
    166          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    167        },
    168      ]);
    

apps/oshun/web/src/components/studio/StudioNotificationCenterWorkspace.tsx#

  • L376

    ts
    374        {
    375          ...entry,
    376          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    377        },
    378      ]);
    

apps/oshun/web/src/components/studio/StudioObservabilityOperationalDashboardsWorkspace.tsx#

  • L524

    ts
    522        {
    523          ...entry,
    524          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    525        },
    526      ]);
    
  • L815

    ts
    813      const previousSignals = signals.map((entry) => ({ ...entry }));
    814      const previousAlerts = alerts.map((entry) => ({ ...entry }));
    815      const createdSignalId = `sig-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    816
    817      setFlow(flow, {
    

apps/oshun/web/src/components/studio/StudioPerformanceBudgetsWorkspace.tsx#

  • L485

    ts
    483        {
    484          ...entry,
    485          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    486        },
    487      ]);
    

apps/oshun/web/src/components/studio/StudioPresenceCursorSystemsWorkspace.tsx#

  • L397

    ts
    395        {
    396          ...entry,
    397          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    398        },
    399      ]);
    

apps/oshun/web/src/components/studio/StudioRbacPermissionPolicyUxWorkspace.tsx#

  • L171

    ts
    169        {
    170          ...entry,
    171          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    172        },
    173      ]);
    

apps/oshun/web/src/components/studio/StudioRealTimeCollaborationSubstrateWorkspace.tsx#

  • L381

    ts
    379        {
    380          ...entry,
    381          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    382        },
    383      ]);
    

apps/oshun/web/src/components/studio/StudioResilienceErrorUxWorkspace.tsx#

  • L449

    ts
    447        {
    448          ...entry,
    449          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    450        },
    451      ]);
    
  • L755

    ts
    753      const span = startStudioResilienceErrorUxFlowSpan(flow, telemetryContext);
    754      const previousState = incidents.map((entry) => ({ ...entry }));
    755      const createdIncidentId = `inc-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    756
    757      setFlow(flow, {
    
  • L769

    ts
    767            incidentId: createdIncidentId,
    768            workflowId: context.workflowId.trim(),
    769            correlationId: `corr-${Math.random().toString(36).slice(2, 10)}`,
    770            surfaceRef: context.surfaceRef.trim(),
    771            sourceDomain: selectedIncident?.sourceDomain ?? 'oshun',
    

apps/oshun/web/src/components/studio/StudioReviewApprovalWorkflowsWorkspace.tsx#

  • L698

    ts
    696        {
    697          ...entry,
    698          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    699        },
    700      ]);
    
  • L1043

    ts
    1041      const span = startStudioReviewApprovalWorkflowsFlowSpan(flow, telemetryContext);
    1042      const previousState = reviews.map((entry) => ({ ...entry }));
    1043      const createdReviewId = `rev-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    1044
    1045      setFlow(flow, {
    

apps/oshun/web/src/components/studio/StudioSdkDocumentationIntegrationWorkspace.tsx#

  • L596

    ts
    594        {
    595          ...entry,
    596          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    597        },
    598      ]);
    

apps/oshun/web/src/components/studio/StudioSearchDiscoveryWorkspace.tsx#

  • L166

    ts
    164        {
    165          ...entry,
    166          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    167        },
    168      ]);
    

apps/oshun/web/src/components/studio/StudioSecurityHardeningProgramWorkspace.tsx#

  • L521

    ts
    519        {
    520          ...entry,
    521          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    522        },
    523      ]);
    

apps/oshun/web/src/components/studio/StudioSessionDeviceManagementWorkspace.tsx#

  • L175

    ts
    173        {
    174          ...entry,
    175          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    176        },
    177      ]);
    

apps/oshun/web/src/components/studio/StudioSpacingLayoutWorkspace.tsx#

  • L166

    ts
    164        {
    165          ...entry,
    166          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    167        },
    168      ]);
    

apps/oshun/web/src/components/studio/StudioTypographyWorkspace.tsx#

  • L157

    ts
    155        {
    156          ...entry,
    157          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    158        },
    159      ]);
    

apps/oshun/web/src/components/studio/StudioWebhooksExternalAutomationWorkspace.tsx#

  • L482

    ts
    480        {
    481          ...entry,
    482          id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    483        },
    484      ]);
    

apps/oshun/web/src/components/studio/StudioWorkspaceContextSwitchingWorkspace.tsx#

  • L203

    ts
    201        {
    202          ...entry,
    203          id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    204        },
    205      ]);
    

apps/oshun/web/src/components/welcome/WelcomePageView.tsx#

  • L188

    ts
    186      for (let i = 0; i < count; i++) {
    187        stars.push({
    188          x: Math.random() * canvas.offsetWidth,
    189          y: Math.random() * canvas.offsetHeight,
    190          size: 0.5 + Math.random() * 1.5,
    
  • L189

    ts
    187        stars.push({
    188          x: Math.random() * canvas.offsetWidth,
    189          y: Math.random() * canvas.offsetHeight,
    190          size: 0.5 + Math.random() * 1.5,
    191          opacity: 0.1 + Math.random() * 0.3,
    
  • L190

    ts
    188          x: Math.random() * canvas.offsetWidth,
    189          y: Math.random() * canvas.offsetHeight,
    190          size: 0.5 + Math.random() * 1.5,
    191          opacity: 0.1 + Math.random() * 0.3,
    192          speed: 0.05 + Math.random() * 0.15,
    
  • L191

    ts
    189          y: Math.random() * canvas.offsetHeight,
    190          size: 0.5 + Math.random() * 1.5,
    191          opacity: 0.1 + Math.random() * 0.3,
    192          speed: 0.05 + Math.random() * 0.15,
    193          phase: Math.random() * Math.PI * 2,
    
  • L192

    ts
    190          size: 0.5 + Math.random() * 1.5,
    191          opacity: 0.1 + Math.random() * 0.3,
    192          speed: 0.05 + Math.random() * 0.15,
    193          phase: Math.random() * Math.PI * 2,
    194        });
    
  • L193

    ts
    191          opacity: 0.1 + Math.random() * 0.3,
    192          speed: 0.05 + Math.random() * 0.15,
    193          phase: Math.random() * Math.PI * 2,
    194        });
    195      }
    
  • L212

    ts
    210          if (star.y < -2) {
    211            star.y = canvas.offsetHeight + 2;
    212            star.x = Math.random() * canvas.offsetWidth;
    213          }
    214        }
    

apps/oshun/web/src/design-system/components/Confetti.tsx#

  • L163

    ts
    161      const output = buffer.getChannelData(0);
    162      for (let i = 0; i < bufferSize; i++) {
    163        output[i] = (Math.random() * 2 - 1) * (1 - i / bufferSize);
    164      }
    165      const noise = ctx.createBufferSource();
    
  • L208

    ts
    206    containerHeight: number
    207  ): Particle {
    208    const angle = ((-90 + (Math.random() - 0.5) * config.spread * 2) * Math.PI) / 180;
    209    const speed = config.velocity * (0.5 + Math.random() * 0.5);
    210
    
  • L209

    ts
    207  ): Particle {
    208    const angle = ((-90 + (Math.random() - 0.5) * config.spread * 2) * Math.PI) / 180;
    209    const speed = config.velocity * (0.5 + Math.random() * 0.5);
    210
    211    return {
    
  • L215

    ts
    213      x: containerWidth * config.origin[0],
    214      y: containerHeight * config.origin[1],
    215      vx: Math.cos(angle) * speed + (Math.random() - 0.5) * 15,
    216      vy: Math.sin(angle) * speed - Math.random() * 10,
    217      rotation: Math.random() * 360,
    
  • L216

    ts
    214      y: containerHeight * config.origin[1],
    215      vx: Math.cos(angle) * speed + (Math.random() - 0.5) * 15,
    216      vy: Math.sin(angle) * speed - Math.random() * 10,
    217      rotation: Math.random() * 360,
    218      rotationSpeed: (Math.random() - 0.5) * 15,
    
  • L217

    ts
    215      vx: Math.cos(angle) * speed + (Math.random() - 0.5) * 15,
    216      vy: Math.sin(angle) * speed - Math.random() * 10,
    217      rotation: Math.random() * 360,
    218      rotationSpeed: (Math.random() - 0.5) * 15,
    219      scale: 0.6 + Math.random() * 0.4,
    
  • L218

    ts
    216      vy: Math.sin(angle) * speed - Math.random() * 10,
    217      rotation: Math.random() * 360,
    218      rotationSpeed: (Math.random() - 0.5) * 15,
    219      scale: 0.6 + Math.random() * 0.4,
    220      color: config.colors[Math.floor(Math.random() * config.colors.length)],
    
  • L219

    ts
    217      rotation: Math.random() * 360,
    218      rotationSpeed: (Math.random() - 0.5) * 15,
    219      scale: 0.6 + Math.random() * 0.4,
    220      color: config.colors[Math.floor(Math.random() * config.colors.length)],
    221      shape: config.shapes[Math.floor(Math.random() * config.shapes.length)],
    
  • L220

    ts
    218      rotationSpeed: (Math.random() - 0.5) * 15,
    219      scale: 0.6 + Math.random() * 0.4,
    220      color: config.colors[Math.floor(Math.random() * config.colors.length)],
    221      shape: config.shapes[Math.floor(Math.random() * config.shapes.length)],
    222      emoji: config.emojis[Math.floor(Math.random() * config.emojis.length)],
    
  • L221

    ts
    219      scale: 0.6 + Math.random() * 0.4,
    220      color: config.colors[Math.floor(Math.random() * config.colors.length)],
    221      shape: config.shapes[Math.floor(Math.random() * config.shapes.length)],
    222      emoji: config.emojis[Math.floor(Math.random() * config.emojis.length)],
    223      size: config.sizeRange[0] + Math.random() * (config.sizeRange[1] - config.sizeRange[0]),
    
  • L222

    ts
    220      color: config.colors[Math.floor(Math.random() * config.colors.length)],
    221      shape: config.shapes[Math.floor(Math.random() * config.shapes.length)],
    222      emoji: config.emojis[Math.floor(Math.random() * config.emojis.length)],
    223      size: config.sizeRange[0] + Math.random() * (config.sizeRange[1] - config.sizeRange[0]),
    224      opacity: 1,
    
  • L223

    ts
    221      shape: config.shapes[Math.floor(Math.random() * config.shapes.length)],
    222      emoji: config.emojis[Math.floor(Math.random() * config.emojis.length)],
    223      size: config.sizeRange[0] + Math.random() * (config.sizeRange[1] - config.sizeRange[0]),
    224      opacity: 1,
    225      drag: 0.02 + Math.random() * 0.03,
    
  • L225

    ts
    223      size: config.sizeRange[0] + Math.random() * (config.sizeRange[1] - config.sizeRange[0]),
    224      opacity: 1,
    225      drag: 0.02 + Math.random() * 0.03,
    226      wobble: Math.random() * 10,
    227      wobbleSpeed: 0.05 + Math.random() * 0.1,
    
  • L226

    ts
    224      opacity: 1,
    225      drag: 0.02 + Math.random() * 0.03,
    226      wobble: Math.random() * 10,
    227      wobbleSpeed: 0.05 + Math.random() * 0.1,
    228    };
    
  • L227

    ts
    225      drag: 0.02 + Math.random() * 0.03,
    226      wobble: Math.random() * 10,
    227      wobbleSpeed: 0.05 + Math.random() * 0.1,
    228    };
    229  }
    

apps/oshun/web/src/design-system/components/HabitCheckbox.tsx#

  • L54

    ts
    52    return Array.from({ length: count }, (_, i) => ({
    53      id: i,
    54      angle: (360 / count) * i + (Math.random() - 0.5) * 40,
    55      speed: 20 + Math.random() * 30,
    56      scale: 0.4 + Math.random() * 0.6,
    
  • L55

    ts
    53      id: i,
    54      angle: (360 / count) * i + (Math.random() - 0.5) * 40,
    55      speed: 20 + Math.random() * 30,
    56      scale: 0.4 + Math.random() * 0.6,
    57      color: PARTICLE_COLORS[i % PARTICLE_COLORS.length],
    
  • L56

    ts
    54      angle: (360 / count) * i + (Math.random() - 0.5) * 40,
    55      speed: 20 + Math.random() * 30,
    56      scale: 0.4 + Math.random() * 0.6,
    57      color: PARTICLE_COLORS[i % PARTICLE_COLORS.length],
    58      rotation: Math.random() * 360,
    
  • L58

    ts
    56      scale: 0.4 + Math.random() * 0.6,
    57      color: PARTICLE_COLORS[i % PARTICLE_COLORS.length],
    58      rotation: Math.random() * 360,
    59    }));
    60  }
    

apps/oshun/web/src/design-system/components/MiniChart.tsx#

  • L206

    ts
    204
    205    // Unique gradient ID
    206    const gradientId = `minichart-gradient-${useMemo(() => Math.random().toString(36).slice(2, 8), [])}`;
    207
    208    const hoveredPoint = hoveredIndex !== null ? points[hoveredIndex] : null;
    

apps/oshun/web/src/design-system/components/OverlaySheet.tsx#

  • L86

    ts
    84    const panelRef = useRef<HTMLDivElement | null>(null);
    85    const previousFocusRef = useRef<HTMLElement | null>(null);
    86    const titleId = useRef(`oshun-sheet-title-${Math.random().toString(36).slice(2, 8)}`).current;
    87
    88    // -- Mobile detection
    

apps/oshun/web/src/lib/api-client.ts#

  • L113

    ts
    111  function backoffDelay(attempt: number, base: number, max: number): number {
    112    const delay = base * Math.pow(2, attempt);
    113    const jitter = delay * 0.1 * Math.random();
    114    return Math.min(delay + jitter, max);
    115  }
    

apps/oshun/web/src/lib/arete/arete-simulation-data.ts#

  • L47

    ts
    45    const hist: { date: DateString; completed: boolean; frozen: boolean }[] = [];
    46    for (let i = days - 1; i >= 0; i--) {
    47      const completed = Math.random() < completionRate;
    48      hist.push({
    49        date: daysAgo(i),
    
  • L51

    ts
    49        date: daysAgo(i),
    50        completed,
    51        frozen: !completed && Math.random() < 0.1,
    52      });
    53    }
    
  • L60

    ts
    58    const cells: HabitHeatmapCell[] = [];
    59    for (let i = days - 1; i >= 0; i--) {
    60      const count = Math.floor(Math.random() * 9);
    61      cells.push({
    62        date: daysAgo(i),
    
  • L78

    ts
    76    const cells: JournalFrequencyCell[] = [];
    77    for (let i = days - 1; i >= 0; i--) {
    78      const entryCount = Math.random() < 0.6 ? Math.floor(Math.random() * 3) + 1 : 0;
    79      cells.push({
    80        date: daysAgo(i),
    
  • L82

    ts
    80        date: daysAgo(i),
    81        entryCount,
    82        wordCount: entryCount * (150 + Math.floor(Math.random() * 400)),
    83      });
    84    }
    
  • L1712

    ts
    1710      text,
    1711      category,
    1712      timesUsed: Math.floor(Math.random() * 8),
    1713      averageRating: 3.5 + Math.random() * 1.5,
    1714      isFavorite: Math.random() < 0.1,
    
  • L1713

    ts
    1711      category,
    1712      timesUsed: Math.floor(Math.random() * 8),
    1713      averageRating: 3.5 + Math.random() * 1.5,
    1714      isFavorite: Math.random() < 0.1,
    1715    }));
    
  • L1714

    ts
    1712      timesUsed: Math.floor(Math.random() * 8),
    1713      averageRating: 3.5 + Math.random() * 1.5,
    1714      isFavorite: Math.random() < 0.1,
    1715    }));
    1716  }
    
  • L1827

    ts
    1825    completionTrends: Array.from({ length: 90 }, (_, i) => ({
    1826      date: daysAgo(89 - i),
    1827      rate: 0.55 + (i / 90) * 0.2 + (Math.random() - 0.5) * 0.1,
    1828    })),
    1829    dayOfWeekAnalysis: [
    
  • L1859

    ts
    1857    difficultyTrend: Array.from({ length: 30 }, (_, i) => ({
    1858      date: daysAgo(29 - i),
    1859      averageDifficulty: 2.8 - (i / 30) * 0.4 + (Math.random() - 0.5) * 0.3,
    1860    })),
    1861    consistencyGrade: 'B+',
    
  • L1897

    ts
    1895    velocityTrends: Array.from({ length: 12 }, (_, i) => ({
    1896      date: daysAgo((11 - i) * 7),
    1897      averageVelocity: 2.0 + (i / 12) * 1.5 + (Math.random() - 0.5) * 0.5,
    1898    })),
    1899  };
    
  • L1907

    ts
    1905  export const sampleJournalAnalytics: JournalAnalytics = {
    1906    sentimentTrend: Array.from({ length: 90 }, (_, i) => {
    1907      const score = 0.2 + (i / 90) * 0.3 + (Math.random() - 0.5) * 0.3;
    1908      return {
    1909        date: daysAgo(89 - i),
    
  • L1973

    ts
    1971    moodPrediction: Array.from({ length: 7 }, (_, i) => ({
    1972      date: daysAgo(-(i + 1)),
    1973      predictedMood: 6.5 + Math.random() * 2,
    1974      confidence: 0.65 + Math.random() * 0.2,
    1975    })),
    
  • L1974

    ts
    1972      date: daysAgo(-(i + 1)),
    1973      predictedMood: 6.5 + Math.random() * 2,
    1974      confidence: 0.65 + Math.random() * 0.2,
    1975    })),
    1976    totalEntries: 192,
    

apps/oshun/web/src/lib/nyx/nyx-extended-simulation.ts#

  • L83

    ts
    81      constellation: con,
    82      magnitude: mag,
    83      surfaceBrightness: mag + 3 + Math.random() * 2,
    84      angularSize: size,
    85      distance: dist,
    
  • L2142

    ts
    2140      constellation: con,
    2141      magnitude: mag,
    2142      surfaceBrightness: mag + 2.5 + Math.random() * 2,
    2143      angularSize: size,
    2144      distance: dist,
    
  • L2719

    ts
    2717      constellation: con,
    2718      magnitude: mag,
    2719      surfaceBrightness: mag + 2 + Math.random() * 2,
    2720      angularSize: size,
    2721      distance: dist,
    
  • L3106

    ts
    3104    return Array.from({ length: 8 }, (_, i) => ({
    3105      time: new Date(now.getTime() - (7 - i) * 3 * 3600000).toISOString(),
    3106      value: Math.round((3 + Math.sin(i * 0.8) * 2 + Math.random() * 1.5) * 10) / 10,
    3107    }));
    3108  }
    
  • L3114

    ts
    3112    return Array.from({ length: 30 }, (_, i) => ({
    3113      date: new Date(now.getTime() - (29 - i) * 86400000).toISOString().split('T')[0],
    3114      count: Math.round(140 + Math.sin(i * 0.3) * 25 + Math.random() * 15),
    3115    }));
    3116  }
    

apps/oshun/web/src/lib/nyx/nyx-renderer-simulation.ts#

  • L47

    ts
    45    for (let i = 0; i < 60; i++) {
    46      const phase = (i / 60) * Math.PI * 4;
    47      const fps = 58.5 + Math.sin(phase) * 3.5 + (Math.random() - 0.5) * 1.5;
    48      const drawCalls = 200 + Math.sin(phase * 0.7) * 50 + Math.floor(Math.random() * 20);
    49      const gpuMemory = 300 + Math.sin(phase * 0.3) * 100 + Math.random() * 20;
    
  • L48

    ts
    46      const phase = (i / 60) * Math.PI * 4;
    47      const fps = 58.5 + Math.sin(phase) * 3.5 + (Math.random() - 0.5) * 1.5;
    48      const drawCalls = 200 + Math.sin(phase * 0.7) * 50 + Math.floor(Math.random() * 20);
    49      const gpuMemory = 300 + Math.sin(phase * 0.3) * 100 + Math.random() * 20;
    50      const frameTime = 1000 / fps;
    
  • L49

    ts
    47      const fps = 58.5 + Math.sin(phase) * 3.5 + (Math.random() - 0.5) * 1.5;
    48      const drawCalls = 200 + Math.sin(phase * 0.7) * 50 + Math.floor(Math.random() * 20);
    49      const gpuMemory = 300 + Math.sin(phase * 0.3) * 100 + Math.random() * 20;
    50      const frameTime = 1000 / fps;
    51      samples.push({
    
  • L58

    ts
    56        gpuMemoryMB: Math.round(Math.max(200, Math.min(400, gpuMemory)) * 10) / 10,
    57        textureCount: 24 + Math.floor(Math.sin(phase * 0.5) * 6),
    58        cpuTimeMs: Math.round((2.5 + Math.random() * 1.5) * 100) / 100,
    59        gpuTimeMs: Math.round((8 + Math.sin(phase) * 3 + Math.random() * 1.5) * 100) / 100,
    60        starsRendered: 8400 + Math.floor(Math.sin(phase * 0.4) * 1200),
    
  • L59

    ts
    57        textureCount: 24 + Math.floor(Math.sin(phase * 0.5) * 6),
    58        cpuTimeMs: Math.round((2.5 + Math.random() * 1.5) * 100) / 100,
    59        gpuTimeMs: Math.round((8 + Math.sin(phase) * 3 + Math.random() * 1.5) * 100) / 100,
    60        starsRendered: 8400 + Math.floor(Math.sin(phase * 0.4) * 1200),
    61        planetsRendered: 8,
    

apps/oshun/web/src/lib/nyx/nyx-widgets-simulation.ts#

  • L615

    ts
    613    for (let i = 0; i < 5; i++) {
    614      const passTime = new Date(now.getTime() + (i + 1) * 24 * 3600 * 1000 + (19 + i) * 3600 * 1000);
    615      const maxAlt = 25 + Math.round(Math.random() * 55);
    616      const mag = -(1.0 + Math.random() * 2.5);
    617      passes.push({
    
  • L616

    ts
    614      const passTime = new Date(now.getTime() + (i + 1) * 24 * 3600 * 1000 + (19 + i) * 3600 * 1000);
    615      const maxAlt = 25 + Math.round(Math.random() * 55);
    616      const mag = -(1.0 + Math.random() * 2.5);
    617      passes.push({
    618        dateTime: passTime.toISOString(),
    
  • L622

    ts
    620        appearsDirection: directions[i % directions.length] ?? 'NW',
    621        disappearsDirection: disappears[i % disappears.length] ?? 'SE',
    622        durationSec: 180 + Math.round(Math.random() * 240),
    623        magnitude: Math.round(mag * 10) / 10,
    624        isBright: mag < -2,
    
  • L2238

    ts
    2236          temperatureC: temp,
    2237          humidity: 55 + Math.round(cloud * 0.3),
    2238          windSpeedKmh: 8 + Math.round(Math.random() * 15),
    2239          windDirection: windDirs[(day + h) % windDirs.length] ?? 'N',
    2240          dewPointC: temp - 8,
    
  • L2282

    ts
    2280          seeingArcsec: Math.round(seeing * 10) / 10,
    2281          antoniadiScale: antoniadi as 1 | 2 | 3 | 4 | 5,
    2282          jetStreamSpeedKmh: jetStream + Math.round(Math.random() * 30),
    2283          confidence: day < 3 ? 0.85 : day < 5 ? 0.65 : 0.45,
    2284          description:
    

apps/oshun/web/src/lib/tara/tara-cache.ts#

  • L516

    ts
    514            }
    515
    516            const increment = totalBytes * (0.03 + Math.random() * 0.05);
    517            const newBytesDownloaded = Math.min(current.bytesDownloaded + increment, totalBytes);
    518            const newProgress = Math.round((newBytesDownloaded / totalBytes) * 100);
    
  • L582

    ts
    580            }
    581
    582            const increment = dl.totalBytes * (0.03 + Math.random() * 0.05);
    583            const newBytesDownloaded = Math.min(dl.bytesDownloaded + increment, dl.totalBytes);
    584            const newProgress = Math.round((newBytesDownloaded / dl.totalBytes) * 100);
    

apps/oshun/web/src/lib/veritas/veritas-simulation-data.ts#

  • L2547

    ts
    2545    checkworthiness: cv.checkworthiness.score,
    2546    communityVotes: {
    2547      agree: Math.floor(Math.random() * 200) + 50,
    2548      disagree: Math.floor(Math.random() * 80) + 10,
    2549      unsure: Math.floor(Math.random() * 40) + 5,
    
  • L2548

    ts
    2546    communityVotes: {
    2547      agree: Math.floor(Math.random() * 200) + 50,
    2548      disagree: Math.floor(Math.random() * 80) + 10,
    2549      unsure: Math.floor(Math.random() * 40) + 5,
    2550    },
    
  • L2549

    ts
    2547      agree: Math.floor(Math.random() * 200) + 50,
    2548      disagree: Math.floor(Math.random() * 80) + 10,
    2549      unsure: Math.floor(Math.random() * 40) + 5,
    2550    },
    2551    statusTimeline: [
    

apps/oshun/web/src/lib/websocket-client.ts#

  • L378

    ts
    376      );
    377
    378      const jitter = delay * 0.1 * Math.random();
    379
    380      this.reconnectTimer = setTimeout(() => {
    

apps/oshun/web/src/middleware.ts#

  • L111

    ts
    109  function generateRequestId(): string {
    110    const timestamp = Date.now().toString(36);
    111    const random = Math.random().toString(36).slice(2, 10);
    112    return `req_${timestamp}_${random}`;
    113  }
    

apps/oshun/web/src/observability/error-monitoring.ts#

  • L186

    ts
    184    // Apply sampling for non-manual captures
    185    if (options.source !== 'manual' && options.source !== 'error_boundary') {
    186      if (Math.random() < 1 - (config.sampleRate ?? 1.0)) {
    187        return;
    188      }
    

apps/psyche/admin/src/app/dashboard/knowledge/sources/new/page.tsx#

  • L44

    ts
    42
    43        // Generate a mock source ID
    44        const sourceId = `src_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    45        setCreatedSourceId(sourceId);
    46        setCreateState('success');
    

apps/psyche/admin/src/app/dashboard/knowledge/upload/page.tsx#

  • L65

    ts
    63      onProgress(i);
    64    }
    65    return { documentId: `doc_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` };
    66  }
    67
    
  • L93

    ts
    91          status === 'ready'
    92            ? {
    93                chunksCreated: Math.floor(Math.random() * 50) + 10,
    94                embeddingsGenerated: Math.floor(Math.random() * 50) + 10,
    95                processingTimeMs: Math.floor(Math.random() * 5000) + 2000,
    
  • L94

    ts
    92            ? {
    93                chunksCreated: Math.floor(Math.random() * 50) + 10,
    94                embeddingsGenerated: Math.floor(Math.random() * 50) + 10,
    95                processingTimeMs: Math.floor(Math.random() * 5000) + 2000,
    96              }
    
  • L95

    ts
    93                chunksCreated: Math.floor(Math.random() * 50) + 10,
    94                embeddingsGenerated: Math.floor(Math.random() * 50) + 10,
    95                processingTimeMs: Math.floor(Math.random() * 5000) + 2000,
    96              }
    97            : undefined,
    
  • L117

    ts
    115      // Initialize upload progress for all files
    116      const initialProgress: UploadProgress[] = data.files.map((file) => ({
    117        fileId: `file_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    118        fileName: file.name,
    119        progress: 0,
    

apps/psyche/admin/src/components/forms/persona/avatar-form.tsx#

  • L1012

    ts
    1010            return 100;
    1011          }
    1012          return prev + Math.random() * 2;
    1013        });
    1014      }, 200);
    

apps/psyche/admin/src/components/forms/persona/voice-form.tsx#

  • L289

    ts
    287                            className="w-1 rounded-full bg-primary animate-pulse"
    288                            style={{
    289                              height: `${Math.random() * 100}%`,
    290                              animationDelay: `${i * 50}ms`,
    291                            }}
    

apps/psyche/admin/src/lib/aria.ts#

  • L226

    ts
    224   */
    225  export function generateAriaId(prefix: string = 'aria'): string {
    226    return `${prefix}-${Math.random().toString(36).substring(2, 9)}`;
    227  }
    228
    

apps/psyche/admin/src/lib/utils.ts#

  • L144

    ts
    142   */
    143  export function generateId(prefix = ''): string {
    144    const random = Math.random().toString(36).substring(2, 11);
    145    return prefix ? `${prefix}_${random}` : random;
    146  }
    

apps/sophia/ingestion/src/pipeline/ingestion-pipeline.ts#

  • L159

    ts
    157     */
    158    async submit(config: JobConfig): Promise<IngestionJob> {
    159      const jobId = createJobId(`job-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`);
    160
    161      const job: IngestionJob = {
    
  • L280

    ts
    278
    279        const rawDocument: RawDocument = {
    280          documentId: createDocumentId(`doc-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`),
    281          sourceId: fetchResult.sourceId,
    282          format,
    
  • L391

    ts
    389            for (const entity of enrichedForStorage.entities) {
    390              const entityPayload: SophiaEntityExtractedPayload = {
    391                entityId: `entity-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    392                projectId,
    393                documentId: enrichedForStorage.documentId,
    

apps/sophia/workbench/src/components/Modal.tsx#

  • L22

    ts
    20    const modalRef = useRef<HTMLDivElement>(null);
    21    const previousActiveElement = useRef<HTMLElement | null>(null);
    22    const generatedTitleId = titleId ?? `modal-title-${Math.random().toString(36).substr(2, 9)}`;
    23
    24    // Focus trap: Get all focusable elements
    

apps/tara/api/src/middleware/request-id.ts#

  • L18

    ts
    16  function generateRequestId(): string {
    17    const timestamp = Date.now().toString(36);
    18    const random = Math.random().toString(36).substring(2, 10);
    19    return `tara_${timestamp}${random}`;
    20  }
    

apps/tara/mobile/src/store/meditationStore.ts#

  • L175

    ts
    173          isDownloadable: true,
    174          tags: [category, teacher.name.toLowerCase(), `${duration / 60}min`],
    175          playCount: Math.floor(Math.random() * 10000),
    176          rating: 4 + Math.random(),
    177          ratingCount: Math.floor(Math.random() * 500),
    
  • L176

    ts
    174          tags: [category, teacher.name.toLowerCase(), `${duration / 60}min`],
    175          playCount: Math.floor(Math.random() * 10000),
    176          rating: 4 + Math.random(),
    177          ratingCount: Math.floor(Math.random() * 500),
    178          createdAt: new Date(Date.now() - Math.random() * 365 * 24 * 60 * 60 * 1000).toISOString(),
    
  • L177

    ts
    175          playCount: Math.floor(Math.random() * 10000),
    176          rating: 4 + Math.random(),
    177          ratingCount: Math.floor(Math.random() * 500),
    178          createdAt: new Date(Date.now() - Math.random() * 365 * 24 * 60 * 60 * 1000).toISOString(),
    179        });
    
  • L178

    ts
    176          rating: 4 + Math.random(),
    177          ratingCount: Math.floor(Math.random() * 500),
    178          createdAt: new Date(Date.now() - Math.random() * 365 * 24 * 60 * 60 * 1000).toISOString(),
    179        });
    180        id++;
    
  • L272

    ts
    270    const categoryMeditations = meditations.filter((m) => m.category === category);
    271    const meditation =
    272      categoryMeditations[Math.floor(Math.random() * categoryMeditations.length)] ?? meditations[0];
    273
    274    return {
    

apps/tara/web/e2e/fixtures/test-data.ts#

  • L218

    ts
    216   */
    217  export function generateTestEmail(): string {
    218    return `e2e-test-${Date.now()}-${Math.random().toString(36).slice(2)}@tara.app`;
    219  }
    220
    

apps/tara/web/src/app/[locale]/(app)/progress/page.tsx#

  • L137

    ts
    135
    136      // 60% chance of having a session on any day
    137      if (Math.random() < 0.6) {
    138        const sessions = Math.random() < 0.8 ? 1 : 2; // 20% chance of 2 sessions
    139        const minutes = Math.floor(Math.random() * 40) + 10; // 10-50 minutes
    
  • L138

    ts
    136      // 60% chance of having a session on any day
    137      if (Math.random() < 0.6) {
    138        const sessions = Math.random() < 0.8 ? 1 : 2; // 20% chance of 2 sessions
    139        const minutes = Math.floor(Math.random() * 40) + 10; // 10-50 minutes
    140        history.set(dateKey, { sessions, minutes });
    
  • L139

    ts
    137      if (Math.random() < 0.6) {
    138        const sessions = Math.random() < 0.8 ? 1 : 2; // 20% chance of 2 sessions
    139        const minutes = Math.floor(Math.random() * 40) + 10; // 10-50 minutes
    140        history.set(dateKey, { sessions, minutes });
    141      }
    
  • L152

    ts
    150        history.set(dateKey, {
    151          sessions: 1,
    152          minutes: Math.floor(Math.random() * 30) + 15,
    153        });
    154      }
    

apps/tara/web/src/lib/utils.ts#

  • L123

    ts
    121    let result = '';
    122    for (let i = 0; i < length; i++) {
    123      result += chars.charAt(Math.floor(Math.random() * chars.length));
    124    }
    125    return result;
    

apps/veritas/agents/src/communication/message-bus.ts#

  • L416

    ts
    414  ): Message<T> {
    415    return {
    416      id: createMessageId(`msg_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`),
    417      type,
    418      from,
    

apps/veritas/agents/src/core/base-agent.ts#

  • L601

    ts
    599    private emitEvent<T>(type: string, data: T): void {
    600      this.deps.eventEmitter.emit({
    601        id: `evt_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    602        type: type as import('./types.js').EventType,
    603        source: this.config.id,
    

apps/veritas/agents/src/orchestration/orchestrator.ts#

  • L293

    ts
    291
    292    async function createTask(params: CreateTaskParams): Promise<Task> {
    293      const taskId = createTaskId(`task_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`);
    294
    295      const task: Task = {
    
  • L663

    ts
    661    function emitEvent<T>(type: string, data: T): void {
    662      eventEmitter.emit({
    663        id: `evt_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    664        type: type as import('../core/types.js').EventType,
    665        source: orchestratorId,
    

apps/veritas/ai-workers/src/workers/base/helpers.ts#

  • L155

    ts
    153  export function generateId(): string {
    154    const timestamp = Date.now().toString(36);
    155    const random = Math.random().toString(36).slice(2, 10);
    156    return `${timestamp}-${random}`;
    157  }
    

apps/veritas/analytics/src/collectors/realtime.ts#

  • L264

    ts
    262      if (!existingAlert) {
    263        alerts.push({
    264          id: `alert_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    265          type,
    266          severity,
    

apps/veritas/analytics/src/user/engagement.ts#

  • L124

    ts
    122  ): UserEvent {
    123    return {
    124      id: createEventId(`evt_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`),
    125      userId: options.userId,
    126      sessionId,
    

apps/veritas/api/src/domain/ad-networks.ts#

  • L1021

    ts
    1019      adUnitPath,
    1020      sizes: sizeStr,
    1021      correlator: Math.floor(Math.random() * 1_000_000_000),
    1022      customTargeting,
    1023    });
    

apps/veritas/api/src/domain/sandbox.ts#

  • L1010

    ts
    1008
    1009    // Check random error rate
    1010    if (config.errorRate && Math.random() < config.errorRate) {
    1011      const errorCodes = [400, 401, 403, 404, 500, 502, 503];
    1012      const errorCode = errorCodes[Math.floor(Math.random() * errorCodes.length)];
    
  • L1012

    ts
    1010    if (config.errorRate && Math.random() < config.errorRate) {
    1011      const errorCodes = [400, 401, 403, 404, 500, 502, 503];
    1012      const errorCode = errorCodes[Math.floor(Math.random() * errorCodes.length)];
    1013      return {
    1014        data: null,
    

apps/veritas/api/src/interfaces/http/middleware/rateLimit.ts#

  • L90

    ts
    88
    89    // Add current request
    90    pipeline.zadd(key, now, `${now}:${Math.random()}`);
    91
    92    // Set expiry on the key
    

apps/veritas/api/src/interfaces/http/routes/v1/airteltigo-payments.ts#

  • L157

    ts
    155        }
    156
    157        const transactionId = `AT_${Date.now()}_${Math.random().toString(36).substring(2, 10)}`;
    158
    159        const result = await requestCollection(airtelConfig, {
    
  • L310

    ts
    308      try {
    309        const msisdn = formatGhanaMSISDN(bodyResult.data.phoneNumber);
    310        const transactionId = `ATD_${Date.now()}_${Math.random().toString(36).substring(2, 10)}`;
    311
    312        const result = await requestDisbursement(airtelConfig, {
    
  • L408

    ts
    406
    407        const userId = c.req.header('X-User-Id') ?? '00000000-0000-0000-0000-000000000000';
    408        const refundTxnId = `ATR_${Date.now()}_${Math.random().toString(36).substring(2, 10)}`;
    409
    410        // Look up the original transaction to get details
    

apps/veritas/api/src/interfaces/http/routes/v1/payments.ts#

  • L164

    ts
    162
    163        const currency = getDefaultCurrency(momoConfig);
    164        const externalId = `pay_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    165
    166        const referenceId = await requestToPay(momoConfig, {
    
  • L411

    ts
    409        const msisdn = formatGhanaMSISDN(bodyResult.data.phoneNumber);
    410        const currency = getDefaultCurrency(momoConfig);
    411        const externalId = `ref_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    412
    413        const referenceId = await transfer(momoConfig, {
    

apps/veritas/api/src/interfaces/http/routes/v1/tips.ts#

  • L83

    ts
    81  function generateTipReceiptId(): string {
    82    const timestamp = Date.now().toString(36);
    83    const random = Math.random().toString(36).substring(2, 10);
    84    return `TIP-${timestamp}-${random}`.toUpperCase();
    85  }
    

apps/veritas/api/src/interfaces/http/routes/v1/vodafone-payments.ts#

  • L143

    ts
    141        }
    142
    143        const conversationId = `c2b_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    144        const transactionRef = `VF_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    145
    
  • L144

    ts
    142
    143        const conversationId = `c2b_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    144        const transactionRef = `VF_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    145
    146        const result = await requestC2BPayment(vodafoneConfig, {
    
  • L235

    ts
    233
    234      try {
    235        const conversationId = `query_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    236
    237        const result = await queryTransactionStatus(vodafoneConfig, {
    
  • L302

    ts
    300      try {
    301        const msisdn = formatGhanaMSISDN(bodyResult.data.phoneNumber);
    302        const conversationId = `b2c_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    303        const transactionRef = `REF_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    304
    
  • L303

    ts
    301        const msisdn = formatGhanaMSISDN(bodyResult.data.phoneNumber);
    302        const conversationId = `b2c_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    303        const transactionRef = `REF_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    304
    305        const result = await requestB2CPayment(vodafoneConfig, {
    
  • L393

    ts
    391
    392      try {
    393        const conversationId = `rev_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    394
    395        const result = await reverseTransaction(vodafoneConfig, {
    

apps/veritas/audio/src/providers/elevenlabs.ts#

  • L407

    ts
    405    // Exponential backoff with jitter: base * 2^(attempt-1) * (0.5 + random)
    406    const exponential = BASE_BACKOFF_MS * Math.pow(2, attempt - 1);
    407    const jitter = 0.5 + Math.random() * 0.5;
    408    return Math.min(exponential * jitter, 30000); // Cap at 30 seconds
    409  }
    

apps/veritas/audio/src/providers/ghana-nlp.ts#

  • L210

    ts
    208  function calculateBackoff(attempt: number): number {
    209    const exponential = BASE_BACKOFF_MS * Math.pow(2, attempt - 1);
    210    const jitter = 0.5 + Math.random() * 0.5;
    211    return Math.min(exponential * jitter, 30000);
    212  }
    

apps/veritas/cms/src/articles/article-service.ts#

  • L67

    ts
    65
    66  function generateId(): string {
    67    return `art_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    68  }
    69
    
  • L232

    ts
    230      // Create initial revision
    231      await storage.saveRevision({
    232        id: `rev_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    233        articleId: saved.id,
    234        revisionNumber: 1,
    
  • L320

    ts
    318      // Create revision
    319      await storage.saveRevision({
    320        id: `rev_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    321        articleId: id,
    322        revisionNumber: updates.revisionNumber,
    
  • L359

    ts
    357      // Create revision
    358      await storage.saveRevision({
    359        id: `rev_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    360        articleId: id,
    361        revisionNumber: updates.revisionNumber!,
    
  • L393

    ts
    391      // Create revision
    392      await storage.saveRevision({
    393        id: `rev_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    394        articleId: id,
    395        revisionNumber: updates.revisionNumber!,
    
  • L456

    ts
    454      // Create restore revision
    455      await storage.saveRevision({
    456        id: `rev_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    457        articleId,
    458        revisionNumber: updates.revisionNumber!,
    

apps/veritas/cms/src/reviews/review-service.ts#

  • L131

    ts
    129
    130  function generateId(): string {
    131    return `rev_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    132  }
    133
    

apps/veritas/cms/src/scheduling/scheduler-service.ts#

  • L306

    ts
    304      // Create revision
    305      await storage.saveRevision({
    306        id: `rev_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    307        articleId,
    308        revisionNumber: updates.revisionNumber!,
    
  • L364

    ts
    362      // Create revision
    363      await storage.saveRevision({
    364        id: `rev_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    365        articleId,
    366        revisionNumber: updates.revisionNumber!,
    
  • L424

    ts
    422      // Create revision
    423      await storage.saveRevision({
    424        id: `rev_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    425        articleId,
    426        revisionNumber: updates.revisionNumber!,
    

apps/veritas/ingestion/src/utils/backoff.ts#

  • L40

    ts
    38
    39    // Add jitter (random variation to prevent synchronized retries)
    40    const jitter = 1 + (Math.random() - 0.5) * 2 * jitterFactor;
    41    const withJitter = Math.round(cappedMs * jitter);
    42
    

apps/veritas/mobile/app/(tabs)/watch.tsx#

  • L489

    ts
    487        if (!interactions.has(video.id)) {
    488          newInteractions.set(video.id, {
    489            likes: Math.floor(Math.random() * 50000) + 1000,
    490            comments: Math.floor(Math.random() * 5000) + 100,
    491            shares: Math.floor(Math.random() * 2000) + 50,
    
  • L490

    ts
    488          newInteractions.set(video.id, {
    489            likes: Math.floor(Math.random() * 50000) + 1000,
    490            comments: Math.floor(Math.random() * 5000) + 100,
    491            shares: Math.floor(Math.random() * 2000) + 50,
    492            isLiked: false,
    
  • L491

    ts
    489            likes: Math.floor(Math.random() * 50000) + 1000,
    490            comments: Math.floor(Math.random() * 5000) + 100,
    491            shares: Math.floor(Math.random() * 2000) + 50,
    492            isLiked: false,
    493            isBookmarked: bookmarkedVideos.includes(video.id),
    

apps/veritas/mobile/src/services/offline.ts#

  • L402

    ts
    400    const queue = await getSyncQueue();
    401    const item: SyncQueueItem = {
    402      id: `${type}_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    403      type,
    404      payload,
    

apps/veritas/mobile/src/stores/app-store.ts#

  • L192

    ts
    190          const newAlert: BreakingAlert = {
    191            ...alert,
    192            id: `alert_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    193            read: false,
    194            dismissed: false,
    
  • L242

    ts
    240          const newError: AppError = {
    241            ...error,
    242            id: `error_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    243            timestamp: new Date(),
    244          };
    

apps/veritas/mobile/src/stores/player-store.ts#

  • L471

    ts
    469              const ids = state.queue.map((i) => i.id);
    470              for (let i = ids.length - 1; i > 0; i--) {
    471                const j = Math.floor(Math.random() * (i + 1));
    472                [ids[i], ids[j]] = [ids[j] ?? '', ids[i] ?? ''];
    473              }
    

apps/veritas/nlp/src/services/base/helpers.ts#

  • L125

    ts
    123
    124    if (jitter) {
    125      delay = delay * (0.5 + Math.random() * 0.5);
    126    }
    127
    
  • L195

    ts
    193  export function generateId(): string {
    194    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    195      const r = (Math.random() * 16) | 0;
    196      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    197      return v.toString(16);
    

apps/veritas/notifications/src/channels/email.ts#

  • L134

    ts
    132        results.push({
    133          notificationId: createNotificationId(
    134            `email_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`
    135          ),
    136          channel: 'email',
    

apps/veritas/notifications/src/channels/in-app.ts#

  • L102

    ts
    100      const notification: InAppNotification = {
    101        ...data,
    102        id: createNotificationId(`inapp_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`),
    103        isRead: false,
    104        isArchived: false,
    
  • L394

    ts
    392
    393    function connect(userId: UserId): string {
    394      const connectionId = `conn_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    395
    396      connections.set(connectionId, {
    

apps/veritas/notifications/src/scheduling/queue.ts#

  • L135

    ts
    133      const queueEntry: QueueEntry = {
    134        ...entry,
    135        id: createNotificationId(`notif_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`),
    136        status: NOTIFICATION_STATUSES.pending,
    137        attempts: 0,
    

apps/veritas/social/src/calendar/calendar.ts#

  • L102

    ts
    100
    101  function generateId(): string {
    102    return `cal_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    103  }
    104
    

apps/veritas/social/src/server.ts#

  • L173

    ts
    171
    172      const post = await storage.savePost({
    173        id: `post_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    174        ...input,
    175        priority: input.priority ?? (4 as const),
    

apps/veritas/social/src/services/instagram-reels-automation.ts#

  • L1663

    ts
    1661
    1662            if (attempts >= maxAttempts) {
    1663              const failId = `ig_fail_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    1664              const failure: IGReelsFailureRecord = {
    1665                id: failId,
    

apps/veritas/social/src/services/instagram-stories-automation.ts#

  • L671

    ts
    669    const templates = IG_POLL_TEMPLATES[key] ?? IG_POLL_TEMPLATES.general;
    670    if (!templates || templates.length === 0) return null;
    671    return templates[Math.floor(Math.random() * templates.length)] ?? null;
    672  }
    673
    
  • L676

    ts
    674  function pickHookTemplate(): string {
    675    return IG_STORY_HOOK_TEMPLATES[
    676      Math.floor(Math.random() * IG_STORY_HOOK_TEMPLATES.length)
    677    ] as string;
    678  }
    
  • L682

    ts
    680  function pickCtaTemplate(): string {
    681    return IG_STORY_CTA_TEMPLATES[
    682      Math.floor(Math.random() * IG_STORY_CTA_TEMPLATES.length)
    683    ] as string;
    684  }
    
  • L1025

    ts
    1023          // Build brand stickers — alternate between mention and hashtag
    1024          const brandSticker: IGStorySticker =
    1025            Math.random() < 0.5
    1026              ? { type: 'mention', mentionUsername: brandHandle, positionX: 0.5, positionY: 0.2 }
    1027              : { type: 'hashtag', hashtag: brandHashtag, positionX: 0.5, positionY: 0.9 };
    

apps/veritas/social/src/services/tiktok-analytics.ts#

  • L1977

    ts
    1975
    1976      alerts.push({
    1977        id: `tiktok_alert_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    1978        type,
    1979        severity,
    

apps/veritas/social/src/services/tiktok-automation.ts#

  • L1197

    ts
    1195
    1196    function generateId(prefix: string): string {
    1197      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1198    }
    1199
    

apps/veritas/social/src/services/unified-scheduler.ts#

  • L69

    ts
    67  function generateId(): string {
    68    const ts = Date.now().toString(36);
    69    const rand = Math.random().toString(36).slice(2, 9);
    70    return `usc_${ts}_${rand}`;
    71  }
    

apps/veritas/social/src/services/youtube-shorts-automation.ts#

  • L927

    ts
    925
    926    function generateId(prefix: string): string {
    927      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    928    }
    929
    

apps/veritas/video/src/providers/did.ts#

  • L219

    ts
    217  function calculateBackoff(attempt: number): number {
    218    const exponential = BASE_BACKOFF_MS * Math.pow(2, attempt - 1);
    219    const jitter = 0.5 + Math.random() * 0.5;
    220    return Math.min(exponential * jitter, 60000);
    221  }
    

apps/veritas/video/src/providers/heygen.ts#

  • L161

    ts
    159    // Exponential backoff with jitter
    160    const exponential = BASE_BACKOFF_MS * Math.pow(2, attempt - 1);
    161    const jitter = 0.5 + Math.random() * 0.5;
    162    return Math.min(exponential * jitter, 30000);
    163  }
    

apps/veritas/video/src/providers/tavus.ts#

  • L167

    ts
    165  function calculateBackoff(attempt: number): number {
    166    const exponential = BASE_BACKOFF_MS * Math.pow(2, attempt - 1);
    167    const jitter = 0.5 + Math.random() * 0.5;
    168    return Math.min(exponential * jitter, 60000);
    169  }
    

apps/veritas/video/src/services/advertising/ad-service.ts#

  • L838

    ts
    836    // Generate unique event ID
    837    function generateEventId(): string {
    838      return `evt_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    839    }
    840
    
  • L936

    ts
    934              // impression callback with this request when the consumer
    935              // wires `data-veritas-request-id` into trackEvent calls.
    936              creativeId: `req_${unit.id}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    937              loadTimeMs: Date.now() - startTime,
    938              respondedAt: new Date(),
    
  • L1039

    ts
    1037        // Apply frequency reduction
    1038        if (frequencyPercent < 100) {
    1039          const random = Math.random() * 100;
    1040          if (random > frequencyPercent) return false;
    1041        }
    

apps/veritas/video/src/services/advertising/youtube-monetization.ts#

  • L859

    ts
    857    // Generate unique ID
    858    function generateId(prefix: string): string {
    859      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    860    }
    861
    
  • L1034

    ts
    1032        for (let i = 0; i < maxAds && currentPosition < videoDurationSeconds - endBuffer; i++) {
    1033          positions.push(currentPosition);
    1034          currentPosition += minInterval + Math.floor(Math.random() * 120); // 2-4 minute intervals
    1035        }
    1036
    

apps/veritas/video/src/services/avatar-profiles.ts#

  • L770

    ts
    768
    769    if (!greetings || greetings.length === 0) return null;
    770    return greetings[Math.floor(Math.random() * greetings.length)] ?? null;
    771  }
    772
    
  • L781

    ts
    779    if (typeof intro === 'string') return intro;
    780    if (intro.length === 0) return null;
    781    return intro[Math.floor(Math.random() * intro.length)] ?? null;
    782  }
    783
    
  • L792

    ts
    790    if (typeof outro === 'string') return outro;
    791    if (outro.length === 0) return null;
    792    return outro[Math.floor(Math.random() * outro.length)] ?? null;
    793  }
    

apps/veritas/video/src/services/broll.ts#

  • L130

    ts
    128   */
    129  function generateBRollId(): string {
    130    return `broll_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    131  }
    132
    

apps/veritas/video/src/services/broll/library.ts#

  • L481

    ts
    479   */
    480  function generateClipId(): string {
    481    return `clip_${Date.now()}_${Math.random().toString(36).substr(2, 8)}`;
    482  }
    483
    

apps/veritas/video/src/services/broll/prompt-generator.ts#

  • L320

    ts
    318   */
    319  function generatePromptId(): string {
    320    return `prompt_${Date.now()}_${Math.random().toString(36).substr(2, 6)}`;
    321  }
    322
    
  • L361

    ts
    359    switch (concept.type) {
    360      case 'location':
    361        return Math.random() > 0.5 ? 'aerial' : 'panning';
    362      case 'action':
    363        return 'tracking';
    
  • L365

    ts
    363        return 'tracking';
    364      case 'event':
    365        return Math.random() > 0.5 ? 'slow_motion' : 'tracking';
    366      case 'object':
    367        return Math.random() > 0.5 ? 'zoom' : 'static';
    
  • L367

    ts
    365        return Math.random() > 0.5 ? 'slow_motion' : 'tracking';
    366      case 'object':
    367        return Math.random() > 0.5 ? 'zoom' : 'static';
    368      case 'scene_setting':
    369        return 'panning';
    

apps/veritas/video/src/services/instagram-reels.ts#

  • L583

    ts
    581    return {
    582      async generateReel(request: InstagramReelsRequest): Promise<InstagramReelsResult> {
    583        const id = `ig_reel_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    584
    585        // Calculate optimal duration
    

apps/veritas/video/src/services/live-stream-content-mix.ts#

  • L425

    ts
    423   */
    424  function generateId(prefix: string): string {
    425    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    426  }
    427
    

apps/veritas/video/src/services/live-stream.ts#

  • L409

    ts
    407   */
    408  function generateId(prefix: string): string {
    409    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    410  }
    411
    
  • L1095

    ts
    1093
    1094        // Simulate viewer count fluctuation
    1095        viewerCount = Math.max(0, viewerCount + Math.floor(Math.random() * 10) - 5);
    1096        peakViewerCount = Math.max(peakViewerCount, viewerCount);
    1097      },
    

apps/veritas/video/src/services/payments/payment-providers.ts#

  • L466

    ts
    464  export function generatePaymentReference(prefix: string = 'VER'): string {
    465    const timestamp = Date.now().toString(36).toUpperCase();
    466    const random = Math.random().toString(36).substring(2, 8).toUpperCase();
    467    return `${prefix}-${timestamp}-${random}`;
    468  }
    

apps/veritas/video/src/services/payments/premium-features.ts#

  • L750

    ts
    748        // Apply frequency reduction
    749        if (adConfig.frequencyPercent < 100) {
    750          const random = Math.random() * 100;
    751          if (random > adConfig.frequencyPercent) {
    752            return false;
    

apps/veritas/video/src/services/personas.ts#

  • L717

    ts
    715    const tod = timeOfDay ?? getTimeOfDay();
    716    const greetings = persona.greetings[tod] ?? persona.greetings.morning;
    717    return greetings[Math.floor(Math.random() * greetings.length)] ?? '';
    718  }
    719
    
  • L728

    ts
    726  ): string {
    727    const signOffs = (category && persona.signOffs[category]) ?? persona.signOffs.general;
    728    return signOffs[Math.floor(Math.random() * signOffs.length)] ?? '';
    729  }
    730
    

apps/veritas/video/src/services/podcast/audio-composition.ts#

  • L405

    ts
    403   */
    404  function generateId(prefix: string): string {
    405    return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
    406  }
    407
    

apps/veritas/video/src/services/podcast/discussion-generator.ts#

  • L382

    ts
    380   */
    381  function generateId(): string {
    382    return `turn_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
    383  }
    384
    
  • L414

    ts
    412   */
    413  function randomChoice<T>(arr: T[]): T {
    414    return arr[Math.floor(Math.random() * arr.length)];
    415  }
    416
    
  • L468

    ts
    466        const starter = randomChoice(QUESTION_STARTERS);
    467        const keyPoint =
    468          topic.keyPoints?.[Math.floor(Math.random() * (topic.keyPoints?.length ?? 1))] ??
    469          'what this means for people';
    470        return {
    

apps/veritas/video/src/services/podcast/mixing-pipeline.ts#

  • L631

    ts
    629   */
    630  function generateId(prefix: string): string {
    631    return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
    632  }
    633
    

apps/veritas/video/src/services/podcast/personas.ts#

  • L512

    ts
    510      return undefined;
    511    }
    512    return persona.verbalHabits[Math.floor(Math.random() * persona.verbalHabits.length)];
    513  }
    514
    

apps/veritas/video/src/services/podcast/shows.ts#

  • L491

    ts
    489   */
    490  function generateId(prefix: string): string {
    491    return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
    492  }
    493
    

apps/veritas/video/src/services/repurposing/pipeline.ts#

  • L344

    ts
    342   */
    343  function generateId(prefix: string): string {
    344    return `${prefix}_${Date.now()}_${Math.random().toString(36).substr(2, 8)}`;
    345  }
    346
    

apps/veritas/video/src/services/scheduler/production-scheduler.ts#

  • L361

    ts
    359   */
    360  function generateId(prefix: string): string {
    361    return `${prefix}_${Date.now()}_${Math.random().toString(36).substr(2, 8)}`;
    362  }
    363
    

apps/veritas/video/src/services/scheduler/video-analytics.ts#

  • L331

    ts
    329   */
    330  function generateId(prefix: string): string {
    331    return `${prefix}_${Date.now()}_${Math.random().toString(36).substr(2, 8)}`;
    332  }
    333
    

apps/veritas/video/src/services/tiktok.ts#

  • L490

    ts
    488      // Select hook template
    489      const templates = HOOK_TEMPLATES[hookStyle];
    490      const template = templates[Math.floor(Math.random() * templates.length)];
    491
    492      // Generate hook from template
    
  • L840

    ts
    838        for (const style of styles) {
    839          const templates = HOOK_TEMPLATES[style];
    840          const template = templates[Math.floor(Math.random() * templates.length)];
    841          const hook = template
    842            .replace('{headline}', content.headline)
    

apps/veritas/video/src/services/video-pipeline.ts#

  • L367

    ts
    365   */
    366  function generateId(): string {
    367    return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    368  }
    369
    

apps/veritas/video/src/services/video-script.ts#

  • L390

    ts
    388    if (!Array.isArray(intro) || intro.length === 0) return null;
    389
    390    const randomIndex = Math.floor(Math.random() * intro.length);
    391    return intro[randomIndex] ?? null;
    392  }
    
  • L404

    ts
    402    if (!Array.isArray(outro) || outro.length === 0) return null;
    403
    404    const randomIndex = Math.floor(Math.random() * outro.length);
    405    return outro[randomIndex] ?? null;
    406  }
    

apps/veritas/video/src/services/youtube-shorts.ts#

  • L640

    ts
    638    return {
    639      async generateShort(request: YouTubeShortsRequest): Promise<YouTubeShortsResult> {
    640        const id = `yt_shorts_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    641        const targetDuration = Math.min(request.targetDuration ?? 60, 180); // Max 3 minutes
    642
    

apps/veritas/web/src/components/Skeleton/SkeletonNavigation.tsx#

  • L103

    ts
    101                <Skeleton
    102                  key={i}
    103                  width={60 + Math.random() * 40}
    104                  height={16}
    105                  rounded="sm"
    
  • L168

    ts
    166                <Skeleton width={20} height={20} rounded="sm" animation={animation} />
    167                <Skeleton
    168                  width={80 + Math.random() * 60}
    169                  height={16}
    170                  rounded="sm"
    
  • L226

    ts
    224            <div key={i} className="flex items-center gap-2">
    225              <Skeleton
    226                width={50 + Math.random() * 50}
    227                height={14}
    228                rounded="sm"
    
  • L249

    ts
    247          <Skeleton
    248            key={i}
    249            width={60 + Math.random() * 40}
    250            height={32}
    251            rounded="full"
    

apps/veritas/web/src/lib/behavior-tracking/tracker.ts#

  • L26

    ts
    24  function generateId(): string {
    25    const timestamp = Date.now().toString(36);
    26    const random = Math.random().toString(36).substring(2, 10);
    27    return `${timestamp}_${random}`;
    28  }
    

apps/veritas/web/src/lib/offline/indexed-db.ts#

  • L557

    ts
    555   */
    556  function generateSyncId(): string {
    557    return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    558  }
    559
    

apps/veritas/web/src/lib/offline/sync-manager.ts#

  • L217

    ts
    215      );
    216      // Add jitter to prevent thundering herd
    217      return delay + Math.random() * 1000;
    218    }
    219
    

apps/yemaya/api/__tests__/integration/mocks.ts#

  • L279

    ts
    277
    278    const maybeThrow = () => {
    279      if (failureRate > 0 && Math.random() < failureRate) {
    280        throw new Error('Simulated database failure');
    281      }
    

apps/yemaya/api/__tests__/integration/setup.ts#

  • L251

    ts
    249   */
    250  export const testData = {
    251    email: () => `test-${Date.now()}-${Math.random().toString(36).slice(2)}@example.com`,
    252    password: () => `Pass${Date.now()}!`,
    253    name: () => `Test User ${Date.now()}`,
    

apps/yemaya/api/src/middleware/gdpr-compliance.ts#

  • L580

    ts
    578    }): BreachRecord {
    579      const now = new Date();
    580      const id = `BREACH-${Date.now()}-${Math.random().toString(36).substring(2, 8).toUpperCase()}`;
    581
    582      const riskScore = this.calculateRiskScore(
    
  • L1066

    ts
    1064    ): DPIA {
    1065      const now = new Date();
    1066      const id = `DPIA-${Date.now()}-${Math.random().toString(36).substring(2, 8).toUpperCase()}`;
    1067
    1068      const dpia: DPIA = {
    
  • L1097

    ts
    1095      }
    1096
    1097      const riskId = `RISK-${Date.now()}-${Math.random().toString(36).substring(2, 6).toUpperCase()}`;
    1098
    1099      dpia.risks.push({
    
  • L1286

    ts
    1284    ): ProcessingActivity {
    1285      const now = new Date();
    1286      const id = `ROPA-${Date.now()}-${Math.random().toString(36).substring(2, 8).toUpperCase()}`;
    1287
    1288      const activity: ProcessingActivity = {
    
  • L1610

    ts
    1608    ): ConsentRecord {
    1609      const now = new Date();
    1610      const id = `CONSENT-${Date.now()}-${Math.random().toString(36).substring(2, 8).toUpperCase()}`;
    1611
    1612      // Merge with defaults (strictly_necessary is always true)
    

apps/yemaya/api/src/middleware/rate-limit.ts#

  • L229

    ts
    227      // Add new entry with current timestamp as score
    228      for (let i = 0; i < cost; i++) {
    229        pipeline.zadd(fullKey, now + i, `${now}-${Math.random()}`);
    230      }
    231
    
  • L621

    ts
    619      const pipeline = this.redis.pipeline();
    620      pipeline.zremrangebyscore(fullKey, 0, windowStart);
    621      pipeline.zadd(fullKey, now, `${now}-${Math.random()}`);
    622      pipeline.zcard(fullKey);
    623      pipeline.expire(fullKey, windowSeconds + 60);
    
  • L1236

    ts
    1234        pipeline.incrby(fullKey, count);
    1235        pipeline.expire(fullKey, 86400 + 3600); // 25 hours to ensure full day coverage
    1236        pipeline.zadd(burstKey, Date.now(), `${Date.now()}-${Math.random()}`);
    1237        pipeline.expire(burstKey, 300);
    1238        await pipeline.exec();
    

apps/yemaya/api/src/middleware/request-id.ts#

  • L48

    ts
    46    // Fallback to timestamp + random
    47    const timestamp = Date.now().toString(36);
    48    const random = Math.random().toString(36).substring(2, 15);
    49    return `${timestamp}${random}`;
    50  }
    
  • L128

    ts
    126   */
    127  export function createChildRequestId(parentId: string): string {
    128    const suffix = Math.random().toString(36).substring(2, 8);
    129    return `${parentId}.${suffix}`;
    130  }
    

apps/yemaya/api/src/routes/auth.ts#

  • L435

    ts
    433
    434    // Add numbers
    435    suggestions.push(`${cleanBase}${Math.floor(Math.random() * 100)}`);
    436    suggestions.push(`${cleanBase}_${Math.floor(Math.random() * 1000)}`);
    437
    
  • L436

    ts
    434    // Add numbers
    435    suggestions.push(`${cleanBase}${Math.floor(Math.random() * 100)}`);
    436    suggestions.push(`${cleanBase}_${Math.floor(Math.random() * 1000)}`);
    437
    438    // Add year
    
  • L452

    ts
    450    // Add random suffix
    451    const suffixes = ['dev', 'pro', 'official', 'real', 'hq'];
    452    const randomSuffix = suffixes[Math.floor(Math.random() * suffixes.length)];
    453    suggestions.push(`${cleanBase}_${randomSuffix}`);
    454
    

apps/yemaya/api/src/services/onboarding.ts#

  • L778

    ts
    776        // Create progress data
    777        const progressData: OnboardingProgressData = {
    778          id: `onboarding_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    779          userId: input.userId,
    780          currentStep: 'welcome',
    

apps/yemaya/api/src/services/preferences.ts#

  • L1354

    ts
    1352
    1353      const preferences: UserPreferencesData = {
    1354        id: `prefs_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    1355        userId,
    1356        theme: { ...DEFAULT_THEME_PREFERENCES },
    

apps/yemaya/api/src/services/proxy.ts#

  • L222

    ts
    220    const exponential = Math.min(maxDelay, baseDelay * Math.pow(2, attempt));
    221    // Full jitter: uniform random in [0, exponential]
    222    return Math.floor(Math.random() * exponential);
    223  }
    224
    

apps/yemaya/api/src/services/schedule-export.ts#

  • L175

    ts
    173  function generateId(prefix: string): string {
    174    const timestamp = Date.now().toString(36);
    175    const random = Math.random().toString(36).substring(2, 10);
    176    return `${prefix}-${timestamp}-${random}`;
    177  }
    
  • L1809

    ts
    1807      let token = 'shr_';
    1808      for (let i = 0; i < 32; i++) {
    1809        token += chars.charAt(Math.floor(Math.random() * chars.length));
    1810      }
    1811      return token;
    
  • L1821

    ts
    1819      let code = '';
    1820      for (let i = 0; i < 8; i++) {
    1821        code += chars.charAt(Math.floor(Math.random() * chars.length));
    1822      }
    1823      return code;
    

apps/yemaya/api/src/services/webhook.ts#

  • L628

    ts
    626      );
    627      // Full jitter (AWS-recommended) to decorrelate concurrent retry bursts
    628      return Math.floor(Math.random() * exponential);
    629    }
    630
    

apps/yemaya/api/src/services/websocket.ts#

  • L113

    ts
    111     */
    112    private generateConnectionId(): string {
    113      return `ws_${Date.now()}_${Math.random().toString(36).substring(2, 15)}`;
    114    }
    115
    

apps/yemaya/api/src/websocket/handler.ts#

  • L767

    ts
    765     */
    766    private generateId(): string {
    767      return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
    768    }
    769
    
  • L885

    ts
    883   *
    884   *     // Add jitter to prevent thundering herd
    885   *     const jitter = delay * 0.2 * Math.random();
    886   *
    887   *     setTimeout(() => {
    

apps/yemaya/studio-desktop/makers/maker-dmg.ts#

  • L254

    ts
    252  function generateUUID(): string {
    253    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    254      const r = (Math.random() * 16) | 0;
    255      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    256      return v.toString(16);
    

apps/yemaya/studio-desktop/makers/maker-pkg.ts#

  • L271

    ts
    269  function generateUUID(): string {
    270    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    271      const r = (Math.random() * 16) | 0;
    272      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    273      return v.toString(16);
    

apps/yemaya/studio-desktop/src/main/file-lock.ts#

  • L155

    ts
    153    private generateInstanceId(): string {
    154      return createHash('sha256')
    155        .update(`${process.pid}-${Date.now()}-${Math.random()}`)
    156        .digest('hex')
    157        .substring(0, 16);
    

apps/yemaya/studio-desktop/src/main/update-analytics.ts#

  • L130

    ts
    128    private generateSessionId(): string {
    129      return createHash('sha256')
    130        .update(Date.now().toString() + Math.random().toString())
    131        .digest('hex')
    132        .substring(0, 16);
    

apps/yemaya/studio-desktop/src/renderer/lib/projects.ts#

  • L37

    ts
    35
    36  function generateProjectId(): string {
    37    return `proj_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    38  }
    39
    

apps/yemaya/studio-desktop/src/renderer/pages/ProjectPage.tsx#

  • L327

    ts
    325
    326  const createPanel = (number: number): PanelDetail => ({
    327    id: `panel_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`,
    328    panelNumber: number,
    329    shot: {
    
  • L330

    ts
    328    panelNumber: number,
    329    shot: {
    330      id: `shot_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`,
    331      shotType: 'medium',
    332      angle: 'eye_level',
    
  • L1003

    ts
    1001      const now = new Date().toISOString();
    1002      const storyboard: StoryboardFile = {
    1003        id: `storyboard_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`,
    1004        title: newStoryboardTitle.trim(),
    1005        description: '',
    
  • L1175

    ts
    1173      const payload: StoryboardRecord = {
    1174        ...updated,
    1175        id: `storyboard_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`,
    1176        panels: updated.panels.map((panel, index) => ({
    1177          ...panel,
    

apps/yemaya/studio-web/src/components/layout/Panel.tsx#

  • L349

    ts
    347      ref
    348    ) => {
    349      const panelId = useRef(id ?? `panel-${Math.random().toString(36).substring(2, 9)}`);
    350      const { direction, registerPanel, unregisterPanel, getPanelSize } = usePanelGroup();
    351      const [isCollapsed, setIsCollapsed] = useState(defaultCollapsed);
    

apps/yemaya/studio-web/src/hooks/useBackgroundSync.ts#

  • L64

    ts
    62   */
    63  function generateSyncId(): string {
    64    return `sync-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    65  }
    66
    

apps/yemaya/studio-web/src/hooks/useLayoutPersistence.ts#

  • L267

    ts
    265    // Save a new preset
    266    const savePreset = useCallback((name: string, state: LayoutState): string => {
    267      const id = `preset-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    268      const newPreset: LayoutPreset = { id, name, state };
    269      setPresets((prev) => [...prev, newPreset]);
    

apps/yemaya/studio-web/src/lib/accessibility.ts#

  • L425

    ts
    423
    424    if (!idRef.current) {
    425      idRef.current = `${prefix}-${Math.random().toString(36).substr(2, 9)}`;
    426    }
    427
    

apps/yemaya/studio-web/src/lib/pwa.ts#

  • L108

    ts
    106     */
    107    add(type: string, data: unknown): string {
    108      const id = `sync-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    109      const item: SyncQueueItem = {
    110        id,
    

apps/yemaya/studio-web/src/lib/routeAnalytics.ts#

  • L102

    ts
    100
    101    // Create new session ID
    102    sessionId = `session-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    103    sessionStorage.setItem('yemaya-analytics-session', sessionId);
    104
    
  • L187

    ts
    185    }
    186
    187    isSampled = Math.random() < config.sampleRate;
    188    return isSampled;
    189  }
    

apps/yemaya/studio-web/src/stores/aiStore.ts#

  • L408

    ts
    406
    407  function generateId(): string {
    408    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    409  }
    410
    

apps/yemaya/studio-web/src/stores/appStore.ts#

  • L274

    ts
    272            // Notification Actions
    273            addNotification: (notification: Omit<Notification, 'id'>) => {
    274              const id = `notification-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    275              set((state: Draft<AppState>) => {
    276                state.notifications.push({ ...notification, id });
    

apps/yemaya/studio-web/src/stores/bellonaStore.ts#

  • L379

    ts
    377
    378  function generateId(): string {
    379    return `bellona-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    380  }
    381
    

apps/yemaya/studio-web/src/stores/collaborationStore.ts#

  • L418

    ts
    416
    417  function generateId(): string {
    418    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    419  }
    420
    
  • L439

    ts
    437      '#f43f5e',
    438    ];
    439    return colors[Math.floor(Math.random() * colors.length)] ?? '#3b82f6';
    440  }
    441
    

apps/yemaya/studio-web/src/stores/hathorStore.ts#

  • L451

    ts
    449
    450  function generateId(): string {
    451    return `hathor-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    452  }
    453
    

apps/yemaya/studio-web/src/stores/isisStore.ts#

  • L355

    ts
    353
    354  function generateId(): string {
    355    return `isis-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    356  }
    357
    

apps/yemaya/studio-web/src/stores/optimistic.ts#

  • L109

    ts
    107
    108    // Generate unique mutation ID
    109    const generateId = () => `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    110
    111    // Rollback a mutation
    
  • L421

    ts
    419    const conflicts: Map<string, Conflict<T>> = new Map();
    420
    421    const generateId = () => `conflict-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    422
    423    const detectConflict = (localState: Partial<T>, serverState: Partial<T>): Conflict<T> | null => {
    
  • L591

    ts
    589    let activeCount = 0;
    590
    591    const generateId = () => `queue-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    592
    593    const processQueue = async () => {
    

apps/yemaya/studio-web/src/stores/sophiaStore.ts#

  • L311

    ts
    309
    310  function generateId(): string {
    311    return `sophia-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    312  }
    313
    

docs/training/examples/civitai-examples.ts#

  • L996

    ts
    994
    995        // Exponential backoff with jitter
    996        delay = Math.min(delay * 2 + Math.random() * 1000, maxDelayMs);
    997      }
    998    }
    

docs/training/examples/comfyui-examples.ts#

  • L110

    ts
    108        sampler: 'euler_ancestral',
    109        scheduler: 'normal',
    110        seed: Math.floor(Math.random() * 2147483647),
    111      },
    112
    
  • L849

    ts
    847
    848        // Exponential backoff with jitter
    849        delay = Math.min(delay * 2 + Math.random() * 1000, 30000);
    850      }
    851    }
    

docs/training/examples/elevenlabs-examples.ts#

  • L852

    ts
    850
    851        // Calculate next delay with jitter
    852        const jitter = Math.random() * 0.2 * delay;
    853        delay = Math.min(delay * options.backoffMultiplier + jitter, options.maxDelayMs);
    854      }
    

docs/training/exercises/02-intermediate-solutions.ts#

  • L254

    ts
    252
    253        // Add jitter (0-25% of delay)
    254        const jitter = delay * Math.random() * 0.25;
    255        const waitTime = Math.min(delay + jitter, maxDelayMs);
    256
    

libs/aglaea/avatar-creation/src/avatar-generator.ts#

  • L292

    ts
    290  /** Generate a unique avatar ID */
    291  function generateAvatarId(): string {
    292    return `avatar_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    293  }
    294
    

libs/aglaea/database/src/read-replica.ts#

  • L278

    ts
    276          return this.selectByLeastLag(candidates);
    277        case 'random':
    278          return candidates[Math.floor(Math.random() * candidates.length)];
    279        case 'zone_affinity':
    280          return this.selectByZoneAffinity(candidates);
    

libs/aglaea/enhanced-skin-analysis/src/privacy-engine.ts#

  • L28

    ts
    26    // Laplace noise via inverse CDF: -b * sign(u) * ln(1 - 2|u|), u ~ Uniform(-0.5, 0.5)
    27    const b = sensitivity / epsilon;
    28    const u = Math.random() - 0.5;
    29    const sign = u >= 0 ? 1 : -1;
    30    const noise = -b * sign * Math.log(1 - 2 * Math.abs(u));
    
  • L50

    ts
    48
    49    // Box-Muller transform for Gaussian noise
    50    const u1 = Math.random();
    51    const u2 = Math.random();
    52    const z = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L51

    ts
    49    // Box-Muller transform for Gaussian noise
    50    const u1 = Math.random();
    51    const u2 = Math.random();
    52    const z = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    53    return value + sigma * z;
    

libs/aglaea/events/src/consumer.ts#

  • L23

    ts
    21    }
    22    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    23      const r = (Math.random() * 16) | 0;
    24      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    25      return v.toString(16);
    

libs/aglaea/events/src/helpers.ts#

  • L23

    ts
    21    // RFC 4122 version 4 UUID
    22    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    23      const r = (Math.random() * 16) | 0;
    24      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    25      return v.toString(16);
    

libs/aglaea/gamification/src/implementation.ts#

  • L596

    ts
    594    const points = calculatePoints(actionType, streakMultiplier);
    595    return {
    596      id: `txn-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    597      userId,
    598      actionType,
    

libs/aglaea/generative-design/src/design-engine.ts#

  • L634

    ts
    632
    633    return {
    634      id: `design-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    635      prompt,
    636      visualizationSpec,
    

libs/aglaea/inspiration-feed/src/feed-algorithms.ts#

  • L457

    ts
    455
    456    // Seeded random for reproducibility
    457    const rng = seed !== undefined ? createSeededRandom(seed) : Math.random;
    458
    459    // Score perturbation: add random noise proportional to randomnessFactor
    

libs/aglaea/inspiration-feed/src/implementation.ts#

  • L492

    ts
    490        (mode === 'personalized' &&
    491          preferences.discoveryOpenness > 0.5 &&
    492          Math.random() < preferences.discoveryOpenness * 0.3);
    493
    494      const effectiveStyleMatch = isDiscovery ? (1 - styleMatch) * 0.5 : styleMatch;
    

libs/aglaea/memory-system/src/memory-system.ts#

  • L345

    ts
    343  ): MemoryEntry {
    344    return {
    345      id: `mem-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`,
    346      userId,
    347      type,
    

libs/aglaea/multi-modal-input/src/multi-modal-input.ts#

  • L187

    ts
    185  ): TextInput {
    186    return {
    187      id: `txt-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`,
    188      type: 'text',
    189      timestamp: Date.now(),
    
  • L214

    ts
    212  ): ImageInput {
    213    return {
    214      id: `img-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`,
    215      type: 'image',
    216      timestamp: Date.now(),
    
  • L248

    ts
    246  ): VoiceInput {
    247    return {
    248      id: `vox-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`,
    249      type: 'voice',
    250      timestamp: Date.now(),
    

libs/aglaea/outfit-sharing/src/implementation.ts#

  • L326

    ts
    324
    325      const post: OutfitPost = {
    326        id: `post-${platformId}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    327        outfit: input.outfit,
    328        caption: formatted.caption,
    

libs/aglaea/personal-shopper-ai/src/response-generator.ts#

  • L1361

    ts
    1359      }
    1360      // Slight randomness to avoid always choosing the same template
    1361      score += Math.random() * 0.5;
    1362
    1363      if (score > bestScore) {
    

libs/aglaea/sdk/src/batch.ts#

  • L42

    ts
    40  function nextBatchId(): string {
    41    batchIdCounter += 1;
    42    return `batch-${batchIdCounter}-${Math.random().toString(36).slice(2, 8)}`;
    43  }
    44
    

libs/aglaea/sdk/src/http-client.ts#

  • L45

    ts
    43  export function generateRequestId(): string {
    44    requestCounter += 1;
    45    const random = Math.random().toString(36).slice(2, 10);
    46    return `agl-${requestCounter}-${random}`;
    47  }
    

libs/aglaea/sdk/src/retry.ts#

  • L56

    ts
    54  export function calculateBackoff(attempt: number, baseDelayMs: number, maxDelayMs: number): number {
    55    const exponential = baseDelayMs * Math.pow(2, attempt);
    56    const jitter = Math.random() * baseDelayMs;
    57    return Math.min(exponential + jitter, maxDelayMs);
    58  }
    

libs/aglaea/sdk/src/websocket.ts#

  • L44

    ts
    42  function nextMessageId(): string {
    43    wsMessageCounter += 1;
    44    return `msg-${wsMessageCounter}-${Math.random().toString(36).slice(2, 8)}`;
    45  }
    46
    

libs/aglaea/smart-mirror/src/mirror-protocol.ts#

  • L347

    ts
    345
    346    return {
    347      sessionId: `session_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`,
    348      userId: '',
    349      startTime: Date.now(),
    

libs/aglaea/smart-mirror/src/user-management.ts#

  • L336

    ts
    334   */
    335  export function activateGuestMode(): GuestSession {
    336    const sessionId = `guest_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    337
    338    const features = [
    

libs/aglaea/testing/src/chaos.ts#

  • L39

    ts
    37    /**
    38     * @param seed Optional seed for deterministic randomness in tests.
    39     *   When provided, uses a simple seeded PRNG. When omitted, uses Math.random.
    40     */
    41    constructor(seed?: number) {
    
  • L52

    ts
    50        };
    51      } else {
    52        this._rng = Math.random;
    53      }
    54    }
    

libs/aglaea/unified-profile/src/profile-aggregator.ts#

  • L395

    ts
    393  function generateProfileId(): string {
    394    const timestamp = Date.now().toString(36);
    395    const random = Math.random().toString(36).slice(2, 8);
    396    return `up_${timestamp}_${random}`;
    397  }
    

libs/aglaea/virtual-tryon-accessories/src/material-rendering.ts#

  • L696

    ts
    694        color,
    695        intensity: Math.min(1, intensity),
    696        size: 0.03 + Math.random() * 0.07 * (1 + dispersionFactor * 5),
    697      });
    698    }
    

libs/aglaea/virtual-tryon-fashion/src/garment-visualization.ts#

  • L800

    ts
    798      const xPos = minX + (width * (i + 0.5)) / numFolds;
    799      // Fold depth inversely related to stiffness
    800      const depth = (1 - stiffness) * 0.5 * (0.5 + Math.random() * 0.5);
    801      // Fold runs vertically (along gravity) with slight variance
    802      const xOffset = width * 0.02 * (Math.random() - 0.5);
    
  • L802

    ts
    800      const depth = (1 - stiffness) * 0.5 * (0.5 + Math.random() * 0.5);
    801      // Fold runs vertically (along gravity) with slight variance
    802      const xOffset = width * 0.02 * (Math.random() - 0.5);
    803
    804      foldLines.push({
    

libs/aglaea/wardrobe-management/src/organization.ts#

  • L628

    ts
    626
    627  function generateId(): string {
    628    return `col_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    629  }
    630
    

libs/airmid/api/src/database-connectors.ts#

  • L1338

    ts
    1336
    1337    // Add jitter: random value between 0 and baseDelay
    1338    const jitter = Math.random() * baseDelay;
    1339
    1340    // Cap at maxDelay
    

libs/airmid/docking/src/molecular-docking.ts#

  • L793

    ts
    791    const indices = new Set<number>();
    792    while (indices.size < 4) {
    793      indices.add(Math.floor(Math.random() * atoms.length));
    794    }
    795    const arr = Array.from(indices).map((i) => atoms[i]);
    

libs/airmid/docking/src/qsar-modeling.ts#

  • L633

    ts
    631      const sample: Array<{ descriptors: number[]; activity: number }> = [];
    632      for (let i = 0; i < nSamples; i++) {
    633        const idx = Math.floor(Math.random() * nSamples);
    634        bagIndices.add(idx);
    635        sample.push(trainingData[idx]);
    
  • L815

    ts
    813    // Fisher-Yates partial shuffle
    814    for (let i = 0; i < Math.min(k, n); i++) {
    815      const j = i + Math.floor(Math.random() * (n - i));
    816      [indices[i], indices[j]] = [indices[j], indices[i]];
    817    }
    
  • L958

    ts
    956  function fisherYatesShuffle<T>(array: T[]): void {
    957    for (let i = array.length - 1; i > 0; i--) {
    958      const j = Math.floor(Math.random() * (i + 1));
    959      [array[i], array[j]] = [array[j], array[i]];
    960    }
    

libs/airmid/ml/src/advanced-learning.ts#

  • L372

    ts
    370    return update.map((v) => {
    371      // Box-Muller transform for Gaussian noise
    372      const u1 = Math.random();
    373      const u2 = Math.random();
    374      const noise = sigma * Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L373

    ts
    371      // Box-Muller transform for Gaussian noise
    372      const u1 = Math.random();
    373      const u2 = Math.random();
    374      const noise = sigma * Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    375      return v + noise;
    

libs/airmid/ml/src/explainable-ai.ts#

  • L226

    ts
    224  function shuffleArray<T>(arr: T[]): T[] {
    225    for (let i = arr.length - 1; i > 0; i--) {
    226      const j = Math.floor(Math.random() * (i + 1));
    227      [arr[i], arr[j]] = [arr[j], arr[i]];
    228    }
    

libs/airmid/ml/src/generative-models.ts#

  • L174

    ts
    172      Array.from({ length: d }, () => {
    173        // Box-Muller transform for normal distribution sampling
    174        const u1 = Math.random();
    175        const u2 = Math.random();
    176        return Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L175

    ts
    173        // Box-Muller transform for normal distribution sampling
    174        const u1 = Math.random();
    175        const u2 = Math.random();
    176        return Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    177      });
    

libs/airmid/ml/src/graph-neural-networks.ts#

  • L611

    ts
    609    // Xavier-like initialization: uniform in [-1/√d, 1/√d]
    610    const scale = 1 / Math.sqrt(dim);
    611    const vec = Array.from({ length: dim }, () => (Math.random() * 2 - 1) * scale);
    612    // L2 normalize
    613    const norm = l2norm(vec);
    
  • L684

    ts
    682    for (let epoch = 0; epoch < epochs; epoch++) {
    683      // Shuffle triples
    684      const shuffled = [...triples].sort(() => Math.random() - 0.5);
    685
    686      for (const triple of shuffled) {
    
  • L695

    ts
    693
    694        // Generate negative triple by corrupting head or tail
    695        const corruptHead = Math.random() < 0.5;
    696        const randomEntity = entityList[Math.floor(Math.random() * entityList.length)];
    697        const hNeg = corruptHead ? embeddings.get(randomEntity)! : h;
    
  • L696

    ts
    694        // Generate negative triple by corrupting head or tail
    695        const corruptHead = Math.random() < 0.5;
    696        const randomEntity = entityList[Math.floor(Math.random() * entityList.length)];
    697        const hNeg = corruptHead ? embeddings.get(randomEntity)! : h;
    698        const tNeg = corruptHead ? t : embeddings.get(randomEntity)!;
    

libs/airmid/quality/src/dna-barcoding-data.ts#

  • L198

    ts
    196   * Advance a 32-bit state via xorshift+multiply (xmxmx mixing). Produces
    197   * decorrelated successive integers used for sampling mutation positions and
    198   * alternate bases. Avoids any reliance on Math.random for full determinism.
    199   */
    200  function nextHash(state: number): number {
    

libs/aja/asset-storage/src/asset-manager.ts#

  • L710

    ts
    708    private generateAssetId(): string {
    709      const timestamp = Date.now().toString(36);
    710      const random = Math.random().toString(36).substring(2, 10);
    711      return `ast_${timestamp}${random}`;
    712    }
    

libs/aja/asset-storage/src/automatic-archival.ts#

  • L650

    ts
    648
    649    private generateJobId(): string {
    650      return `job_${Date.now().toString(36)}${Math.random().toString(36).substring(2, 8)}`;
    651    }
    652
    
  • L654

    ts
    652
    653    private generateTaskId(): string {
    654      return `task_${Date.now().toString(36)}${Math.random().toString(36).substring(2, 8)}`;
    655    }
    656
    

libs/aja/asset-storage/src/cdn-distribution.ts#

  • L305

    ts
    303
    304    private generateInvalidationId(): string {
    305      return `inv_${Date.now().toString(36)}${Math.random().toString(36).substring(2, 8)}`;
    306    }
    307  }
    

libs/aja/avatar-integration/src/fitness-pipeline.ts#

  • L1034

    ts
    1032
    1033    // Select cue based on context
    1034    let selectedCue = cues[Math.floor(Math.random() * cues.length)];
    1035
    1036    // Modify based on context
    

libs/aja/avatar-preview-ui/src/hooks/useABTest.ts#

  • L157

    ts
    155    const shuffled = [...array];
    156    for (let i = shuffled.length - 1; i > 0; i--) {
    157      const j = Math.floor(Math.random() * (i + 1));
    158      [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
    159    }
    

libs/aja/batch-inference/src/memory-manager.ts#

  • L72

    ts
    70      // Create new buffer if pool has space
    71      if (this.totalSize + size <= this.sizeLimit) {
    72        const id = `pool_${Date.now()}_${Math.random().toString(36).slice(2)}`;
    73        const buffer = new ArrayBuffer(size);
    74        const entry: PoolEntry = {
    
  • L91

    ts
    89
    90      if (this.totalSize + size <= this.sizeLimit) {
    91        const id = `pool_${Date.now()}_${Math.random().toString(36).slice(2)}`;
    92        const buffer = new ArrayBuffer(size);
    93        const entry: PoolEntry = {
    

libs/aja/bone-mapping-ui/src/types.ts#

  • L1105

    ts
    1103   */
    1104  export function generateId(): string {
    1105    return `${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 9)}`;
    1106  }
    1107
    

libs/aja/depth-sensing/src/sensor-driver.ts#

  • L356

    ts
    354            // Body shape at ~2m
    355            const depth = (2.0 - 0.2 * (1 - dist)) / depthScale;
    356            depthData[idx] = Math.round(depth + Math.random() * 10);
    357          } else if (dist < 4) {
    358            // Background at ~3m
    
  • L359

    ts
    357          } else if (dist < 4) {
    358            // Background at ~3m
    359            depthData[idx] = Math.round(3.0 / depthScale + Math.random() * 50);
    360          } else {
    361            // Invalid/distant
    
  • L393

    ts
    391
    392        for (let i = 0; i < colorData.length; i += 4) {
    393          colorData[i] = 128 + Math.floor(Math.random() * 64); // R
    394          colorData[i + 1] = 100 + Math.floor(Math.random() * 64); // G
    395          colorData[i + 2] = 80 + Math.floor(Math.random() * 64); // B
    
  • L394

    ts
    392        for (let i = 0; i < colorData.length; i += 4) {
    393          colorData[i] = 128 + Math.floor(Math.random() * 64); // R
    394          colorData[i + 1] = 100 + Math.floor(Math.random() * 64); // G
    395          colorData[i + 2] = 80 + Math.floor(Math.random() * 64); // B
    396          colorData[i + 3] = 255; // A
    
  • L395

    ts
    393          colorData[i] = 128 + Math.floor(Math.random() * 64); // R
    394          colorData[i + 1] = 100 + Math.floor(Math.random() * 64); // G
    395          colorData[i + 2] = 80 + Math.floor(Math.random() * 64); // B
    396          colorData[i + 3] = 255; // A
    397        }
    

libs/aja/distributed-workers/src/fault-tolerance.ts#

  • L221

    ts
    219
    220      // Simulate occasional failures (would be real health endpoint in production)
    221      if (Math.random() < 0.01) {
    222        throw new Error('Health check timeout');
    223      }
    

libs/aja/distributed-workers/src/kubernetes.ts#

  • L238

    ts
    236     */
    237    async createJob(config: JobConfig): Promise<Job> {
    238      const jobId = `job-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    239
    240      const job: Job = {
    
  • L296

    ts
    294     */
    295    async createWorker(config: WorkerConfig, namespace: Namespace, jobId?: JobId): Promise<Worker> {
    296      const workerId = `worker-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    297      const workerName = `${config.namePrefix}-${workerId.substring(7)}`;
    298
    

libs/aja/domain-motion-pipelines/src/dance-pipeline.ts#

  • L829

    ts
    827
    828  function generateId(): string {
    829    return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    830  }
    831
    

libs/aja/domain-motion-pipelines/src/martial-arts-pipeline.ts#

  • L462

    ts
    460
    461  function generateId(): string {
    462    return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    463  }
    464
    

libs/aja/fitness-animation/src/pose-estimation/tracking.ts#

  • L820

    ts
    818   */
    819  function generateId(): string {
    820    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    821  }
    822
    

libs/aja/fitness-animation/src/secondary/secondary-motion.ts#

  • L440

    ts
    438        rootPos,
    439        direction,
    440        hairLength * (0.8 + Math.random() * 0.4),
    441        segments,
    442        {
    
  • L444

    ts
    442        {
    443          type: 'hair',
    444          stiffness: 0.6 + Math.random() * 0.3,
    445          damping: 0.92 + Math.random() * 0.05,
    446          windInfluence: 0.8 + Math.random() * 0.4,
    
  • L445

    ts
    443          type: 'hair',
    444          stiffness: 0.6 + Math.random() * 0.3,
    445          damping: 0.92 + Math.random() * 0.05,
    446          windInfluence: 0.8 + Math.random() * 0.4,
    447          attachedJoint: 'head',
    
  • L446

    ts
    444          stiffness: 0.6 + Math.random() * 0.3,
    445          damping: 0.92 + Math.random() * 0.05,
    446          windInfluence: 0.8 + Math.random() * 0.4,
    447          attachedJoint: 'head',
    448        }
    

libs/aja/fitness-animation/src/skeletal/skeleton-factory.ts#

  • L548

    ts
    546   */
    547  function generateSkeletonId(): string {
    548    return `skeleton_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    549  }
    550
    

libs/aja/human-mesh-recovery/src/smpl-recovery.ts#

  • L794

    ts
    792
    793        // Compute confidences
    794        const jointConfidences = mesh.joints.map(() => 0.9 + Math.random() * 0.1);
    795
    796        people.push({
    
  • L885

    ts
    883      const features = new Float32Array(this.featureSize);
    884      for (let i = 0; i < this.featureSize; i++) {
    885        features[i] = (Math.random() - 0.5) * 2;
    886      }
    887      return features;
    
  • L899

    ts
    897
    898      // Add some variation
    899      params.shape.betas = params.shape.betas.map(() => (Math.random() - 0.5) * 0.5);
    900      params.pose.bodyPose = params.pose.bodyPose.map(() => ({
    901        x: (Math.random() - 0.5) * 0.3,
    
  • L901

    ts
    899      params.shape.betas = params.shape.betas.map(() => (Math.random() - 0.5) * 0.5);
    900      params.pose.bodyPose = params.pose.bodyPose.map(() => ({
    901        x: (Math.random() - 0.5) * 0.3,
    902        y: (Math.random() - 0.5) * 0.3,
    903        z: (Math.random() - 0.5) * 0.3,
    
  • L902

    ts
    900      params.pose.bodyPose = params.pose.bodyPose.map(() => ({
    901        x: (Math.random() - 0.5) * 0.3,
    902        y: (Math.random() - 0.5) * 0.3,
    903        z: (Math.random() - 0.5) * 0.3,
    904      }));
    
  • L903

    ts
    901        x: (Math.random() - 0.5) * 0.3,
    902        y: (Math.random() - 0.5) * 0.3,
    903        z: (Math.random() - 0.5) * 0.3,
    904      }));
    905
    
  • L969

    ts
    967        // Project joints with estimated camera
    968        const joints2D = this.projectJoints(mesh.joints, camera);
    969        const jointConfidences = mesh.joints.map(() => 0.88 + Math.random() * 0.12);
    970
    971        // CLIFF provides world-grounded translation
    
  • L1179

    ts
    1177          joints3D: mesh.joints,
    1178          joints2D: this.projectJoints(mesh.joints, camera),
    1179          jointConfidences: mesh.joints.map(() => 0.85 + Math.random() * 0.15),
    1180          camera,
    1181        });
    
  • L1227

    ts
    1225      const features = new Float32Array(2048);
    1226      for (let i = 0; i < features.length; i++) {
    1227        features[i] = (Math.random() - 0.5) * 2;
    1228      }
    1229      return features;
    
  • L1242

    ts
    1240      const refinementScale = Math.pow(0.7, iteration);
    1241      updated.pose.bodyPose = params.pose.bodyPose.map((p) => ({
    1242        x: p.x + (Math.random() - 0.5) * 0.1 * refinementScale,
    1243        y: p.y + (Math.random() - 0.5) * 0.1 * refinementScale,
    1244        z: p.z + (Math.random() - 0.5) * 0.1 * refinementScale,
    
  • L1243

    ts
    1241      updated.pose.bodyPose = params.pose.bodyPose.map((p) => ({
    1242        x: p.x + (Math.random() - 0.5) * 0.1 * refinementScale,
    1243        y: p.y + (Math.random() - 0.5) * 0.1 * refinementScale,
    1244        z: p.z + (Math.random() - 0.5) * 0.1 * refinementScale,
    1245      }));
    
  • L1244

    ts
    1242        x: p.x + (Math.random() - 0.5) * 0.1 * refinementScale,
    1243        y: p.y + (Math.random() - 0.5) * 0.1 * refinementScale,
    1244        z: p.z + (Math.random() - 0.5) * 0.1 * refinementScale,
    1245      }));
    1246
    
  • L1263

    ts
    1261      // Add hand poses
    1262      updated.pose.leftHandPose = new Array(15).fill(null).map(() => ({
    1263        x: (Math.random() - 0.5) * 0.2,
    1264        y: (Math.random() - 0.5) * 0.2,
    1265        z: (Math.random() - 0.5) * 0.2,
    
  • L1264

    ts
    1262      updated.pose.leftHandPose = new Array(15).fill(null).map(() => ({
    1263        x: (Math.random() - 0.5) * 0.2,
    1264        y: (Math.random() - 0.5) * 0.2,
    1265        z: (Math.random() - 0.5) * 0.2,
    1266      }));
    
  • L1265

    ts
    1263        x: (Math.random() - 0.5) * 0.2,
    1264        y: (Math.random() - 0.5) * 0.2,
    1265        z: (Math.random() - 0.5) * 0.2,
    1266      }));
    1267
    
  • L1269

    ts
    1267
    1268      updated.pose.rightHandPose = new Array(15).fill(null).map(() => ({
    1269        x: (Math.random() - 0.5) * 0.2,
    1270        y: (Math.random() - 0.5) * 0.2,
    1271        z: (Math.random() - 0.5) * 0.2,
    
  • L1270

    ts
    1268      updated.pose.rightHandPose = new Array(15).fill(null).map(() => ({
    1269        x: (Math.random() - 0.5) * 0.2,
    1270        y: (Math.random() - 0.5) * 0.2,
    1271        z: (Math.random() - 0.5) * 0.2,
    1272      }));
    
  • L1271

    ts
    1269        x: (Math.random() - 0.5) * 0.2,
    1270        y: (Math.random() - 0.5) * 0.2,
    1271        z: (Math.random() - 0.5) * 0.2,
    1272      }));
    1273
    
  • L1281

    ts
    1279      // Add expression
    1280      updated.expression = {
    1281        expression: new Array(10).fill(0).map(() => Math.random() * 0.3),
    1282      };
    1283
    
  • L1352

    ts
    1350          joints3D: mesh.joints,
    1351          joints2D: this.projectJoints(mesh.joints, camera),
    1352          jointConfidences: mesh.joints.map(() => 0.9 + Math.random() * 0.1),
    1353          camera,
    1354          worldTranslation,
    
  • L1421

    ts
    1419      // Add temporal consistency
    1420      params.pose.bodyPose = params.pose.bodyPose.map(() => ({
    1421        x: (Math.random() - 0.5) * 0.25,
    1422        y: (Math.random() - 0.5) * 0.25,
    1423        z: (Math.random() - 0.5) * 0.25,
    
  • L1422

    ts
    1420      params.pose.bodyPose = params.pose.bodyPose.map(() => ({
    1421        x: (Math.random() - 0.5) * 0.25,
    1422        y: (Math.random() - 0.5) * 0.25,
    1423        z: (Math.random() - 0.5) * 0.25,
    1424      }));
    
  • L1423

    ts
    1421        x: (Math.random() - 0.5) * 0.25,
    1422        y: (Math.random() - 0.5) * 0.25,
    1423        z: (Math.random() - 0.5) * 0.25,
    1424      }));
    1425
    
  • L1508

    ts
    1506          joints3D: mesh.joints,
    1507          joints2D: this.projectJoints(mesh.joints, camera),
    1508          jointConfidences: mesh.joints.map(() => 0.92 + Math.random() * 0.08),
    1509          camera,
    1510          worldTranslation,
    
  • L1539

    ts
    1537        const f = new Float32Array(512);
    1538        for (let j = 0; j < f.length; j++) {
    1539          f[j] = (Math.random() - 0.5) * 2;
    1540        }
    1541        features.push(f);
    
  • L1558

    ts
    1556      // Temporal attention produces smoother results
    1557      params.pose.bodyPose = params.pose.bodyPose.map(() => ({
    1558        x: (Math.random() - 0.5) * 0.2,
    1559        y: (Math.random() - 0.5) * 0.2,
    1560        z: (Math.random() - 0.5) * 0.2,
    
  • L1559

    ts
    1557      params.pose.bodyPose = params.pose.bodyPose.map(() => ({
    1558        x: (Math.random() - 0.5) * 0.2,
    1559        y: (Math.random() - 0.5) * 0.2,
    1560        z: (Math.random() - 0.5) * 0.2,
    1561      }));
    
  • L1560

    ts
    1558        x: (Math.random() - 0.5) * 0.2,
    1559        y: (Math.random() - 0.5) * 0.2,
    1560        z: (Math.random() - 0.5) * 0.2,
    1561      }));
    1562
    
  • L1700

    ts
    1698          joints3D: mesh.joints,
    1699          joints2D: this.projectJoints(mesh.joints, camera),
    1700          jointConfidences: mesh.joints.map(() => 0.88 + Math.random() * 0.12),
    1701          camera,
    1702          worldTranslation,
    

libs/aja/human-mesh-recovery/src/smplx-body.ts#

  • L151

    ts
    149        for (let i = 0; i < 45; i++) {
    150          // Simplified PCA basis
    151          this.handPCABasis[c * 45 + i] = c === i ? 1.0 : (Math.random() - 0.5) * 0.1;
    152        }
    153      }
    
  • L314

    ts
    312
    313        // Add small noise for realism
    314        x += (Math.random() - 0.5) * 5;
    315        y += (Math.random() - 0.5) * 5;
    316
    
  • L315

    ts
    313        // Add small noise for realism
    314        x += (Math.random() - 0.5) * 5;
    315        y += (Math.random() - 0.5) * 5;
    316
    317        keypoints.push({ x, y });
    
  • L734

    ts
    732          // Nose
    733          const t = (i - 27) / 8;
    734          x = cx + (Math.random() - 0.5) * bbox.width * 0.1;
    735          y = cy - bbox.height * 0.1 + t * bbox.height * 0.25;
    736        } else if (i <= 41) {
    
  • L754

    ts
    752
    753        // Add noise
    754        x += (Math.random() - 0.5) * 2;
    755        y += (Math.random() - 0.5) * 2;
    756
    
  • L755

    ts
    753        // Add noise
    754        x += (Math.random() - 0.5) * 2;
    755        y += (Math.random() - 0.5) * 2;
    756
    757        landmarks.push({ x, y });
    

libs/aja/model-optimization/src/mixed-precision.ts#

  • L839

    ts
    837        const activations = new Float32Array(batch.batchSize * 1024);
    838        for (let i = 0; i < activations.length; i++) {
    839          activations[i] = (Math.random() - 0.5) * 2; // Range [-1, 1]
    840        }
    841
    

libs/aja/motion-formats/src/alembic.ts#

  • L661

    ts
    659
    660        const clip: AnimationClip = {
    661          id: `abc_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    662          name: json.hierarchy.name || 'Alembic Animation',
    663          skeleton,
    

libs/aja/motion-formats/src/bvh.ts#

  • L677

    ts
    675
    676        const clip: AnimationClip = {
    677          id: `bvh_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    678          name: name || 'BVH Animation',
    679          skeleton,
    

libs/aja/motion-formats/src/clip-database.ts#

  • L739

    ts
    737    createCollection(name: string, description?: string): MotionClipCollection {
    738      const collection: MotionClipCollection = {
    739        id: `collection_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    740        name,
    741        description,
    

libs/aja/motion-formats/src/fbx.ts#

  • L1219

    ts
    1217
    1218        const clip: AnimationClip = {
    1219          id: `fbx_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    1220          name: this.extractAnimationName(nodes) || 'FBX Animation',
    1221          skeleton,
    
  • L1337

    ts
    1335      return {
    1336        node: {
    1337          id: String(Math.random()),
    1338          name,
    1339          type: 'Root' as FBXNodeType,
    
  • L1467

    ts
    1465
    1466          result.push({
    1467            id: String(Math.random()),
    1468            name,
    1469            type: 'Root' as FBXNodeType,
    

libs/aja/motion-formats/src/gltf.ts#

  • L843

    ts
    841
    842        const clip: AnimationClip = {
    843          id: `gltf_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    844          name: gltf.animations?.[this.options.animationIndex]?.name || 'glTF Animation',
    845          skeleton,
    

libs/aja/motion-formats/src/mocap-import.ts#

  • L426

    ts
    424
    425        const clip: AnimationClip = {
    426          id: `c3d_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    427          name: 'C3D Motion Capture',
    428          skeleton,
    
  • L722

    ts
    720
    721        const clip: AnimationClip = {
    722          id: `trc_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    723          name: 'TRC Motion Capture',
    724          skeleton,
    
  • L1110

    ts
    1108
    1109        const clip: AnimationClip = {
    1110          id: `asf_amc_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    1111          name: asfFile.name || 'ASF/AMC Motion',
    1112          skeleton,
    

libs/aja/motion-formats/src/usd.ts#

  • L666

    ts
    664
    665        const clip: AnimationClip = {
    666          id: `usd_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    667          name: usdFile.defaultPrim || 'USD Animation',
    668          skeleton,
    

libs/aja/motion-integration/src/bellona/adapter.ts#

  • L95

    ts
    93    const exponentialDelay = initialDelayMs * Math.pow(multiplier, attempt - 1);
    94    const clampedDelay = Math.min(exponentialDelay, maxDelayMs);
    95    const jitter = clampedDelay * (0.1 + Math.random() * 0.1);
    96    return clampedDelay + jitter;
    97  }
    

libs/aja/motion-integration/src/isis/adapter.ts#

  • L93

    ts
    91    const exponentialDelay = initialDelayMs * Math.pow(multiplier, attempt - 1);
    92    const clampedDelay = Math.min(exponentialDelay, maxDelayMs);
    93    const jitter = clampedDelay * (0.1 + Math.random() * 0.1);
    94    return clampedDelay + jitter;
    95  }
    

libs/aja/motion-integration/src/sophia/adapter.ts#

  • L96

    ts
    94    const exponentialDelay = initialDelayMs * Math.pow(multiplier, attempt - 1);
    95    const clampedDelay = Math.min(exponentialDelay, maxDelayMs);
    96    const jitter = clampedDelay * (0.1 + Math.random() * 0.1);
    97    return clampedDelay + jitter;
    98  }
    

libs/aja/motion-integration/src/yemaya/adapter.ts#

  • L102

    ts
    100    const clampedDelay = Math.min(exponentialDelay, maxDelayMs);
    101    // Add 10-20% jitter to prevent thundering herd
    102    const jitter = clampedDelay * (0.1 + Math.random() * 0.1);
    103    return clampedDelay + jitter;
    104  }
    

libs/aja/motion-pipeline-sdk/src/client.ts#

  • L123

    ts
    121    const clampedDelay = Math.min(exponentialDelay, maxDelayMs);
    122    // Add jitter: 0.5 to 1.5 times the delay
    123    const jitter = 0.5 + Math.random();
    124    return Math.floor(clampedDelay * jitter);
    125  }
    

libs/aja/motion-processing/src/gap-filling.ts#

  • L845

    ts
    843            const noiseScale = 0.01;
    844            interpolated.position = {
    845              x: basePos.x + (Math.random() - 0.5) * noiseScale,
    846              y: basePos.y + (Math.random() - 0.5) * noiseScale,
    847              z: basePos.z + (Math.random() - 0.5) * noiseScale,
    
  • L846

    ts
    844            interpolated.position = {
    845              x: basePos.x + (Math.random() - 0.5) * noiseScale,
    846              y: basePos.y + (Math.random() - 0.5) * noiseScale,
    847              z: basePos.z + (Math.random() - 0.5) * noiseScale,
    848            };
    
  • L847

    ts
    845              x: basePos.x + (Math.random() - 0.5) * noiseScale,
    846              y: basePos.y + (Math.random() - 0.5) * noiseScale,
    847              z: basePos.z + (Math.random() - 0.5) * noiseScale,
    848            };
    849          }
    

libs/aja/motion-quality/src/qa-pipeline.ts#

  • L37

    ts
    35   */
    36  function generateId(): string {
    37    return `qa-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    38  }
    39
    

libs/aja/motion-validation/src/edge-case-testing.ts#

  • L210

    ts
    208
    209          case 'random':
    210            shouldOcclude = Math.random() < (options.probability ?? 0.3);
    211            break;
    212        }
    
  • L392

    ts
    390
    391      // Decide if this frame has jitter
    392      if (Math.random() >= options.frequency) {
    393        continue;
    394      }
    
  • L402

    ts
    400
    401        let jitter: Point3D = {
    402          x: (Math.random() - 0.5) * 2 * options.magnitude,
    403          y: (Math.random() - 0.5) * 2 * options.magnitude,
    404          z: (Math.random() - 0.5) * 2 * options.magnitude,
    
  • L403

    ts
    401        let jitter: Point3D = {
    402          x: (Math.random() - 0.5) * 2 * options.magnitude,
    403          y: (Math.random() - 0.5) * 2 * options.magnitude,
    404          z: (Math.random() - 0.5) * 2 * options.magnitude,
    405        };
    
  • L404

    ts
    402          x: (Math.random() - 0.5) * 2 * options.magnitude,
    403          y: (Math.random() - 0.5) * 2 * options.magnitude,
    404          z: (Math.random() - 0.5) * 2 * options.magnitude,
    405        };
    406
    
  • L441

    ts
    439    let gapStart: number;
    440    if (options.location === 'random') {
    441      gapStart = Math.floor(Math.random() * (frameCount - options.frameCount));
    442    } else if (options.location === 'middle') {
    443      gapStart = Math.floor((frameCount - options.frameCount) / 2);
    
  • L524

    ts
    522      let location: number;
    523      do {
    524        location = startFrame + Math.floor(Math.random() * availableFrames);
    525      } while (spikeLocations.some((loc) => Math.abs(loc - location) < options.duration * 2));
    526      spikeLocations.push(location);
    
  • L919

    ts
    917        'perlin',
    918      ];
    919      const noiseType = noiseTypes[Math.floor(Math.random() * noiseTypes.length)];
    920      const magnitude = 0.01 + params.severity * 0.1; // 1cm to 11cm
    921
    
  • L962

    ts
    960      const truncationPercent = params.severity * 50; // Up to 50% truncation
    961      const locations: Array<'start' | 'end' | 'both'> = ['start', 'end', 'both'];
    962      const location = locations[Math.floor(Math.random() * locations.length)];
    963
    964      return {
    
  • L1120

    ts
    1118     */
    1119    private selectRandomSubset<T>(items: T[], count: number): T[] {
    1120      const shuffled = [...items].sort(() => Math.random() - 0.5);
    1121      return shuffled.slice(0, count);
    1122    }
    

libs/aja/motion-validation/src/ground-truth.ts#

  • L1859

    ts
    1857        const target = Math.min(this.config.targetSamplesPerCategory, categorySamples.length);
    1858        // Simple random selection
    1859        const shuffled = [...categorySamples].sort(() => Math.random() - 0.5);
    1860        balanced.push(...shuffled.slice(0, target));
    1861      }
    
  • L1906

    ts
    1904
    1905      // Shuffle samples
    1906      const shuffled = [...this.samples].sort(() => Math.random() - 0.5);
    1907      const foldSize = Math.ceil(shuffled.length / folds);
    1908
    

libs/aja/motion-validation/src/human-evaluation.ts#

  • L93

    ts
    91  export function shuffleArray<T>(array: T[], seed?: number): T[] {
    92    const shuffled = [...array];
    93    let currentSeed = seed ?? Math.random() * 10000;
    94
    95    const random = () => {
    

libs/aja/motion-validation/src/types.ts#

  • L1673

    ts
    1671   */
    1672  export function generateId(): string {
    1673    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    1674  }
    

libs/aja/multi-view-reconstruction/src/calibration.ts#

  • L530

    ts
    528      const numMarkers = Math.min(
    529        4,
    530        Math.max(2, contours.length || Math.floor(Math.random() * 8) + 2)
    531      );
    532      for (let i = 0; i < numMarkers; i++) {
    
  • L533

    ts
    531      );
    532      for (let i = 0; i < numMarkers; i++) {
    533        const cx = 100 + i * 100 + Math.random() * 50;
    534        const cy = 100 + (i % 2) * 150 + Math.random() * 50;
    535
    
  • L534

    ts
    532      for (let i = 0; i < numMarkers; i++) {
    533        const cx = 100 + i * 100 + Math.random() * 50;
    534        const cy = 100 + (i % 2) * 150 + Math.random() * 50;
    535
    536        markers.push({
    
  • L1716

    ts
    1714    ): number[] {
    1715      // Return simulated errors
    1716      return cameras.map(() => Math.random() * 2);
    1717    }
    1718
    
  • L1760

    ts
    1758      const indices: number[] = [];
    1759      while (indices.length < count && indices.length < max) {
    1760        const idx = Math.floor(Math.random() * max);
    1761        if (!indices.includes(idx)) {
    1762          indices.push(idx);
    

libs/aja/multi-view-reconstruction/src/fusion.ts#

  • L777

    ts
    775      for (let iter = 0; iter < iterations; iter++) {
    776        // Randomly select 2 observations
    777        const shuffled = [...observations].sort(() => Math.random() - 0.5);
    778        const sample = shuffled.slice(0, Math.min(2, shuffled.length));
    779
    

libs/aja/multi-view-reconstruction/src/triangulation.ts#

  • L1042

    ts
    1040      const indices: number[] = [];
    1041      while (indices.length < count && indices.length < max) {
    1042        const idx = Math.floor(Math.random() * max);
    1043        if (!indices.includes(idx)) {
    1044          indices.push(idx);
    

libs/aja/neural-retargeting/src/networks/layers.ts#

  • L62

    ts
    60    for (let i = 0; i < size; i++) {
    61      // Box-Muller transform
    62      const u1 = Math.random();
    63      const u2 = Math.random();
    64      data[i] = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2) * std + mean;
    
  • L63

    ts
    61      // Box-Muller transform
    62      const u1 = Math.random();
    63      const u2 = Math.random();
    64      data[i] = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2) * std + mean;
    65    }
    

libs/aja/neural-retargeting/src/networks/transformer.ts#

  • L640

    ts
    638        for (let j = 0; j < joints; j++) {
    639          const idx = (b * frames + f) * joints + j;
    640          if (Math.random() < maskRatio) {
    641            mask[idx] = 1; // Marked as masked
    642            // Zero out the masked joint
    

libs/aja/pipeline-parallelism/src/memory-pipeline.ts#

  • L522

    ts
    520      targetGpu?: GPUId
    521    ): string {
    522      const transferId = `transfer-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    523
    524      this.pendingTransfers.set(transferId, {
    

libs/aja/pipeline-parallelism/src/scheduler.ts#

  • L300

    ts
    298     */
    299    enqueue<T>(data: T, priority = 0, metadata: Record<string, unknown> = {}): ItemId {
    300      const itemId = `item-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    301      const item = createPipelineItem(itemId, data, priority, metadata);
    302
    

libs/aja/pose-lifting/src/camera-estimation.ts#

  • L642

    ts
    640      const indices: number[] = [];
    641      while (indices.length < count && indices.length < max) {
    642        const idx = Math.floor(Math.random() * max);
    643        if (!indices.includes(idx)) {
    644          indices.push(idx);
    

libs/aja/pose-lifting/src/depth-estimation.ts#

  • L248

    ts
    246        const scale = Math.sqrt(2.0 / w.length);
    247        for (let i = 0; i < w.length; i++) {
    248          w[i] = (Math.random() - 0.5) * 2 * scale;
    249        }
    250      }
    
  • L346

    ts
    344          // Simple radial depth pattern + noise
    345          const baseDepth = 0.5 + 0.3 * dist;
    346          const noise = (Math.random() - 0.5) * 0.1;
    347
    348          // Add some structure based on input luminance
    
  • L497

    ts
    495        const scale = Math.sqrt(2.0 / w.length);
    496        for (let i = 0; i < w.length; i++) {
    497          w[i] = (Math.random() - 0.5) * 2 * scale;
    498        }
    499      }
    
  • L583

    ts
    581          // Simulate metric depth (typical indoor scene: 0.5m - 5m)
    582          const baseDepth = 1.5 + 2.0 * dist;
    583          const noise = (Math.random() - 0.5) * 0.2;
    584
    585          // Clamp to valid range
    
  • L722

    ts
    720        const scale = Math.sqrt(2.0 / w.length);
    721        for (let i = 0; i < w.length; i++) {
    722          w[i] = (Math.random() - 0.5) * 2 * scale;
    723        }
    724      }
    
  • L798

    ts
    796
    797          const baseDepth = 0.3 + 0.5 * dist;
    798          const noise = (Math.random() - 0.5) * 0.05;
    799
    800          output[y * width + x] = Math.max(0, Math.min(1, baseDepth + noise));
    

libs/aja/pose-lifting/src/lifting-networks.ts#

  • L257

    ts
    255        const scale = Math.sqrt(2.0 / weights.length);
    256        for (let i = 0; i < weights.length; i++) {
    257          weights[i] = (Math.random() - 0.5) * 2 * scale;
    258        }
    259      }
    
  • L623

    ts
    621        const scale = Math.sqrt(2.0 / w.length);
    622        for (let i = 0; i < w.length; i++) {
    623          w[i] = (Math.random() - 0.5) * 2 * scale;
    624        }
    625      }
    
  • L644

    ts
    642        // Learnable (random init)
    643        for (let i = 0; i < this.spatialPositionEmbed!.length; i++) {
    644          this.spatialPositionEmbed![i] = (Math.random() - 0.5) * 0.02;
    645        }
    646      }
    
  • L659

    ts
    657      } else {
    658        for (let i = 0; i < this.temporalPositionEmbed!.length; i++) {
    659          this.temporalPositionEmbed![i] = (Math.random() - 0.5) * 0.02;
    660        }
    661      }
    
  • L1237

    ts
    1235        const scale = Math.sqrt(2.0 / w.length);
    1236        for (let i = 0; i < w.length; i++) {
    1237          w[i] = (Math.random() - 0.5) * 2 * scale;
    1238        }
    1239      }
    
  • L1576

    ts
    1574        const scale = Math.sqrt(2.0 / w.length);
    1575        for (let i = 0; i < w.length; i++) {
    1576          w[i] = (Math.random() - 0.5) * 2 * scale;
    1577        }
    1578      }
    
  • L1938

    ts
    1936        const scale = Math.sqrt(2.0 / w.length);
    1937        for (let i = 0; i < w.length; i++) {
    1938          w[i] = (Math.random() - 0.5) * 2 * scale;
    1939        }
    1940      }
    

libs/aja/result-aggregation/src/conflict-resolver.ts#

  • L105

    ts
    103
    104    return {
    105      id: `conflict-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    106      type: 'duplicate_chunk',
    107      resultIds: results.map((r) => r.id),
    
  • L145

    ts
    143        if (frameRangesOverlap(group1[0], group2[0])) {
    144          conflicts.push({
    145            id: `conflict-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    146            type: 'data_mismatch',
    147            resultIds: [...group1.map((r) => r.id), ...group2.map((r) => r.id)],
    
  • L178

    ts
    176    if (variance > 0.3) {
    177      return {
    178        id: `conflict-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    179        type: 'quality_variance',
    180        resultIds: results.map((r) => r.id),
    
  • L205

    ts
    203
    204    return {
    205      id: `conflict-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    206      type: 'version_conflict',
    207      resultIds: results.map((r) => r.id),
    
  • L234

    ts
    232      if (frameRangesOverlap(current, next)) {
    233        conflicts.push({
    234          id: `conflict-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    235          type: 'overlapping_range',
    236          resultIds: [current.id, next.id],
    

libs/aja/result-aggregation/src/final-assembler.ts#

  • L274

    ts
    272      extractItems: (result: WorkerResult<T>) => T[]
    273    ): Promise<AssembledOutput<T>> {
    274      const batchId = `batch-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    275      this.stats.startedAt = Date.now();
    276      this.stats.totalResultsCollected = results.length;
    

libs/aja/result-aggregation/src/result-collector.ts#

  • L636

    ts
    634    const now = Date.now();
    635    return {
    636      id: `result-${now}-${Math.random().toString(36).substr(2, 9)}`,
    637      jobId,
    638      chunkId,
    

libs/aje/bitcoin/src/lightning/invoices.ts#

  • L547

    ts
    545   * predictable hash lets a node steal forwarded HTLCs by precomputing
    546   * the preimage. We use the platform CSPRNG via
    547   * `@noble/hashes/utils.randomBytes` instead of `Math.random()`, which
    548   * is a Mersenne Twister with no security guarantees.
    549   */
    

libs/aje/wallets/src/mpc/tss.ts#

  • L148

    ts
    146   * coefficients are uniformly random in [0, order). They MUST come from
    147   * a real CSPRNG; sourced via `crypto.getRandomValues`. Throws if no
    148   * CSPRNG is available — a Math.random() fallback would collapse the
    149   * security of the entire threshold scheme to ~32 bits.
    150   *
    

libs/aje/wallets/src/social-login/providers.ts#

  • L373

    ts
    371   * The token IS the bearer credential delivered to the user's inbox; an
    372   * attacker who can guess it logs in as the user. The previous
    373   * implementation hashed `email:now:Math.random()`, leaving roughly the
    374   * 32 bits of `Math.random()` entropy as the only defence — brute-forced
    375   * in seconds knowing the email and approximate timestamp. We now sample
    
  • L374

    ts
    372   * attacker who can guess it logs in as the user. The previous
    373   * implementation hashed `email:now:Math.random()`, leaving roughly the
    374   * 32 bits of `Math.random()` entropy as the only defence — brute-forced
    375   * in seconds knowing the email and approximate timestamp. We now sample
    376   * 32 fresh bytes from the platform CSPRNG.
    

libs/aphrodite/advanced-music/src/generative-ambient-types.ts#

  • L617

    ts
    615    clockSource: () => Date.now(),
    616    idSource: () => `gen-${++_generativeAmbientIdCounter}`,
    617    randomSource: () => Math.random(),
    618  };
    

libs/aphrodite/advanced-music/src/memory.ts#

  • L14

    ts
    12
    13  function generateId(): string {
    14    return `mm-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    15  }
    16
    

libs/aphrodite/advanced-music/src/performer-control.ts#

  • L14

    ts
    12
    13  function generateId(): string {
    14    return `pc-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    15  }
    16
    

libs/aphrodite/advanced-music/src/world-music/world-music-types.ts#

  • L1003

    ts
    1001    clockSource: () => Date.now(),
    1002    idSource: () => `wm-${++_worldMusicIdCounter}`,
    1003    randomSource: () => Math.random(),
    1004  };
    

libs/aphrodite/age-verification/src/index.ts#

  • L285

    ts
    283  export function generateRequestId(prefix = 'vreq'): string {
    284    const timestamp = Date.now().toString(36);
    285    const random = Math.random().toString(36).substring(2, 10);
    286    return `${prefix}_${timestamp}_${random}`;
    287  }
    
  • L297

    ts
    295  export function generateSessionId(prefix = 'vsess'): string {
    296    const timestamp = Date.now().toString(36);
    297    const random = Math.random().toString(36).substring(2, 10);
    298    return `${prefix}_${timestamp}_${random}`;
    299  }
    

libs/aphrodite/agent-platform/src/autonomy/cost-management.ts#

  • L34

    ts
    32    let id = '';
    33    for (let i = 0; i < 21; i++) {
    34      id += chars[Math.floor(Math.random() * chars.length)];
    35    }
    36    return id;
    

libs/aphrodite/agent-platform/src/autonomy/graduated-control.ts#

  • L31

    ts
    29    let id = '';
    30    for (let i = 0; i < 21; i++) {
    31      id += chars[Math.floor(Math.random() * chars.length)];
    32    }
    33    return id;
    

libs/aphrodite/agent-platform/src/compliance/benchmarking.ts#

  • L28

    ts
    26    let id = '';
    27    for (let i = 0; i < 21; i++) {
    28      id += chars[Math.floor(Math.random() * chars.length)];
    29    }
    30    return id;
    

libs/aphrodite/agent-platform/src/compliance/incident-rollback.ts#

  • L30

    ts
    28    let id = '';
    29    for (let i = 0; i < 21; i++) {
    30      id += chars[Math.floor(Math.random() * chars.length)];
    31    }
    32    return id;
    

libs/aphrodite/agent-platform/src/compliance/regulatory-compliance.ts#

  • L30

    ts
    28    let id = '';
    29    for (let i = 0; i < 21; i++) {
    30      id += chars[Math.floor(Math.random() * chars.length)];
    31    }
    32    return id;
    

libs/aphrodite/agent-platform/src/data/pipeline.ts#

  • L28

    ts
    26    let id = '';
    27    for (let i = 0; i < 21; i++) {
    28      id += chars[Math.floor(Math.random() * chars.length)];
    29    }
    30    return id;
    
  • L449

    ts
    447          status: 'active',
    448          createdAt: new Date().toISOString(),
    449          value: Math.round(Math.random() * 1000) / 10,
    450        };
    451
    

libs/aphrodite/agent-platform/src/data/security.ts#

  • L45

    ts
    43    let id = '';
    44    for (let i = 0; i < 21; i++) {
    45      id += chars[Math.floor(Math.random() * chars.length)];
    46    }
    47    return id;
    

libs/aphrodite/agent-platform/src/knowledge/knowledge-base.ts#

  • L27

    ts
    25    let id = '';
    26    for (let i = 0; i < 21; i++) {
    27      id += chars[Math.floor(Math.random() * chars.length)];
    28    }
    29    return id;
    

libs/aphrodite/agent-platform/src/knowledge/workflow-templates.ts#

  • L27

    ts
    25    let id = '';
    26    for (let i = 0; i < 21; i++) {
    27      id += chars[Math.floor(Math.random() * chars.length)];
    28    }
    29    return id;
    

libs/aphrodite/agent-platform/src/monitoring/dashboard.ts#

  • L194

    ts
    192    let id = '';
    193    for (let i = 0; i < 21; i++) {
    194      id += chars[Math.floor(Math.random() * chars.length)];
    195    }
    196    return id;
    

libs/aphrodite/agent-platform/src/monitoring/training-pipeline.ts#

  • L200

    ts
    198     * `reshuffleSplits` produce identical splits — required for
    199     * reproducible model evaluation. When omitted, the dataset uses
    200     * `Math.random` (non-deterministic, suitable for production
    201     * online-learning where reproducibility is not a goal).
    202     */
    
  • L236

    ts
    234    let id = '';
    235    for (let i = 0; i < 21; i++) {
    236      id += chars[Math.floor(Math.random() * chars.length)];
    237    }
    238    return id;
    
  • L272

    ts
    270   *
    271   * The dataset constructor wires either a seeded Mulberry32 (when
    272   * `config.splitSeed` is set) or `Math.random` (otherwise). Seeded
    273   * mode guarantees reshuffleSplits + addExamples reproduce the same
    274   * splits across runs — required for reproducible model evaluation.
    
  • L416

    ts
    414
    415    constructor(private readonly config: TrainingPipelineConfig) {
    416      this._rng = config.splitSeed !== undefined ? createMulberry32(config.splitSeed) : Math.random;
    417    }
    418
    
  • L792

    ts
    790          default:
    791            // Unknown metric names get a normalised score derived from accuracy
    792            customMetrics.set(name, accuracy * (0.8 + Math.random() * 0.2));
    793        }
    794      }
    

libs/aphrodite/agent-platform/src/orchestration/framework.ts#

  • L47

    ts
    45    let id = '';
    46    for (let i = 0; i < 21; i++) {
    47      id += chars[Math.floor(Math.random() * chars.length)];
    48    }
    49    return id;
    

libs/aphrodite/agent-platform/src/orchestration/human-approval.ts#

  • L28

    ts
    26    let id = '';
    27    for (let i = 0; i < 21; i++) {
    28      id += chars[Math.floor(Math.random() * chars.length)];
    29    }
    30    return id;
    

libs/aphrodite/agent-platform/src/orchestration/scheduler.ts#

  • L22

    ts
    20    let id = '';
    21    for (let i = 0; i < 21; i++) {
    22      id += chars[Math.floor(Math.random() * chars.length)];
    23    }
    24    return id;
    

libs/aphrodite/agent-platform/src/testing/alerting.ts#

  • L32

    ts
    30    let id = '';
    31    for (let i = 0; i < 21; i++) {
    32      id += chars[Math.floor(Math.random() * chars.length)];
    33    }
    34    return id;
    

libs/aphrodite/agent-platform/src/testing/disaster-recovery.ts#

  • L36

    ts
    34    let id = '';
    35    for (let i = 0; i < 21; i++) {
    36      id += chars[Math.floor(Math.random() * chars.length)];
    37    }
    38    return id;
    

libs/aphrodite/agent-platform/src/testing/explainability.ts#

  • L33

    ts
    31    let id = '';
    32    for (let i = 0; i < 21; i++) {
    33      id += chars[Math.floor(Math.random() * chars.length)];
    34    }
    35    return id;
    

libs/aphrodite/agent-platform/src/testing/simulation-framework.ts#

  • L32

    ts
    30    let id = '';
    31    for (let i = 0; i < 21; i++) {
    32      id += chars[Math.floor(Math.random() * chars.length)];
    33    }
    34    return id;
    
  • L389

    ts
    387
    388      // Failure simulation
    389      if (effectiveFailureRate > 0 && Math.random() < effectiveFailureRate) {
    390        return {
    391          type: MockResponseType.ERROR,
    
  • L426

    ts
    424      const effectiveFailureRate = this.globalFailureRateOverride ?? api.failureRate;
    425
    426      if (effectiveFailureRate > 0 && Math.random() < effectiveFailureRate) {
    427        return {
    428          type: MockResponseType.ERROR,
    

libs/aphrodite/ai-assistant/src/afk-responder.ts#

  • L361

    ts
    359
    360      return {
    361        id: `response_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    362        messageId: classified.id,
    363        content,
    
  • L422

    ts
    420
    421      return {
    422        id: `response_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    423        messageId: classified.id,
    424        content: personalizedContent,
    
  • L508

    ts
    506
    507    private getRandomTemplate(templates: string[]): string {
    508      return templates[Math.floor(Math.random() * templates.length)];
    509    }
    510
    
  • L544

    ts
    542      if (personality.speechStyle.preferredPhrases.length > 0) {
    543        // Occasionally append a signature phrase
    544        if (Math.random() > 0.7) {
    545          const phrase = this.getRandomTemplate(personality.speechStyle.preferredPhrases);
    546          result = `${result} ${phrase}`;
    
  • L554

    ts
    552        personality.speechStyle.useEmojis &&
    553        personality.speechStyle.signatureEmojis.length > 0 &&
    554        Math.random() > 0.5
    555      ) {
    556        const emoji = this.getRandomTemplate(personality.speechStyle.signatureEmojis);
    
  • L733

    ts
    731    private calculateDelay(): number {
    732      const { min, max } = this.config.responseDelay;
    733      return min + Math.random() * (max - min);
    734    }
    735
    
  • L783

    ts
    781
    782      this.session = {
    783        id: `afk_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    784        broadcasterId: this.personality?.broadcasterId ?? 'unknown',
    785        status: 'afk',
    

libs/aphrodite/ai-assistant/src/ai-assistant.ts#

  • L788

    ts
    786
    787        return {
    788          id: `llm-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    789          content: responseContent,
    790          type: 'chat',
    

libs/aphrodite/ai-assistant/src/conversation-manager.ts#

  • L572

    ts
    570      metadata: Record<string, unknown> = {}
    571    ): ConversationThread {
    572      const id = `thread-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    573
    574      const thread: ConversationThread = {
    
  • L932

    ts
    930     */
    931    async summarize(messages: ThreadMessage[], threadId: string): Promise<ConversationSummary> {
    932      const id = `summary-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    933      const topics = this.topicExtractor.extractTopics(messages);
    934      const sentiment = this.sentimentAnalyzer.analyzeThread(messages);
    

libs/aphrodite/ai-assistant/src/personality.ts#

  • L360

    ts
    358
    359      const personality: BroadcasterPersonality = {
    360        id: `personality_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    361        broadcasterId,
    362        name: overrides?.name ?? preset.name,
    
  • L419

    ts
    417
    418      const personality: BroadcasterPersonality = {
    419        id: `personality_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    420        broadcasterId,
    421        name: options.name,
    

libs/aphrodite/ai-assistant/src/question-answerer.ts#

  • L722

    ts
    720
    721      return {
    722        id: `answer-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    723        content: finalAnswer,
    724        type: 'answer',
    
  • L761

    ts
    759
    760      // Add catchphrases occasionally
    761      if (style.catchphrases.length > 0 && Math.random() < 0.2) {
    762        const catchphrase = style.catchphrases[Math.floor(Math.random() * style.catchphrases.length)];
    763        modified = `${modified} ${catchphrase}`;
    
  • L762

    ts
    760      // Add catchphrases occasionally
    761      if (style.catchphrases.length > 0 && Math.random() < 0.2) {
    762        const catchphrase = style.catchphrases[Math.floor(Math.random() * style.catchphrases.length)];
    763        modified = `${modified} ${catchphrase}`;
    764      }
    
  • L807

    ts
    805      ];
    806
    807      if (Math.random() < 0.3) {
    808        const phrase = warmPhrases[Math.floor(Math.random() * warmPhrases.length)];
    809        return `${phrase} ${text}`;
    
  • L808

    ts
    806
    807      if (Math.random() < 0.3) {
    808        const phrase = warmPhrases[Math.floor(Math.random() * warmPhrases.length)];
    809        return `${phrase} ${text}`;
    810      }
    
  • L816

    ts
    814    private personalizeForViewer(text: string, viewer: ViewerContext): string {
    815      // Use viewer's display name if we're greeting them
    816      if (viewer.displayName && Math.random() < 0.4) {
    817        // Add name at beginning or end sometimes
    818        if (Math.random() < 0.5) {
    
  • L818

    ts
    816      if (viewer.displayName && Math.random() < 0.4) {
    817        // Add name at beginning or end sometimes
    818        if (Math.random() < 0.5) {
    819          return `${viewer.displayName}, ${text.charAt(0).toLowerCase()}${text.slice(1)}`;
    820        }
    
  • L858

    ts
    856      }
    857
    858      let response = responses[Math.floor(Math.random() * responses.length)];
    859
    860      if (isEnthusiastic && !response.includes('!')) {
    
  • L865

    ts
    863
    864      return {
    865        id: `answer-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    866        content: response,
    867        type: 'unknown',
    
  • L925

    ts
    923
    924        return {
    925          id: `llm-answer-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    926          content: response,
    927          type: 'answer',
    

libs/aphrodite/ai-music/src/fingerprint.ts#

  • L162

    ts
    160        } else {
    161          const ext = (input.extension ?? 'wav').replace(/^\.+/, '');
    162          const tempName = `chromaprint-${process.pid}-${Date.now()}-${Math.floor(Math.random() * 1e9)}.${ext}`;
    163          path = joinPath(resolved.tempDir, tempName);
    164          await fs.writeFile(path, input.buffer);
    

libs/aphrodite/ai-music/src/variation.ts#

  • L503

    ts
    501      }
    502      case 'chromatic-mediant': {
    503        const offset = Math.random() > 0.5 ? 4 : 3;
    504        const newRoot = ((chord.root + offset) % 12) + Math.floor(chord.root / 12) * 12;
    505        return { ...chord, root: newRoot };
    

libs/aphrodite/analytics/src/events/index.ts#

  • L137

    ts
    135    ): Promise<boolean> {
    136      // Apply sampling
    137      if (this.config.samplingRate < 1.0 && Math.random() > this.config.samplingRate) {
    138        return false;
    139      }
    
  • L197

    ts
    195     */
    196    private generateEventId(): string {
    197      return `evt_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
    198    }
    199
    

libs/aphrodite/animation-triggers/src/trigger-evaluator.ts#

  • L69

    ts
    67
    68      case 'random_chance':
    69        return Math.random();
    70
    71      case 'goal_progress':
    
  • L275

    ts
    273        typeof condition.value === 'number' ? condition.value : parseFloat(String(condition.value));
    274      if (isNaN(chance)) return false;
    275      return Math.random() < chance;
    276    }
    277
    

libs/aphrodite/animations/src/animation-library.ts#

  • L971

    ts
    969      const animations = this.getByCategory(category);
    970      if (animations.length === 0) return undefined;
    971      return animations[Math.floor(Math.random() * animations.length)];
    972    }
    973
    

libs/aphrodite/ar-overlays/src/index.ts#

  • L337

    ts
    335        // Generate head pose
    336        const headPose: Rotation3D = {
    337          pitch: (Math.random() - 0.5) * 20,
    338          yaw: (Math.random() - 0.5) * 30,
    339          roll: (Math.random() - 0.5) * 10,
    
  • L338

    ts
    336        const headPose: Rotation3D = {
    337          pitch: (Math.random() - 0.5) * 20,
    338          yaw: (Math.random() - 0.5) * 30,
    339          roll: (Math.random() - 0.5) * 10,
    340        };
    
  • L339

    ts
    337          pitch: (Math.random() - 0.5) * 20,
    338          yaw: (Math.random() - 0.5) * 30,
    339          roll: (Math.random() - 0.5) * 10,
    340        };
    341
    
  • L354

    ts
    352          headPose,
    353          expressions,
    354          quality: 0.8 + Math.random() * 0.2,
    355          confidence: 0.9 + Math.random() * 0.1,
    356          meshVertices,
    
  • L355

    ts
    353          expressions,
    354          quality: 0.8 + Math.random() * 0.2,
    355          confidence: 0.9 + Math.random() * 0.1,
    356          meshVertices,
    357          meshTriangles: meshVertices ? this.generateMeshTriangles() : undefined,
    
  • L398

    ts
    396          position,
    397          position3D: { ...position, z: 0 },
    398          confidence: 0.9 + Math.random() * 0.1,
    399        });
    400      }
    
  • L414

    ts
    412
    413      const expressions: FaceExpression[] = ['neutral', 'happy', 'surprised'];
    414      const mainExpression = expressions[Math.floor(Math.random() * expressions.length)];
    415
    416      return [
    
  • L417

    ts
    415
    416      return [
    417        { expression: mainExpression, confidence: 0.7 + Math.random() * 0.3 },
    418        { expression: 'neutral', confidence: 0.3 + Math.random() * 0.2 },
    419      ];
    
  • L418

    ts
    416      return [
    417        { expression: mainExpression, confidence: 0.7 + Math.random() * 0.3 },
    418        { expression: 'neutral', confidence: 0.3 + Math.random() * 0.2 },
    419      ];
    420    }
    
  • L1456

    ts
    1454    private emitParticle(): void {
    1455      const lifetime =
    1456        this.config.lifetime + (Math.random() - 0.5) * 2 * this.config.lifetimeVariance;
    1457
    1458      this.particles.push({
    
  • L1459

    ts
    1457
    1458      this.particles.push({
    1459        x: (Math.random() - 0.5) * this.config.emitterSize.x,
    1460        y: (Math.random() - 0.5) * this.config.emitterSize.y,
    1461        vx: this.config.velocity.x + (Math.random() - 0.5) * 2 * this.config.velocityVariance.x,
    
  • L1460

    ts
    1458      this.particles.push({
    1459        x: (Math.random() - 0.5) * this.config.emitterSize.x,
    1460        y: (Math.random() - 0.5) * this.config.emitterSize.y,
    1461        vx: this.config.velocity.x + (Math.random() - 0.5) * 2 * this.config.velocityVariance.x,
    1462        vy: this.config.velocity.y + (Math.random() - 0.5) * 2 * this.config.velocityVariance.y,
    
  • L1461

    ts
    1459        x: (Math.random() - 0.5) * this.config.emitterSize.x,
    1460        y: (Math.random() - 0.5) * this.config.emitterSize.y,
    1461        vx: this.config.velocity.x + (Math.random() - 0.5) * 2 * this.config.velocityVariance.x,
    1462        vy: this.config.velocity.y + (Math.random() - 0.5) * 2 * this.config.velocityVariance.y,
    1463        life: lifetime,
    
  • L1462

    ts
    1460        y: (Math.random() - 0.5) * this.config.emitterSize.y,
    1461        vx: this.config.velocity.x + (Math.random() - 0.5) * 2 * this.config.velocityVariance.x,
    1462        vy: this.config.velocity.y + (Math.random() - 0.5) * 2 * this.config.velocityVariance.y,
    1463        life: lifetime,
    1464        maxLife: lifetime,
    
  • L1467

    ts
    1465        size: this.config.startSize,
    1466        rotation: this.config.startRotation,
    1467        rotationSpeed: this.config.rotationSpeed * (Math.random() - 0.5) * 2,
    1468      });
    1469    }
    

libs/aphrodite/archive/src/accessibility/archive-a11y.ts#

  • L174

    ts
    172    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    173    let r = '';
    174    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    175    return `${prefix}-${r}`;
    176  }
    

libs/aphrodite/archive/src/analytics/archive-analytics.ts#

  • L165

    ts
    163    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    164    let r = '';
    165    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    166    return `${prefix}-${r}`;
    167  }
    

libs/aphrodite/archive/src/archive.ts#

  • L236

    ts
    234    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    235    let r = '';
    236    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    237    return `${prefix}-${r}`;
    238  }
    

libs/aphrodite/archive/src/clips/clip-generator.ts#

  • L117

    ts
    115    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    116    let r = '';
    117    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    118    return `${prefix}-${r}`;
    119  }
    

libs/aphrodite/archive/src/cultural/cultural-attribution.ts#

  • L146

    ts
    144    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    145    let r = '';
    146    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    147    return `${prefix}-${r}`;
    148  }
    

libs/aphrodite/archive/src/discovery/search-discovery.ts#

  • L147

    ts
    145    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    146    let r = '';
    147    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    148    return `${prefix}-${r}`;
    149  }
    

libs/aphrodite/archive/src/distribution/archive-distribution.ts#

  • L151

    ts
    149    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    150    let r = '';
    151    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    152    return `${prefix}-${r}`;
    153  }
    

libs/aphrodite/archive/src/distribution/vod-distribution.ts#

  • L119

    ts
    117    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    118    let r = '';
    119    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    120    return `${prefix}-${r}`;
    121  }
    

libs/aphrodite/archive/src/highlights/ai-highlights.ts#

  • L145

    ts
    143    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    144    let r = '';
    145    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    146    return `${prefix}-${r}`;
    147  }
    

libs/aphrodite/archive/src/i18n/archive-i18n.ts#

  • L175

    ts
    173    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    174    let r = '';
    175    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    176    return `${prefix}-${r}`;
    177  }
    

libs/aphrodite/archive/src/library/content-library.ts#

  • L168

    ts
    166    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    167    let r = '';
    168    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    169    return `${prefix}-${r}`;
    170  }
    

libs/aphrodite/archive/src/metadata/content-metadata.ts#

  • L119

    ts
    117    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    118    let r = '';
    119    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    120    return `${prefix}-${r}`;
    121  }
    

libs/aphrodite/archive/src/moderation/archive-moderation.ts#

  • L148

    ts
    146    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    147    let r = '';
    148    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    149    return `${prefix}-${r}`;
    150  }
    

libs/aphrodite/archive/src/monetization/vod-monetization.ts#

  • L132

    ts
    130    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    131    let r = '';
    132    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    133    return `${prefix}-${r}`;
    134  }
    

libs/aphrodite/archive/src/processing/post-production-pipeline.ts#

  • L200

    ts
    198    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    199    let r = '';
    200    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    201    return `${prefix}-${r}`;
    202  }
    

libs/aphrodite/archive/src/processing/post-production.ts#

  • L138

    ts
    136    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    137    let r = '';
    138    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    139    return `${prefix}-${r}`;
    140  }
    

libs/aphrodite/archive/src/recording/multi-angle.ts#

  • L115

    ts
    113    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    114    let r = '';
    115    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    116    return `${prefix}-${r}`;
    117  }
    

libs/aphrodite/archive/src/rights/archive-rights.ts#

  • L161

    ts
    159    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    160    let r = '';
    161    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    162    return `${prefix}-${r}`;
    163  }
    

libs/aphrodite/archive/src/search/content-search.ts#

  • L111

    ts
    109    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    110    let r = '';
    111    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    112    return `${prefix}-${r}`;
    113  }
    

libs/aphrodite/archive/src/storage/storage-optimization.ts#

  • L143

    ts
    141    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    142    let r = '';
    143    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    144    return `${prefix}-${r}`;
    145  }
    

libs/aphrodite/archive/src/tagging/content-enrichment.ts#

  • L140

    ts
    138    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    139    let r = '';
    140    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    141    return `${prefix}-${r}`;
    142  }
    

libs/aphrodite/archive/src/transcoding/content-transcoder.ts#

  • L219

    ts
    217    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    218    let r = '';
    219    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    220    return `${prefix}-${r}`;
    221  }
    

libs/aphrodite/arousal-engine/src/desire-types.ts#

  • L456

    ts
    454    },
    455    clockSource: () => Date.now(),
    456    randomSource: () => Math.random(),
    457  };
    

libs/aphrodite/arousal-engine/src/simulator-types.ts#

  • L744

    ts
    742    scenarioIntensity: 1.0,
    743    clockSource: () => Date.now(),
    744    randomSource: () => Math.random(),
    745  };
    

libs/aphrodite/audience-experience/src/audience-experience.ts#

  • L216

    ts
    214  /** Generate a unique session ID */
    215  export function generateSessionId(viewerId: string): string {
    216    return `session-${viewerId}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    217  }
    218
    
  • L234

    ts
    232
    233    constructor(config?: Partial<AudienceExperienceConfig>) {
    234      this.engineId = `audience-exp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    235      this.config = {
    236        sessionTimeoutMs: config?.sessionTimeoutMs ?? DEFAULT_SESSION_TIMEOUT_MS,
    

libs/aphrodite/audience-experience/src/community/audience-community.ts#

  • L184

    ts
    182  /** Generate a unique community ID */
    183  export function generateCommunityId(name: string): string {
    184    return `community-${name.toLowerCase().replace(/\s+/g, '-')}-${Math.random().toString(36).slice(2, 8)}`;
    185  }
    186
    
  • L203

    ts
    201
    202    constructor(config?: Partial<AudienceCommunityConfig>) {
    203      this.engineId = `community-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    204      this.config = {
    205        defaultMaxMembers: config?.defaultMaxMembers ?? DEFAULT_MAX_MEMBERS,
    
  • L365

    ts
    363
    364      const post: CommunityPost = {
    365        postId: `post-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    366        communityId,
    367        authorId,
    
  • L466

    ts
    464      if (!ruleList) return null;
    465      const rule: CommunityRule = {
    466        ruleId: `rule-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    467        communityId,
    468        title,
    

libs/aphrodite/audience-experience/src/engagement/viewer-engagement.ts#

  • L170

    ts
    168  /** Generate a unique interaction ID */
    169  export function generateInteractionId(viewerId: string, type: InteractionType): string {
    170    return `int-${viewerId}-${type}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    171  }
    172
    
  • L190

    ts
    188
    189    constructor(config?: Partial<ViewerEngagementConfig>) {
    190      this.engineId = `engagement-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    191      this.config = {
    192        scoringWindowMs: config?.scoringWindowMs ?? DEFAULT_SCORING_WINDOW_MS,
    

libs/aphrodite/audience-experience/src/feedback/audience-feedback.ts#

  • L231

    ts
    229
    230    constructor(config?: Partial<AudienceFeedbackConfig>) {
    231      this.engineId = `feedback-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    232      this.config = {
    233        minRating: config?.minRating ?? MIN_RATING,
    
  • L264

    ts
    262
    263      const rating: Rating = {
    264        ratingId: `rating-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    265        viewerId,
    266        targetId,
    
  • L295

    ts
    293
    294      const review: Review = {
    295        reviewId: `review-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    296        viewerId,
    297        targetId,
    
  • L346

    ts
    344      if (this.destroyed) throw new Error('Engine is destroyed');
    345      const survey: Survey = {
    346        surveyId: `survey-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    347        title,
    348        questions,
    
  • L368

    ts
    366
    367      const response: SurveyResponse = {
    368        responseId: `resp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    369        surveyId,
    370        viewerId,
    

libs/aphrodite/audience-experience/src/gamification/gamification-engine.ts#

  • L187

    ts
    185  /** Generate unique badge ID */
    186  export function generateBadgeId(category: AchievementCategory, name: string): string {
    187    return `badge-${category}-${name.toLowerCase().replace(/\s+/g, '-')}-${Math.random().toString(36).slice(2, 8)}`;
    188  }
    189
    
  • L205

    ts
    203
    204    constructor(config?: Partial<GamificationConfig>) {
    205      this.engineId = `gamification-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    206      this.config = {
    207        baseXpPerLevel: config?.baseXpPerLevel ?? BASE_XP_PER_LEVEL,
    
  • L294

    ts
    292      if (this.destroyed || !this.config.enableChallenges) return undefined;
    293      const challenge: Challenge = {
    294        challengeId: `challenge-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    295        name,
    296        description,
    

libs/aphrodite/audience-experience/src/loyalty/loyalty-program.ts#

  • L220

    ts
    218
    219    constructor(config?: Partial<LoyaltyProgramConfig>) {
    220      this.engineId = `loyalty-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    221      this.config = {
    222        pointsPerAction: config?.pointsPerAction ?? { ...POINTS_PER_ACTION },
    
  • L247

    ts
    245
    246      const now = Date.now();
    247      const memberId = `member-${viewerId}-${Math.random().toString(36).slice(2, 8)}`;
    248      const member: LoyaltyMember = {
    249        memberId,
    
  • L294

    ts
    292
    293      const tx: PointsTransaction = {
    294        transactionId: `tx-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    295        memberId,
    296        action,
    
  • L362

    ts
    360
    361      const redemption: Redemption = {
    362        redemptionId: `redemption-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    363        memberId,
    364        rewardId,
    

libs/aphrodite/audience-experience/src/notifications/notification-engine.ts#

  • L180

    ts
    178  /** Generate unique notification ID */
    179  export function generateNotificationId(): string {
    180    return `notif-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    181  }
    182
    
  • L198

    ts
    196
    197    constructor(config?: Partial<NotificationEngineConfig>) {
    198      this.engineId = `notif-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    199      this.config = {
    200        maxPerHour: config?.maxPerHour ?? MAX_NOTIFICATIONS_PER_HOUR,
    

libs/aphrodite/audience-experience/src/recommendations/content-recs.ts#

  • L202

    ts
    200
    201    constructor(config?: Partial<ContentRecsConfig>) {
    202      this.engineId = `recs-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    203      this.config = {
    204        defaultRecCount: config?.defaultRecCount ?? DEFAULT_REC_COUNT,
    

libs/aphrodite/audience-experience/src/social/social-features.ts#

  • L177

    ts
    175  /** Generate a unique message ID */
    176  export function generateMessageId(): string {
    177    return `msg-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    178  }
    179
    
  • L182

    ts
    180  /** Generate a unique room ID */
    181  export function generateRoomId(hostId: string): string {
    182    return `room-${hostId}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    183  }
    184
    
  • L204

    ts
    202
    203    constructor(config?: Partial<SocialFeaturesConfig>) {
    204      this.engineId = `social-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    205      this.config = {
    206        maxChatMessageLength: config?.maxChatMessageLength ?? MAX_CHAT_MESSAGE_LENGTH,
    
  • L258

    ts
    256      if (this.destroyed) throw new Error('Engine is destroyed');
    257      const reaction: Reaction = {
    258        reactionId: `react-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    259        viewerId,
    260        kind,
    
  • L278

    ts
    276      if (this.destroyed || !this.config.enableGifts) return null;
    277      const gift: VirtualGift = {
    278        giftId: `gift-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    279        senderId,
    280        recipientId,
    
  • L354

    ts
    352      if (this.destroyed) throw new Error('Engine is destroyed');
    353      const entry: ModerationEntry = {
    354        entryId: `mod-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    355        viewerId,
    356        action,
    

libs/aphrodite/audio-haptics/src/index.ts#

  • L48

    ts
    46
    47  function generateId(): string {
    48    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    49  }
    50
    

libs/aphrodite/auteur-camera/src/auteur-camera.ts#

  • L1058

    ts
    1056
    1057      // Probability-based shot change
    1058      if (Math.random() < this.config.shotChangeProbability) {
    1059        const shots = this.state.framing.preferredShots;
    1060        if (shots.length > 1) {
    
  • L1064

    ts
    1062          const available = shots.filter((s) => s !== this.state.currentShot);
    1063          if (available.length > 0) {
    1064            const newShot = available[Math.floor(Math.random() * available.length)];
    1065            this.changeShot(newShot);
    1066          }
    

libs/aphrodite/auteur-camera/src/montage.ts#

  • L141

    ts
    139    if (totalWeight === 0) return pool[0];
    140
    141    let r = Math.random() * totalWeight;
    142    for (const angle of pool) {
    143      r -= angle.weight;
    
  • L574

    ts
    572      if (totalWeight === 0) return copyAngle(this.availableAngles[0]);
    573
    574      let r = Math.random() * totalWeight;
    575      for (const angle of this.availableAngles) {
    576        r -= angle.weight;
    

libs/aphrodite/auteur-camera/src/sound-design.ts#

  • L1016

    ts
    1014
    1015      // Add irregularity
    1016      const irregularityFactor = 1 + (Math.random() - 0.5) * this.breath.irregularity * 0.3;
    1017      this.breath.cyclePhase = (this.breath.cyclePhase + phaseAdvance * irregularityFactor) % 1;
    1018
    

libs/aphrodite/avatar-customization-ui/src/components/AvatarCustomizationPanel.tsx#

  • L426

    ts
    424          hex:
    425            '#' +
    426            Math.floor(Math.random() * 16777215)
    427              .toString(16)
    428              .padStart(6, '0'),
    
  • L434

    ts
    432          ...value,
    433          bodyShape: {
    434            height: 0.85 + Math.random() * 0.3,
    435            shoulderWidth: Math.random(),
    436            hipWidth: Math.random(),
    
  • L435

    ts
    433          bodyShape: {
    434            height: 0.85 + Math.random() * 0.3,
    435            shoulderWidth: Math.random(),
    436            hipWidth: Math.random(),
    437            chestSize: Math.random(),
    
  • L436

    ts
    434            height: 0.85 + Math.random() * 0.3,
    435            shoulderWidth: Math.random(),
    436            hipWidth: Math.random(),
    437            chestSize: Math.random(),
    438            waistSize: Math.random(),
    
  • L437

    ts
    435            shoulderWidth: Math.random(),
    436            hipWidth: Math.random(),
    437            chestSize: Math.random(),
    438            waistSize: Math.random(),
    439            legLength: Math.random(),
    
  • L438

    ts
    436            hipWidth: Math.random(),
    437            chestSize: Math.random(),
    438            waistSize: Math.random(),
    439            legLength: Math.random(),
    440            armLength: Math.random(),
    
  • L439

    ts
    437            chestSize: Math.random(),
    438            waistSize: Math.random(),
    439            legLength: Math.random(),
    440            armLength: Math.random(),
    441            muscleDefinition: Math.random(),
    
  • L440

    ts
    438            waistSize: Math.random(),
    439            legLength: Math.random(),
    440            armLength: Math.random(),
    441            muscleDefinition: Math.random(),
    442            bodyFat: Math.random(),
    
  • L441

    ts
    439            legLength: Math.random(),
    440            armLength: Math.random(),
    441            muscleDefinition: Math.random(),
    442            bodyFat: Math.random(),
    443          },
    
  • L442

    ts
    440            armLength: Math.random(),
    441            muscleDefinition: Math.random(),
    442            bodyFat: Math.random(),
    443          },
    444          skinColor: randomColor(),
    

libs/aphrodite/avatar-customization-ui/src/hooks/useAvatarCustomization.ts#

  • L549

    ts
    547        hex:
    548          '#' +
    549          Math.floor(Math.random() * 16777215)
    550            .toString(16)
    551            .padStart(6, '0'),
    
  • L557

    ts
    555        ...state,
    556        bodyShape: {
    557          height: 0.85 + Math.random() * 0.3,
    558          shoulderWidth: Math.random(),
    559          hipWidth: Math.random(),
    
  • L558

    ts
    556        bodyShape: {
    557          height: 0.85 + Math.random() * 0.3,
    558          shoulderWidth: Math.random(),
    559          hipWidth: Math.random(),
    560          chestSize: Math.random(),
    
  • L559

    ts
    557          height: 0.85 + Math.random() * 0.3,
    558          shoulderWidth: Math.random(),
    559          hipWidth: Math.random(),
    560          chestSize: Math.random(),
    561          waistSize: Math.random(),
    
  • L560

    ts
    558          shoulderWidth: Math.random(),
    559          hipWidth: Math.random(),
    560          chestSize: Math.random(),
    561          waistSize: Math.random(),
    562          legLength: Math.random(),
    
  • L561

    ts
    559          hipWidth: Math.random(),
    560          chestSize: Math.random(),
    561          waistSize: Math.random(),
    562          legLength: Math.random(),
    563          armLength: Math.random(),
    
  • L562

    ts
    560          chestSize: Math.random(),
    561          waistSize: Math.random(),
    562          legLength: Math.random(),
    563          armLength: Math.random(),
    564          muscleDefinition: Math.random(),
    
  • L563

    ts
    561          waistSize: Math.random(),
    562          legLength: Math.random(),
    563          armLength: Math.random(),
    564          muscleDefinition: Math.random(),
    565          bodyFat: Math.random(),
    
  • L564

    ts
    562          legLength: Math.random(),
    563          armLength: Math.random(),
    564          muscleDefinition: Math.random(),
    565          bodyFat: Math.random(),
    566        },
    
  • L565

    ts
    563          armLength: Math.random(),
    564          muscleDefinition: Math.random(),
    565          bodyFat: Math.random(),
    566        },
    567        skinColor: randomColor(),
    

libs/aphrodite/avatar-customization-ui/src/types.ts#

  • L997

    ts
    995   */
    996  export function generatePresetId(): string {
    997    return `preset_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    998  }
    

libs/aphrodite/avatar-physics/src/wind-system.ts#

  • L243

    ts
    241    private randomGustTime(): number {
    242      const baseInterval = 1 / this.config.gustFrequency;
    243      return baseInterval * (0.5 + Math.random());
    244    }
    245
    

libs/aphrodite/avatar-renderer/src/model-loader.ts#

  • L1089

    ts
    1087     */
    1088    private generateModelId(): string {
    1089      return `model_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1090    }
    1091
    

libs/aphrodite/bidirectional-haptics/src/index.ts#

  • L54

    ts
    52
    53  function generateId(): string {
    54    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    55  }
    56
    
  • L61

    ts
    59    let code = '';
    60    for (let i = 0; i < length; i++) {
    61      code += chars[Math.floor(Math.random() * chars.length)];
    62    }
    63    return code;
    

libs/aphrodite/biometric-engine/src/bluetooth/bluetooth.ts#

  • L416

    ts
    414      if (
    415        this.dataConfig.disconnectProbability > 0 &&
    416        Math.random() < this.dataConfig.disconnectProbability
    417      ) {
    418        return { success: false, error: 'Connection rejected by device' };
    
  • L512

    ts
    510          // Vary RSSI
    511          this.currentRssi =
    512            this.dataConfig.rssi + (Math.random() - 0.5) * 2 * this.dataConfig.rssiVariability;
    513
    514          const value = this.generateCharacteristicValue(uuid);
    
  • L575

    ts
    573      this.sampleIndex++;
    574      const hrVariation =
    575        (Math.sin(this.sampleIndex * 0.1) + (Math.random() - 0.5) * 0.5) *
    576        this.dataConfig.heartRateVariability;
    577      const hr = Math.round(this.dataConfig.baseHeartRate + hrVariation);
    
  • L582

    ts
    580      // Generate RR interval from HR (with some jitter)
    581      const rrMs = 60_000 / clampedHR;
    582      const rrJitter = (Math.random() - 0.5) * 20;
    583      const rrRaw = Math.round(((rrMs + rrJitter) * 1024) / 1000);
    584
    

libs/aphrodite/biometric-engine/src/gsr/gsr.ts#

  • L66

    ts
    64  /** Box-Muller transform for Gaussian random numbers */
    65  function gaussianRandom(): number {
    66    const u1 = Math.random();
    67    const u2 = Math.random();
    68    const safeU1 = u1 === 0 ? 0.0001 : u1;
    
  • L67

    ts
    65  function gaussianRandom(): number {
    66    const u1 = Math.random();
    67    const u2 = Math.random();
    68    const safeU1 = u1 === 0 ? 0.0001 : u1;
    69    return Math.sqrt(-2 * Math.log(safeU1)) * Math.cos(2 * Math.PI * u2);
    
  • L635

    ts
    633      const meanInterval = this.config.scrFrequency > 0 ? 60 / this.config.scrFrequency : 60;
    634      // Exponential random variable with mean = meanInterval
    635      const interval = -meanInterval * Math.log(Math.max(0.001, Math.random()));
    636      this.nextSCRTime = this.sampleIndex + interval;
    637    }
    
  • L683

    ts
    681      // Check if we should trigger a new SCR
    682      if (this.sampleIndex >= this.nextSCRTime) {
    683        const amplitude = this.config.scrAmplitude * (0.5 + Math.random()); // Random amplitude variation
    684        this.activeSCRs.push({ startTime: t, amplitude });
    685        this.scheduleNextSCR();
    

libs/aphrodite/biometric-engine/src/heart-rate/heart-rate.ts#

  • L61

    ts
    59  /** Box-Muller transform for Gaussian random numbers */
    60  function gaussianRandom(): number {
    61    const u1 = Math.random();
    62    const u2 = Math.random();
    63    const safeU1 = u1 === 0 ? 0.0001 : u1;
    
  • L62

    ts
    60  function gaussianRandom(): number {
    61    const u1 = Math.random();
    62    const u2 = Math.random();
    63    const safeU1 = u1 === 0 ? 0.0001 : u1;
    64    return Math.sqrt(-2 * Math.log(safeU1)) * Math.cos(2 * Math.PI * u2);
    

libs/aphrodite/biometric-engine/src/mediapipe/mediapipe.ts#

  • L1083

    ts
    1081        y: 0.5 + radius * Math.sin(angle) * 0.7,
    1082        z: -0.02 + Math.cos(angle * 3) * 0.01,
    1083        visibility: 0.95 + Math.random() * 0.05,
    1084      });
    1085    }
    
  • L1567

    ts
    1565        timestamp: now,
    1566        faceDetected: true,
    1567        confidence: 0.92 + Math.random() * 0.08,
    1568      };
    1569
    

libs/aphrodite/biometric-engine/src/microphone/microphone.ts#

  • L846

    ts
    844      // Add broadband noise modulated by the breathing envelope
    845      // to simulate the sound of breathing
    846      const noise = (Math.random() * 2 - 1) * 0.3;
    847
    848      // Add a low-frequency component for the airflow sound
    
  • L870

    ts
    868    const samples: number[] = [];
    869    for (let i = 0; i < numSamples; i++) {
    870      samples.push((Math.random() * 2 - 1) * amplitude);
    871    }
    872    return samples;
    
  • L881

    ts
    879  export function addNoise(samples: number[], noiseLevel: number): number[] {
    880    const clampedLevel = Math.max(0, Math.min(1, noiseLevel));
    881    return samples.map((s) => s + (Math.random() * 2 - 1) * clampedLevel);
    882  }
    883
    
  • L1004

    ts
    1002        const t = (this.sampleOffset + i) / sampleRate;
    1003        const envelope = (1 + Math.sin(2 * Math.PI * breathFreq * t)) / 2;
    1004        const noise = (Math.random() * 2 - 1) * 0.2;
    1005        const airflow = Math.sin(2 * Math.PI * 200 * t) * 0.15;
    1006        samples.push((noise + airflow) * envelope * amplitude);
    
  • L1024

    ts
    1022        sample += Math.sin(2 * Math.PI * voicePitch * 4 * t) * 0.08;
    1023        // Slight noise for naturalness
    1024        sample += (Math.random() * 2 - 1) * 0.02;
    1025        samples.push(sample * amplitude);
    1026      }
    

libs/aphrodite/biometric-engine/src/sensor/sensor.ts#

  • L1060

    ts
    1058  /** Box-Muller transform for Gaussian random numbers */
    1059  function gaussianRandom(): number {
    1060    const u1 = Math.random();
    1061    const u2 = Math.random();
    1062    // Guard against log(0)
    
  • L1061

    ts
    1059  function gaussianRandom(): number {
    1060    const u1 = Math.random();
    1061    const u2 = Math.random();
    1062    // Guard against log(0)
    1063    const safeU1 = u1 === 0 ? 0.0001 : u1;
    

libs/aphrodite/biometric-engine/src/websocket/websocket.ts#

  • L742

    ts
    740      if (
    741        this.dataConfig.disconnectProbability > 0 &&
    742        Math.random() < this.dataConfig.disconnectProbability
    743      ) {
    744        const error = 'Connection refused by remote host';
    
  • L835

    ts
    833
    834        // Simulate parse error
    835        if (this.dataConfig.parseErrorRate > 0 && Math.random() < this.dataConfig.parseErrorRate) {
    836          const errorMsg: WSMessage = {
    837            type: WSMessageType.ERROR,
    
  • L848

    ts
    846        sampleIndex++;
    847        const variation =
    848          (Math.sin(sampleIndex * 0.1) + (Math.random() - 0.5) * 0.5) *
    849          baseValue *
    850          this.dataConfig.variability;
    
  • L859

    ts
    857            values: [value],
    858            timestamp: Date.now(),
    859            quality: 0.95 - Math.random() * 0.1,
    860            unit: SENSOR_UNITS[sensorType] ?? '',
    861          },
    

libs/aphrodite/body-art/src/ar/ar-body-art.ts#

  • L211

    ts
    209    let result = '';
    210    for (let i = 0; i < 16; i++) {
    211      result += chars[Math.floor(Math.random() * chars.length)];
    212    }
    213    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/ar/ar-body-overlay.ts#

  • L168

    ts
    166    let result = '';
    167    for (let i = 0; i < 16; i++) {
    168      result += chars[Math.floor(Math.random() * chars.length)];
    169    }
    170    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/attribution/cultural-advisory.ts#

  • L225

    ts
    223    let result = '';
    224    for (let i = 0; i < 16; i++) {
    225      result += chars[Math.floor(Math.random() * chars.length)];
    226    }
    227    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/body-art.ts#

  • L277

    ts
    275    let result = '';
    276    for (let i = 0; i < 16; i++) {
    277      result += chars[Math.floor(Math.random() * chars.length)];
    278    }
    279    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/capture/live-capture.ts#

  • L253

    ts
    251    let result = '';
    252    for (let i = 0; i < 16; i++) {
    253      result += chars[Math.floor(Math.random() * chars.length)];
    254    }
    255    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/capture/live-painting.ts#

  • L190

    ts
    188    let result = '';
    189    for (let i = 0; i < 16; i++) {
    190      result += chars[Math.floor(Math.random() * chars.length)];
    191    }
    192    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/collaboration/artist-collaboration.ts#

  • L189

    ts
    187    let result = '';
    188    for (let i = 0; i < 16; i++) {
    189      result += chars[Math.floor(Math.random() * chars.length)];
    190    }
    191    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/collaboration/artist-tools.ts#

  • L217

    ts
    215    let result = '';
    216    for (let i = 0; i < 16; i++) {
    217      result += chars[Math.floor(Math.random() * chars.length)];
    218    }
    219    return `${prefix}-${result}`;
    
  • L226

    ts
    224    let result = '';
    225    for (let i = 0; i < 24; i++) {
    226      result += chars[Math.floor(Math.random() * chars.length)];
    227    }
    228    return `share-${result}`;
    

libs/aphrodite/body-art/src/coordination/multi-body-art.ts#

  • L174

    ts
    172    let result = '';
    173    for (let i = 0; i < 16; i++) {
    174      result += chars[Math.floor(Math.random() * chars.length)];
    175    }
    176    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/coordination/multi-performer-paint.ts#

  • L182

    ts
    180    let result = '';
    181    for (let i = 0; i < 16; i++) {
    182      result += chars[Math.floor(Math.random() * chars.length)];
    183    }
    184    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/editor/design-editor.ts#

  • L225

    ts
    223    let result = '';
    224    for (let i = 0; i < 16; i++) {
    225      result += chars[Math.floor(Math.random() * chars.length)];
    226    }
    227    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/editor/paint-editor.ts#

  • L233

    ts
    231    let result = '';
    232    for (let i = 0; i < 16; i++) {
    233      result += chars[Math.floor(Math.random() * chars.length)];
    234    }
    235    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/education/body-art-education.ts#

  • L241

    ts
    239    let result = '';
    240    for (let i = 0; i < 16; i++) {
    241      result += chars[Math.floor(Math.random() * chars.length)];
    242    }
    243    return `${prefix}-${result}`;
    
  • L315

    ts
    313    const result = [...array];
    314    for (let i = result.length - 1; i > 0; i--) {
    315      const j = Math.floor(Math.random() * (i + 1));
    316      [result[i], result[j]] = [result[j], result[i]];
    317    }
    

libs/aphrodite/body-art/src/history/art-evolution.ts#

  • L177

    ts
    175    let result = '';
    176    for (let i = 0; i < 16; i++) {
    177      result += chars[Math.floor(Math.random() * chars.length)];
    178    }
    179    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/history/body-art-history.ts#

  • L208

    ts
    206    let result = '';
    207    for (let i = 0; i < 16; i++) {
    208      result += chars[Math.floor(Math.random() * chars.length)];
    209    }
    210    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/integration/performance-integration.ts#

  • L226

    ts
    224    let result = '';
    225    for (let i = 0; i < 16; i++) {
    226      result += chars[Math.floor(Math.random() * chars.length)];
    227    }
    228    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/patterns/cultural/cultural-advisory.ts#

  • L168

    ts
    166    let result = '';
    167    for (let i = 0; i < 16; i++) {
    168      result += chars[Math.floor(Math.random() * chars.length)];
    169    }
    170    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/patterns/cultural/cultural-patterns.ts#

  • L201

    ts
    199    let result = '';
    200    for (let i = 0; i < 16; i++) {
    201      result += chars[Math.floor(Math.random() * chars.length)];
    202    }
    203    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/patterns/custom-designer.ts#

  • L287

    ts
    285    let result = '';
    286    for (let i = 0; i < 16; i++) {
    287      result += chars[Math.floor(Math.random() * chars.length)];
    288    }
    289    return `${prefix}-${result}`;
    
  • L630

    ts
    628      const patternIds: string[] = [];
    629      for (let i = 0; i < patternCount; i++) {
    630        const seed = Math.floor(Math.random() * 10000);
    631        const pattern = this.generateProcedural(
    632          `${name} #${i + 1}`,
    

libs/aphrodite/body-art/src/patterns/custom/custom-design.ts#

  • L233

    ts
    231    let result = '';
    232    for (let i = 0; i < 16; i++) {
    233      result += chars[Math.floor(Math.random() * chars.length)];
    234    }
    235    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/rendering/paint-renderer.ts#

  • L265

    ts
    263    let result = '';
    264    for (let i = 0; i < 16; i++) {
    265      result += chars[Math.floor(Math.random() * chars.length)];
    266    }
    267    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/rendering/pose-deformation.ts#

  • L263

    ts
    261    let result = '';
    262    for (let i = 0; i < 16; i++) {
    263      result += chars[Math.floor(Math.random() * chars.length)];
    264    }
    265    return `${prefix}-${result}`;
    

libs/aphrodite/body-art/src/testing/tracking-accuracy.ts#

  • L198

    ts
    196    let result = '';
    197    for (let i = 0; i < 16; i++) {
    198      result += chars[Math.floor(Math.random() * chars.length)];
    199    }
    200    return `${prefix}-${result}`;
    

libs/aphrodite/career/src/career-engine.ts#

  • L86

    ts
    84  function generateId(prefix: string): string {
    85    _counter++;
    86    return `${prefix}_${Date.now()}_${_counter}_${Math.random().toString(36).slice(2, 8)}`;
    87  }
    88
    

libs/aphrodite/ceremony/src/accessibility/ceremony-a11y.ts#

  • L233

    ts
    231    let result = '';
    232    for (let i = 0; i < 12; i++) {
    233      result += chars[Math.floor(Math.random() * chars.length)];
    234    }
    235    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/advisory/cultural-review.ts#

  • L215

    ts
    213    let result = '';
    214    for (let i = 0; i < 12; i++) {
    215      result += chars[Math.floor(Math.random() * chars.length)];
    216    }
    217    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/anointing/anointing-ritual.ts#

  • L1649

    ts
    1647    let result = '';
    1648    for (let i = 0; i < 12; i++) {
    1649      result += chars[Math.floor(Math.random() * chars.length)];
    1650    }
    1651    return `${prefix}-${result}`;
    
  • L1947

    ts
    1945    const opacity = LIQUID_OPACITY[liquid];
    1946    const sizeRange = LIQUID_PARTICLE_SIZE[liquid];
    1947    const size = sizeRange[0] + Math.random() * (sizeRange[1] - sizeRange[0]);
    1948
    1949    // Add slight randomness to velocity for natural appearance
    
  • L1950

    ts
    1948
    1949    // Add slight randomness to velocity for natural appearance
    1950    const jitterX = (Math.random() - 0.5) * 2.0;
    1951    const jitterY = (Math.random() - 0.5) * 1.0;
    1952
    
  • L1951

    ts
    1949    // Add slight randomness to velocity for natural appearance
    1950    const jitterX = (Math.random() - 0.5) * 2.0;
    1951    const jitterY = (Math.random() - 0.5) * 1.0;
    1952
    1953    return {
    
  • L1957

    ts
    1955      y,
    1956      color,
    1957      opacity: clampValue(opacity + (Math.random() - 0.5) * 0.1, 0, 1),
    1958      size,
    1959      age: 0,
    

libs/aphrodite/ceremony/src/archive/ceremony-archive.ts#

  • L208

    ts
    206    let result = '';
    207    for (let i = 0; i < 12; i++) {
    208      result += chars[Math.floor(Math.random() * chars.length)];
    209    }
    210    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/audience/ceremony-audience.ts#

  • L282

    ts
    280    let result = '';
    281    for (let i = 0; i < 12; i++) {
    282      result += chars[Math.floor(Math.random() * chars.length)];
    283    }
    284    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/audience/participation-engine.ts#

  • L174

    ts
    172    let result = '';
    173    for (let i = 0; i < 12; i++) {
    174      result += chars[Math.floor(Math.random() * chars.length)];
    175    }
    176    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/bathing/bathing-cinematography.ts#

  • L1130

    ts
    1128    let result = '';
    1129    for (let i = 0; i < 12; i++) {
    1130      result += chars[Math.floor(Math.random() * chars.length)];
    1131    }
    1132    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/ceremony.ts#

  • L282

    ts
    280    let result = '';
    281    for (let i = 0; i < 16; i++) {
    282      result += chars[Math.floor(Math.random() * chars.length)];
    283    }
    284    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/cultural/ceremony-advisory.ts#

  • L401

    ts
    399    let result = '';
    400    for (let i = 0; i < 12; i++) {
    401      result += chars[Math.floor(Math.random() * chars.length)];
    402    }
    403    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/design/ceremony-designer.ts#

  • L169

    ts
    167    let result = '';
    168    for (let i = 0; i < 12; i++) {
    169      result += chars[Math.floor(Math.random() * chars.length)];
    170    }
    171    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/effects/ceremony-effects.ts#

  • L251

    ts
    249    let result = '';
    250    for (let i = 0; i < 12; i++) {
    251      result += chars[Math.floor(Math.random() * chars.length)];
    252    }
    253    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/effects/environmental-effects.ts#

  • L205

    ts
    203    let result = '';
    204    for (let i = 0; i < 12; i++) {
    205      result += chars[Math.floor(Math.random() * chars.length)];
    206    }
    207    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/elements/element-integration.ts#

  • L258

    ts
    256    let result = '';
    257    for (let i = 0; i < 12; i++) {
    258      result += chars[Math.floor(Math.random() * chars.length)];
    259    }
    260    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/elements/smoke-haze.ts#

  • L152

    ts
    150    let result = '';
    151    for (let i = 0; i < 12; i++) {
    152      result += chars[Math.floor(Math.random() * chars.length)];
    153    }
    154    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/elements/water-ritual.ts#

  • L150

    ts
    148    let result = '';
    149    for (let i = 0; i < 12; i++) {
    150      result += chars[Math.floor(Math.random() * chars.length)];
    151    }
    152    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/environment/ceremony-environment.ts#

  • L308

    ts
    306    let result = '';
    307    for (let i = 0; i < 12; i++) {
    308      result += chars[Math.floor(Math.random() * chars.length)];
    309    }
    310    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/fire/fire-capture.ts#

  • L254

    ts
    252    let result = '';
    253    for (let i = 0; i < 12; i++) {
    254      result += chars[Math.floor(Math.random() * chars.length)];
    255    }
    256    return `${prefix}-${result}`;
    
  • L366

    ts
    364      intensity: clampFireValue(avgBrightness, 0, 1),
    365      radius: clampFireValue(avgBrightness * 2, 0, 5),
    366      flickerRate: 0.1 + Math.random() * 0.2,
    367      warmth: clampFireValue(avgBrightness * 0.8, 0, 1),
    368    };
    

libs/aphrodite/ceremony/src/fire/fire-safety.ts#

  • L184

    ts
    182    let result = '';
    183    for (let i = 0; i < 12; i++) {
    184      result += chars[Math.floor(Math.random() * chars.length)];
    185    }
    186    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/flowers/flower-ritual.ts#

  • L260

    ts
    258    let result = '';
    259    for (let i = 0; i < 12; i++) {
    260      result += chars[Math.floor(Math.random() * chars.length)];
    261    }
    262    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/music/ceremonial-music.ts#

  • L220

    ts
    218    let result = '';
    219    for (let i = 0; i < 12; i++) {
    220      result += chars[Math.floor(Math.random() * chars.length)];
    221    }
    222    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/music/chanting-harmonics.ts#

  • L261

    ts
    259    let result = '';
    260    for (let i = 0; i < 12; i++) {
    261      result += chars[Math.floor(Math.random() * chars.length)];
    262    }
    263    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/music/drumming-circle.ts#

  • L267

    ts
    265    let result = '';
    266    for (let i = 0; i < 12; i++) {
    267      result += chars[Math.floor(Math.random() * chars.length)];
    268    }
    269    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/props/prop-tracker.ts#

  • L162

    ts
    160    let result = '';
    161    for (let i = 0; i < 12; i++) {
    162      result += chars[Math.floor(Math.random() * chars.length)];
    163    }
    164    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/rehearsal/ceremony-rehearsal.ts#

  • L212

    ts
    210    let result = '';
    211    for (let i = 0; i < 12; i++) {
    212      result += chars[Math.floor(Math.random() * chars.length)];
    213    }
    214    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/ritual/progression-engine.ts#

  • L164

    ts
    162    let result = '';
    163    for (let i = 0; i < 12; i++) {
    164      result += chars[Math.floor(Math.random() * chars.length)];
    165    }
    166    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/sacred/ceremonial-props.ts#

  • L221

    ts
    219    let result = '';
    220    for (let i = 0; i < 12; i++) {
    221      result += chars[Math.floor(Math.random() * chars.length)];
    222    }
    223    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/sacred/ritual-progression.ts#

  • L363

    ts
    361    let result = '';
    362    for (let i = 0; i < 12; i++) {
    363      result += chars[Math.floor(Math.random() * chars.length)];
    364    }
    365    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/sacred/sacred-space.ts#

  • L222

    ts
    220    let result = '';
    221    for (let i = 0; i < 12; i++) {
    222      result += chars[Math.floor(Math.random() * chars.length)];
    223    }
    224    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/safety/ceremony-safety.ts#

  • L298

    ts
    296    let result = '';
    297    for (let i = 0; i < 12; i++) {
    298      result += chars[Math.floor(Math.random() * chars.length)];
    299    }
    300    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/safety/fire-safety.ts#

  • L343

    ts
    341    let result = '';
    342    for (let i = 0; i < 12; i++) {
    343      result += chars[Math.floor(Math.random() * chars.length)];
    344    }
    345    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/safety/safety-protocols.ts#

  • L258

    ts
    256    let result = '';
    257    for (let i = 0; i < 12; i++) {
    258      result += chars[Math.floor(Math.random() * chars.length)];
    259    }
    260    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/smoke/smoke-integration.ts#

  • L208

    ts
    206    let result = '';
    207    for (let i = 0; i < 12; i++) {
    208      result += chars[Math.floor(Math.random() * chars.length)];
    209    }
    210    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/studio/ceremony-studio.ts#

  • L183

    ts
    181    let result = '';
    182    for (let i = 0; i < 12; i++) {
    183      result += chars[Math.floor(Math.random() * chars.length)];
    184    }
    185    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/templates/tradition-templates.ts#

  • L185

    ts
    183    let result = '';
    184    for (let i = 0; i < 12; i++) {
    185      result += chars[Math.floor(Math.random() * chars.length)];
    186    }
    187    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/traditions/tradition-templates.ts#

  • L1161

    ts
    1159    let result = '';
    1160    for (let i = 0; i < 12; i++) {
    1161      result += chars[Math.floor(Math.random() * chars.length)];
    1162    }
    1163    return `${prefix}-${result}`;
    

libs/aphrodite/ceremony/src/water/water-ritual.ts#

  • L280

    ts
    278    let result = '';
    279    for (let i = 0; i < 12; i++) {
    280      result += chars[Math.floor(Math.random() * chars.length)];
    281    }
    282    return `${prefix}-${result}`;
    

libs/aphrodite/chat-core/src/messages/index.ts#

  • L47

    ts
    45   */
    46  export function generateMessageId(): string {
    47    return `msg_${++messageIdCounter}_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    48  }
    49
    

libs/aphrodite/chat-entertainment/src/minigames.ts#

  • L187

    ts
    185    generate(mode: WordGameMode, difficulty: Difficulty, category?: string): WordPuzzle {
    186      const word = this.selectWord(difficulty, category);
    187      const id = `puzzle-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    188
    189      switch (mode) {
    
  • L216

    ts
    214      if (available.length === 0) {
    215        this.usedWords.clear();
    216        return wordList[Math.floor(Math.random() * wordList.length)];
    217      }
    218
    
  • L241

    ts
    239      // Shuffle
    240      for (let i = chars.length - 1; i > 0; i--) {
    241        const j = Math.floor(Math.random() * (i + 1));
    242        [chars[i], chars[j]] = [chars[j], chars[i]];
    243      }
    
  • L272

    ts
    270      // Reveal some random letters
    271      while (revealed.size < revealCount) {
    272        revealed.add(Math.floor(Math.random() * chars.length));
    273      }
    274
    
  • L325

    ts
    323    createGame(broadcasterId: string, config?: Partial<WordGameConfig>): WordGameState {
    324      const finalConfig = { ...this.config, ...config };
    325      const sessionId = `word-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    326
    327      // Generate puzzles
    
  • L652

    ts
    650      if (unrevealed.length === 0) return null;
    651
    652      const hint = unrevealed[Math.floor(Math.random() * unrevealed.length)];
    653      puzzle.revealedLetters?.add(hint.index);
    654      puzzle.blanks = puzzle.word
    
  • L713

    ts
    711     */
    712    generate(mode: NumberGameMode, config: NumberGameConfig): NumberPuzzle {
    713      const id = `num-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    714
    715      switch (mode) {
    
  • L732

    ts
    730      const min = config.minValue ?? 1;
    731      const max = config.maxValue ?? 100;
    732      const target = Math.floor(Math.random() * (max - min + 1)) + min;
    733
    734      return {
    
  • L746

    ts
    744      const min = config.minValue ?? 1;
    745      const max = config.maxValue ?? 1000;
    746      const target = Math.floor(Math.random() * (max - min + 1)) + min;
    747
    748      return {
    
  • L766

    ts
    764      const maxNum = difficulty === 'easy' ? 10 : difficulty === 'medium' ? 50 : 100;
    765
    766      const operation = operations[Math.floor(Math.random() * operations.length)];
    767      a = Math.floor(Math.random() * maxNum) + 1;
    768      b = Math.floor(Math.random() * maxNum) + 1;
    
  • L767

    ts
    765
    766      const operation = operations[Math.floor(Math.random() * operations.length)];
    767      a = Math.floor(Math.random() * maxNum) + 1;
    768      b = Math.floor(Math.random() * maxNum) + 1;
    769
    
  • L768

    ts
    766      const operation = operations[Math.floor(Math.random() * operations.length)];
    767      a = Math.floor(Math.random() * maxNum) + 1;
    768      b = Math.floor(Math.random() * maxNum) + 1;
    769
    770      switch (operation) {
    
  • L782

    ts
    780        case 'multiply':
    781          if (difficulty !== 'hard') {
    782            a = Math.floor(Math.random() * 12) + 1;
    783            b = Math.floor(Math.random() * 12) + 1;
    784          }
    
  • L783

    ts
    781          if (difficulty !== 'hard') {
    782            a = Math.floor(Math.random() * 12) + 1;
    783            b = Math.floor(Math.random() * 12) + 1;
    784          }
    785          op = '×';
    
  • L789

    ts
    787          break;
    788        case 'divide':
    789          result = Math.floor(Math.random() * 12) + 1;
    790          b = Math.floor(Math.random() * 12) + 1;
    791          a = result * b;
    
  • L790

    ts
    788        case 'divide':
    789          result = Math.floor(Math.random() * 12) + 1;
    790          b = Math.floor(Math.random() * 12) + 1;
    791          a = result * b;
    792          op = '÷';
    
  • L815

    ts
    813      // Generate different sequence types
    814      const types = ['arithmetic', 'geometric', 'fibonacci'];
    815      const type = types[Math.floor(Math.random() * (difficulty === 'hard' ? 3 : 2))];
    816
    817      let sequence: number[] = [];
    
  • L822

    ts
    820      switch (type) {
    821        case 'arithmetic': {
    822          const start = Math.floor(Math.random() * 10) + 1;
    823          const diff = Math.floor(Math.random() * 5) + 1;
    824          for (let i = 0; i < length; i++) {
    
  • L823

    ts
    821        case 'arithmetic': {
    822          const start = Math.floor(Math.random() * 10) + 1;
    823          const diff = Math.floor(Math.random() * 5) + 1;
    824          for (let i = 0; i < length; i++) {
    825            sequence.push(start + i * diff);
    
  • L830

    ts
    828        }
    829        case 'geometric': {
    830          const start = Math.floor(Math.random() * 3) + 2;
    831          const ratio = 2;
    832          let current = start;
    
  • L885

    ts
    883    createGame(broadcasterId: string, config?: Partial<NumberGameConfig>): NumberGameState {
    884      const finalConfig = { ...this.config, ...config };
    885      const sessionId = `num-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    886
    887      // Generate puzzles
    

libs/aphrodite/chat-entertainment/src/story.ts#

  • L543

    ts
    541
    542      if (tied.length > 1) {
    543        return tied[Math.floor(Math.random() * tied.length)];
    544      }
    545
    
  • L616

    ts
    614
    615      const finalConfig = { ...this.config, ...config };
    616      const sessionId = `story-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    617
    618      this.state = {
    

libs/aphrodite/chat-entertainment/src/trivia.ts#

  • L440

    ts
    438    private shuffle<T>(array: T[]): void {
    439      for (let i = array.length - 1; i > 0; i--) {
    440        const j = Math.floor(Math.random() * (i + 1));
    441        [array[i], array[j]] = [array[j], array[i]];
    442      }
    
  • L566

    ts
    564      }
    565
    566      const sessionId = `trivia-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    567
    568      this.state = {
    
  • L769

    ts
    767      if (this.config.shuffleAnswers) {
    768        for (let i = answers.length - 1; i > 0; i--) {
    769          const j = Math.floor(Math.random() * (i + 1));
    770          [answers[i], answers[j]] = [answers[j], answers[i]];
    771        }
    

libs/aphrodite/chat-moderation/src/context-aware-moderation.ts#

  • L927

    ts
    925      const fullReport: FalsePositiveReport = {
    926        ...report,
    927        id: `fpr_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    928        status: 'pending',
    929        createdAt: Date.now(),
    

libs/aphrodite/chat-moderation/src/moderation-dashboard.ts#

  • L607

    ts
    605
    606      const appeal: UserAppeal = {
    607        id: `appeal_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    608        actionRecord,
    609        userId: actionRecord.userId,
    
  • L1472

    ts
    1470      const fullNotification: DashboardNotification = {
    1471        ...notification,
    1472        id: `notif_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    1473        createdAt: Date.now(),
    1474      };
    

libs/aphrodite/cloud-recording/src/index.ts#

  • L58

    ts
    56  function generateId(prefix: string): string {
    57    const timestamp = Date.now().toString(36);
    58    const random = Math.random().toString(36).substring(2, 10);
    59    return `${prefix}_${timestamp}_${random}`;
    60  }
    
  • L471

    ts
    469            segment.uploaded = true;
    470            segment.uploadedAt = new Date();
    471            segment.checksum = Math.random().toString(36).substring(2, 34);
    472            this.emitEvent('segment:uploaded', {
    473              tierId,
    
  • L535

    ts
    533      this.state.metrics.encodingFps = 30;
    534      this.state.metrics.inputFps = 30;
    535      this.state.metrics.cpuUsage = 20 + Math.random() * 30;
    536      this.state.metrics.memoryUsage = 500 + Math.random() * 200;
    537      this.state.metrics.writeSpeed = this.state.metrics.averageBitrate / 8;
    
  • L536

    ts
    534      this.state.metrics.inputFps = 30;
    535      this.state.metrics.cpuUsage = 20 + Math.random() * 30;
    536      this.state.metrics.memoryUsage = 500 + Math.random() * 200;
    537      this.state.metrics.writeSpeed = this.state.metrics.averageBitrate / 8;
    538
    
  • L953

    ts
    951      for (let progress = 0; progress <= 100; progress += 10) {
    952        tierStatus.progress = progress;
    953        tierStatus.speed = `${(1 + Math.random()).toFixed(1)}x`;
    954
    955        jobStatus.progress = this.calculateOverallProgress(jobStatus);
    
  • L968

    ts
    966
    967      const outputPath = `${config.outputDir}/${tier.id}${getFormatExtension(tier.format)}`;
    968      const outputSize = Math.floor(Math.random() * 500000000) + 100000000;
    969
    970      tierStatus.status = 'completed';
    
  • L996

    ts
    994        audioCodec: tier.audio.codec,
    995        format: tier.format,
    996        checksum: Math.random().toString(36).substring(2, 34),
    997        uploaded: false,
    998      };
    

libs/aphrodite/compliance/src/compliance.ts#

  • L274

    ts
    272    let result = '';
    273    for (let i = 0; i < 12; i++) {
    274      result += chars[Math.floor(Math.random() * chars.length)];
    275    }
    276    return result;
    

libs/aphrodite/compliance/src/consent/consent-manager.ts#

  • L164

    ts
    162    let result = '';
    163    for (let i = 0; i < 16; i++) {
    164      result += chars[Math.floor(Math.random() * chars.length)];
    165    }
    166    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/consent/ip-rights.ts#

  • L183

    ts
    181    let result = '';
    182    for (let i = 0; i < 16; i++) {
    183      result += chars[Math.floor(Math.random() * chars.length)];
    184    }
    185    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/content/classification-engine.ts#

  • L226

    ts
    224    let result = '';
    225    for (let i = 0; i < 12; i++) {
    226      result += chars[Math.floor(Math.random() * chars.length)];
    227    }
    228    return result;
    

libs/aphrodite/compliance/src/data/data-protection.ts#

  • L320

    ts
    318    let result = '';
    319    for (let i = 0; i < 16; i++) {
    320      result += chars[Math.floor(Math.random() * chars.length)];
    321    }
    322    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/employment/labor-compliance.ts#

  • L315

    ts
    313    let result = '';
    314    for (let i = 0; i < 12; i++) {
    315      result += chars[Math.floor(Math.random() * chars.length)];
    316    }
    317    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/identity/age-verification.ts#

  • L249

    ts
    247    let result = '';
    248    for (let i = 0; i < 16; i++) {
    249      result += chars[Math.floor(Math.random() * chars.length)];
    250    }
    251    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/identity/viewer-access.ts#

  • L272

    ts
    270    let result = '';
    271    for (let i = 0; i < 16; i++) {
    272      result += chars[Math.floor(Math.random() * chars.length)];
    273    }
    274    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/legal/document-generator.ts#

  • L149

    ts
    147    let result = '';
    148    for (let i = 0; i < 16; i++) {
    149      result += chars[Math.floor(Math.random() * chars.length)];
    150    }
    151    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/legal/regulatory-liaison.ts#

  • L199

    ts
    197    let result = '';
    198    for (let i = 0; i < 16; i++) {
    199      result += chars[Math.floor(Math.random() * chars.length)];
    200    }
    201    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/legal/regulatory-monitor.ts#

  • L243

    ts
    241    let result = '';
    242    for (let i = 0; i < 12; i++) {
    243      result += chars[Math.floor(Math.random() * chars.length)];
    244    }
    245    return result;
    

libs/aphrodite/compliance/src/licensing/permit-tracker.ts#

  • L249

    ts
    247    let result = '';
    248    for (let i = 0; i < 12; i++) {
    249      result += chars[Math.floor(Math.random() * chars.length)];
    250    }
    251    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/moderation/realtime-moderation.ts#

  • L244

    ts
    242    let result = '';
    243    for (let i = 0; i < 12; i++) {
    244      result += chars[Math.floor(Math.random() * chars.length)];
    245    }
    246    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/payment/payment-compliance.ts#

  • L360

    ts
    358    let result = '';
    359    for (let i = 0; i < 12; i++) {
    360      result += chars[Math.floor(Math.random() * chars.length)];
    361    }
    362    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/reporting/compliance-audit.ts#

  • L188

    ts
    186    let result = '';
    187    for (let i = 0; i < 16; i++) {
    188      result += chars[Math.floor(Math.random() * chars.length)];
    189    }
    190    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/safety/performer-safety.ts#

  • L190

    ts
    188    let result = '';
    189    for (let i = 0; i < 16; i++) {
    190      result += chars[Math.floor(Math.random() * chars.length)];
    191    }
    192    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/safety/trust-operations.ts#

  • L202

    ts
    200    let result = '';
    201    for (let i = 0; i < 16; i++) {
    202      result += chars[Math.floor(Math.random() * chars.length)];
    203    }
    204    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/tax/tax-engine.ts#

  • L395

    ts
    393    let result = '';
    394    for (let i = 0; i < 12; i++) {
    395      result += chars[Math.floor(Math.random() * chars.length)];
    396    }
    397    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/testing/compliance-test-framework.ts#

  • L411

    ts
    409      const isUnderage = i < underageCount;
    410      const age = isUnderage
    411        ? Math.floor(Math.random() * (minAge - 13)) + 13
    412        : Math.floor(Math.random() * 52) + minAge;
    413
    
  • L412

    ts
    410      const age = isUnderage
    411        ? Math.floor(Math.random() * (minAge - 13)) + 13
    412        : Math.floor(Math.random() * 52) + minAge;
    413
    414      const birthYear = new Date().getFullYear() - age;
    
  • L415

    ts
    413
    414      const birthYear = new Date().getFullYear() - age;
    415      const birthMonth = String(Math.floor(Math.random() * 12) + 1).padStart(2, '0');
    416      const birthDay = String(Math.floor(Math.random() * 28) + 1).padStart(2, '0');
    417
    
  • L416

    ts
    414      const birthYear = new Date().getFullYear() - age;
    415      const birthMonth = String(Math.floor(Math.random() * 12) + 1).padStart(2, '0');
    416      const birthDay = String(Math.floor(Math.random() * 28) + 1).padStart(2, '0');
    417
    418      const jurisdiction = jurisdictions[i % jurisdictions.length];
    
  • L459

    ts
    457
    458    const multiplier = methodMultiplier[identity.verificationMethod] ?? 1.0;
    459    const latency = Math.round(latencyBase * multiplier * (0.8 + Math.random() * 0.4));
    460
    461    const ageConfirmed = identity.age >= minAge;
    
  • L593

    ts
    591        serviceName,
    592        dataTypes: getServiceDataTypes(serviceName),
    593        recordCount: Math.floor(Math.random() * 1000) + 1,
    594        erasureStatus: status,
    595        erasedAt,
    

libs/aphrodite/compliance/src/testing/compliance-tests.ts#

  • L193

    ts
    191    let result = '';
    192    for (let i = 0; i < 16; i++) {
    193      result += chars[Math.floor(Math.random() * chars.length)];
    194    }
    195    return `${prefix}-${result}`;
    

libs/aphrodite/compliance/src/training/compliance-training.ts#

  • L226

    ts
    224    let result = '';
    225    for (let i = 0; i < 16; i++) {
    226      result += chars[Math.floor(Math.random() * chars.length)];
    227    }
    228    return `${prefix}-${result}`;
    

libs/aphrodite/content-tagging/src/content-tagger.ts#

  • L140

    ts
    138
    139      // Simulate 70% chance of detecting a game
    140      if (Math.random() > 0.3) {
    141        const game = games[Math.floor(Math.random() * games.length)];
    142        return {
    
  • L141

    ts
    139      // Simulate 70% chance of detecting a game
    140      if (Math.random() > 0.3) {
    141        const game = games[Math.floor(Math.random() * games.length)];
    142        return {
    143          id: game.id,
    
  • L146

    ts
    144          name: game.name,
    145          aliases: [],
    146          confidence: 0.7 + Math.random() * 0.3,
    147          genres: game.genres,
    148          platforms: game.platforms,
    

libs/aphrodite/content-tagging/src/similarity-analyzer.ts#

  • L439

    ts
    437          version: '1.0',
    438          features: this.config.features,
    439          createdAt: Date.now() - Math.random() * 86400000,
    440        };
    441
    
  • L448

    ts
    446          category: content.category,
    447          tags: content.tags,
    448          viewCount: Math.floor(Math.random() * 10000),
    449          duration: Math.floor(Math.random() * 14400),
    450        };
    
  • L449

    ts
    447          tags: content.tags,
    448          viewCount: Math.floor(Math.random() * 10000),
    449          duration: Math.floor(Math.random() * 14400),
    450        };
    451
    

libs/aphrodite/content-tagging/src/tag-suggester.ts#

  • L71

    ts
    69            isPrimary: tagNames.indexOf(name) === 0,
    70            relatedTags: [],
    71            usageCount: Math.floor(Math.random() * 10000) + 1000,
    72          };
    73
    
  • L112

    ts
    110          isPrimary: false,
    111          relatedTags: [],
    112          usageCount: Math.floor(Math.random() * 5000) + 500,
    113        };
    114
    
  • L146

    ts
    144          isPrimary: false,
    145          relatedTags: [],
    146          usageCount: Math.floor(Math.random() * 8000) + 1000,
    147        };
    148
    
  • L177

    ts
    175          isPrimary: false,
    176          relatedTags: [],
    177          usageCount: Math.floor(Math.random() * 6000) + 800,
    178        };
    179
    
  • L255

    ts
    253    createCustomTag(name: string, source: TagSource = 'ai_detected'): ContentTag {
    254      return {
    255        id: `custom-${Date.now()}-${Math.random().toString(36).slice(2)}`,
    256        name: name.toLowerCase().replace(/\s+/g, '_'),
    257        displayName: name,
    
  • L497

    ts
    495
    496      // Simulate detecting some visual elements
    497      if (Math.random() > 0.5) {
    498        evidence.set('gaming', [
    499          {
    
  • L507

    ts
    505      }
    506
    507      if (Math.random() > 0.7) {
    508        evidence.set('webcam', [
    509          {
    

libs/aphrodite/content-takedown/src/takedown-service.ts#

  • L745

    ts
    743      const prefix = type.toUpperCase().substring(0, 4);
    744      const timestamp = Date.now().toString(36).toUpperCase();
    745      const random = Math.random().toString(36).substring(2, 6).toUpperCase();
    746      return `${prefix}-${timestamp}-${random}`;
    747    }
    

libs/aphrodite/core/src/utils/age-verification.ts#

  • L246

    ts
    244      method,
    245      expiresAt: expiresAt.toISOString(),
    246      nonce: Math.random().toString(36).substring(2, 15),
    247    };
    248
    

libs/aphrodite/crowd-control/src/collaborative/collaborative.ts#

  • L224

    ts
    222        case InputResolution.RANDOM: {
    223          const keys = Array.from(round.votes.values());
    224          return keys.length > 0 ? keys[Math.floor(Math.random() * keys.length)] : null;
    225        }
    226      }
    
  • L255

    ts
    253      if (total === 0) return null;
    254
    255      let rand = Math.random() * total;
    256      for (const opt of round.options) {
    257        const count = round.tallies.get(opt.key) ?? 0;
    
  • L733

    ts
    731
    732      // Calculate actual value with critical hit check
    733      const isCritical = Math.random() < CRITICAL_HIT_CHANCE;
    734      let actualValue = value;
    735      if (isCritical) {
    

libs/aphrodite/crowd-control/src/crowd-control.ts#

  • L62

    ts
    60  export function generateId(prefix: string): string {
    61    const ts = Date.now().toString(36);
    62    const rand = Math.random().toString(36).slice(2, 8);
    63    return `${prefix}_${ts}_${rand}`;
    64  }
    

libs/aphrodite/crypto-payments/src/index.ts#

  • L247

    ts
    245        timestamp: new Date(),
    246        source: 'coingecko',
    247        change24h: Math.random() * 10 - 5, // Mock 24h change
    248      };
    249    }
    
  • L1162

    ts
    1160
    1161      const mockAddress =
    1162        '0x' + Array.from({ length: 40 }, () => Math.floor(Math.random() * 16).toString(16)).join('');
    1163
    1164      const chainId = request.chainId || 1;
    
  • L1189

    ts
    1187
    1188      const mockAddress =
    1189        '0x' + Array.from({ length: 40 }, () => Math.floor(Math.random() * 16).toString(16)).join('');
    1190
    1191      const chainId = request.chainId || 1;
    
  • L1404

    ts
    1402      const cryptoConfig = CRYPTOCURRENCY_CONFIGS[cryptocurrency];
    1403      const mockBalance = BigInt(
    1404        Math.floor(Math.random() * 10 * Math.pow(10, cryptoConfig.decimals))
    1405      );
    1406
    
  • L1844

    ts
    1842
    1843      // Generate payment ID
    1844      const paymentId = `pay_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
    1845
    1846      // Get network config for confirmations
    

libs/aphrodite/device-protocols/src/commands/index.ts#

  • L264

    ts
    262
    263    for (let i = 0; i < numSteps; i++) {
    264      const randomIntensity = Math.round(Math.random() * intensity);
    265      steps.push({ intensity: randomIntensity, duration: stepInterval });
    266    }
    

libs/aphrodite/device-protocols/src/device-manager.ts#

  • L769

    ts
    767     */
    768    private generateSessionId(): string {
    769      return `session_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    770    }
    771
    

libs/aphrodite/device-reaction-engine/src/choreography/choreography.ts#

  • L470

    ts
    468  ): Map<string, number> {
    469    const delays = new Map<string, number>();
    470    const rng = seed !== undefined ? seededRandom(seed) : () => Math.random();
    471
    472    for (const id of deviceIds) {
    

libs/aphrodite/drone-integration/src/reconstruction/reconstruction.ts#

  • L1100

    ts
    1098      const used = new Set<number>();
    1099      while (sample.length < 8 && sample.length < matches.length) {
    1100        const idx = Math.floor(Math.random() * matches.length);
    1101        if (!used.has(idx)) {
    1102          used.add(idx);
    
  • L2301

    ts
    2299      for (let s = 0; s < splats.length; s++) {
    2300        // Gradient magnitude approximation based on loss
    2301        gradients[s] = totalLoss * (0.0001 + Math.random() * 0.0001);
    2302      }
    2303
    
  • L2307

    ts
    2305      const lr = config.positionLearningRate * (1 - iter / config.iterations);
    2306      for (let s = 0; s < splats.length; s++) {
    2307        splats[s].position.x -= lr * gradients[s] * (Math.random() - 0.5);
    2308        splats[s].position.y -= lr * gradients[s] * (Math.random() - 0.5);
    2309        splats[s].position.z -= lr * gradients[s] * (Math.random() - 0.5);
    
  • L2308

    ts
    2306      for (let s = 0; s < splats.length; s++) {
    2307        splats[s].position.x -= lr * gradients[s] * (Math.random() - 0.5);
    2308        splats[s].position.y -= lr * gradients[s] * (Math.random() - 0.5);
    2309        splats[s].position.z -= lr * gradients[s] * (Math.random() - 0.5);
    2310
    
  • L2309

    ts
    2307        splats[s].position.x -= lr * gradients[s] * (Math.random() - 0.5);
    2308        splats[s].position.y -= lr * gradients[s] * (Math.random() - 0.5);
    2309        splats[s].position.z -= lr * gradients[s] * (Math.random() - 0.5);
    2310
    2311        // Update opacity
    

libs/aphrodite/drone-integration/src/safety/safety-engine.ts#

  • L243

    ts
    241   */
    242  export function generateIncidentId(timestampMs: number): string {
    243    const suffix = Math.random().toString(36).slice(2, 8).toUpperCase();
    244    return `INC-${timestampMs}-${suffix}`;
    245  }
    

libs/aphrodite/drone-integration/src/swarm-display/swarm-display.ts#

  • L692

    ts
    690        // Fisher-Yates shuffle
    691        for (let i = indices.length - 1; i > 0; i--) {
    692          const j = Math.floor(Math.random() * (i + 1));
    693          [indices[i], indices[j]] = [indices[j], indices[i]];
    694        }
    

libs/aphrodite/eye-tracking/src/index.ts#

  • L415

    ts
    413
    414      // Add micro-saccades (tiny random movements)
    415      const microX = (Math.random() - 0.5) * 0.02;
    416      const microY = (Math.random() - 0.5) * 0.02;
    417
    
  • L416

    ts
    414      // Add micro-saccades (tiny random movements)
    415      const microX = (Math.random() - 0.5) * 0.02;
    416      const microY = (Math.random() - 0.5) * 0.02;
    417
    418      const direction = normalize({
    
  • L432

    ts
    430          origin: { x: -0.032, y: 1.6, z: 0 },
    431          direction,
    432          openness: 0.9 + Math.random() * 0.1,
    433          blinkDetected: false,
    434          confidence: 0.95,
    
  • L439

    ts
    437          origin: { x: 0.032, y: 1.6, z: 0 },
    438          direction,
    439          openness: 0.9 + Math.random() * 0.1,
    440          blinkDetected: false,
    441          confidence: 0.95,
    

libs/aphrodite/face-identity/src/body-extension/body-overlay.ts#

  • L240

    ts
    238    let result = '';
    239    for (let i = 0; i < 16; i++) {
    240      result += chars[Math.floor(Math.random() * chars.length)];
    241    }
    242    return `${prefix}-${result}`;
    

libs/aphrodite/face-identity/src/coordination/multi-overlay.ts#

  • L234

    ts
    232    let result = '';
    233    for (let i = 0; i < 16; i++) {
    234      result += chars[Math.floor(Math.random() * chars.length)];
    235    }
    236    return `${prefix}-${result}`;
    

libs/aphrodite/face-identity/src/expression/expression-transfer.ts#

  • L360

    ts
    358    let result = '';
    359    for (let i = 0; i < 16; i++) {
    360      result += chars[Math.floor(Math.random() * chars.length)];
    361    }
    362    return `${prefix}-${result}`;
    

libs/aphrodite/face-identity/src/face-identity.ts#

  • L279

    ts
    277    let result = '';
    278    for (let i = 0; i < 16; i++) {
    279      result += chars[Math.floor(Math.random() * chars.length)];
    280    }
    281    return `${prefix}-${result}`;
    

libs/aphrodite/face-identity/src/localization/overlay-localization.ts#

  • L421

    ts
    419    let result = '';
    420    for (let i = 0; i < 16; i++) {
    421      result += chars[Math.floor(Math.random() * chars.length)];
    422    }
    423    return `${prefix}-${result}`;
    

libs/aphrodite/face-identity/src/marketplace/overlay-marketplace.ts#

  • L224

    ts
    222    let result = '';
    223    for (let i = 0; i < 16; i++) {
    224      result += chars[Math.floor(Math.random() * chars.length)];
    225    }
    226    return `${prefix}-${result}`;
    
  • L240

    ts
    238    let code = '';
    239    for (let i = 0; i < length; i++) {
    240      code += chars[Math.floor(Math.random() * chars.length)];
    241    }
    242    return code;
    

libs/aphrodite/face-identity/src/optimization/render-optimization.ts#

  • L278

    ts
    276    let result = '';
    277    for (let i = 0; i < 16; i++) {
    278      result += chars[Math.floor(Math.random() * chars.length)];
    279    }
    280    return `${prefix}-${result}`;
    

libs/aphrodite/face-identity/src/overlays/artistic/artistic-overlays.ts#

  • L196

    ts
    194    let result = '';
    195    for (let i = 0; i < 16; i++) {
    196      result += chars[Math.floor(Math.random() * chars.length)];
    197    }
    198    return `${prefix}-${result}`;
    

libs/aphrodite/face-identity/src/overlays/elemental/elemental-overlays.ts#

  • L209

    ts
    207    let result = '';
    208    for (let i = 0; i < 16; i++) {
    209      result += chars[Math.floor(Math.random() * chars.length)];
    210    }
    211    return `${prefix}-${result}`;
    

libs/aphrodite/face-identity/src/overlays/mythological/mythological-overlays.ts#

  • L192

    ts
    190    let result = '';
    191    for (let i = 0; i < 16; i++) {
    192      result += chars[Math.floor(Math.random() * chars.length)];
    193    }
    194    return `${prefix}-${result}`;
    

libs/aphrodite/face-identity/src/persona/persona-manager.ts#

  • L202

    ts
    200    let result = '';
    201    for (let i = 0; i < 16; i++) {
    202      result += chars[Math.floor(Math.random() * chars.length)];
    203    }
    204    return `${prefix}-${result}`;
    

libs/aphrodite/face-identity/src/pipeline/asset-pipeline.ts#

  • L264

    ts
    262    let result = '';
    263    for (let i = 0; i < 16; i++) {
    264      result += chars[Math.floor(Math.random() * chars.length)];
    265    }
    266    return `${prefix}-${result}`;
    

libs/aphrodite/face-identity/src/preprocessing/face-calibration.ts#

  • L207

    ts
    205    let result = '';
    206    for (let i = 0; i < 16; i++) {
    207      result += chars[Math.floor(Math.random() * chars.length)];
    208    }
    209    return `${prefix}-${result}`;
    

libs/aphrodite/face-identity/src/protection/identity-defense.ts#

  • L241

    ts
    239    let result = '';
    240    for (let i = 0; i < 16; i++) {
    241      result += chars[Math.floor(Math.random() * chars.length)];
    242    }
    243    return `${prefix}-${result}`;
    

libs/aphrodite/face-identity/src/rendering/overlay-renderer.ts#

  • L227

    ts
    225    let result = '';
    226    for (let i = 0; i < 16; i++) {
    227      result += chars[Math.floor(Math.random() * chars.length)];
    228    }
    229    return `${prefix}-${result}`;
    

libs/aphrodite/face-identity/src/testing/overlay-ab-testing.ts#

  • L284

    ts
    282    let result = '';
    283    for (let i = 0; i < 16; i++) {
    284      result += chars[Math.floor(Math.random() * chars.length)];
    285    }
    286    return `${prefix}-${result}`;
    
  • L316

    ts
    314    if (variants.length === 0) throw new Error('No variants available');
    315    const weights = normalizeWeights(variants.map((v) => v.weight));
    316    const rng = seed !== undefined ? seededRandom(seed) : Math.random();
    317    let cumulative = 0;
    318    for (let i = 0; i < variants.length; i++) {
    

libs/aphrodite/face-identity/src/vr/vr-overlay-integration.ts#

  • L345

    ts
    343    let result = '';
    344    for (let i = 0; i < 16; i++) {
    345      result += chars[Math.floor(Math.random() * chars.length)];
    346    }
    347    return `${prefix}-${result}`;
    

libs/aphrodite/game-accessibility/src/audio/audio.ts#

  • L977

    ts
    975        if (track.markers.length >= this.config.maxMarkersPerTrack) break;
    976
    977        const lane = opts.lanes ? Math.floor(Math.random() * opts.lanes) : 0;
    978        const marker = this.addBeatMarker(trackId, {
    979          timeMs: time,
    

libs/aphrodite/game-audio/src/sfx/sfx-system.ts#

  • L197

    ts
    195; /**
    196   * Seeded-safe random number in range [min, max].
    197   * Uses Math.random() for portability; the anti-repetition logic handles
    198   * perceptual randomness.
    199   */
    
  • L202

    ts
    200  function randomInRange(min: number, max: number): number {
    201    if (min >= max) return min;
    202    return min + Math.random() * (max - min);
    203  }
    204
    
  • L306

    ts
    304    }
    305
    306    const index = Math.floor(Math.random() * candidates.length);
    307    const selected = candidates[index];
    308    return { ...selected };
    

libs/aphrodite/game-event-bus/src/debug/event-debugger.ts#

  • L481

    ts
    479    traceCounter++;
    480    const now = Date.now();
    481    const random = Math.floor(Math.random() * 0xffff)
    482      .toString(16)
    483      .padStart(4, '0');
    

libs/aphrodite/game-horror/src/ghost/ghost.ts#

  • L458

    ts
    456
    457    // Pick a new random target within bounds
    458    const targetX = bounds.minX + Math.random() * (bounds.maxX - bounds.minX);
    459    const targetY = bounds.minY + Math.random() * (bounds.maxY - bounds.minY);
    460    const targetZ = bounds.minZ + Math.random() * (bounds.maxZ - bounds.minZ);
    
  • L459

    ts
    457    // Pick a new random target within bounds
    458    const targetX = bounds.minX + Math.random() * (bounds.maxX - bounds.minX);
    459    const targetY = bounds.minY + Math.random() * (bounds.maxY - bounds.minY);
    460    const targetZ = bounds.minZ + Math.random() * (bounds.maxZ - bounds.minZ);
    461
    
  • L460

    ts
    458    const targetX = bounds.minX + Math.random() * (bounds.maxX - bounds.minX);
    459    const targetY = bounds.minY + Math.random() * (bounds.maxY - bounds.minY);
    460    const targetZ = bounds.minZ + Math.random() * (bounds.maxZ - bounds.minZ);
    461
    462    return {
    

libs/aphrodite/game-horror/src/scare/scare.ts#

  • L765

    ts
    763      // Probability check
    764      if (definition.probability < 1.0) {
    765        if (Math.random() > definition.probability) {
    766          // Record as blocked
    767          const blockedInstance: ScareInstance = {
    

libs/aphrodite/game-input/src/recording/input-recorder.ts#

  • L280

    ts
    278
    279  function generateId(): string {
    280    return `rec_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    281  }
    282
    

libs/aphrodite/game-input/src/viewer-input/viewer-input-router.ts#

  • L386

    ts
    384
    385      case QueueMode.RANDOM: {
    386        const index = Math.floor(Math.random() * queue.length);
    387        return queue[index];
    388      }
    
  • L446

    ts
    444  /** Generate a unique ID for vote sessions and similar */
    445  function generateId(): string {
    446    return `vir_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    447  }
    448
    

libs/aphrodite/game-monetization/src/collectibles/collectibles.ts#

  • L559

    ts
    557
    558      // Roll
    559      if (Math.random() > chance) return null;
    560
    561      // Select eligible items from drop table
    
  • L586

    ts
    584      // Weighted random selection
    585      const totalWeight = eligible.reduce((sum, e) => sum + e.weight, 0);
    586      let roll = Math.random() * totalWeight;
    587      let selected: DropTableEntry | undefined;
    588
    

libs/aphrodite/game-networking/src/broadcast/event-broadcaster.ts#

  • L249

    ts
    247  export function generateEventId(): string {
    248    _eventIdCounter++;
    249    const rand = Math.floor(Math.random() * 0xffffffff)
    250      .toString(16)
    251      .padStart(8, '0');
    

libs/aphrodite/game-networking/src/matchmaking/matchmaking.ts#

  • L616

    ts
    614    const bytes = new Array(6);
    615    for (let i = 0; i < 6; i++) {
    616      bytes[i] = Math.floor(Math.random() * 256)
    617        .toString(16)
    618        .padStart(2, '0');
    
  • L633

    ts
    631    const bytes = new Array(8);
    632    for (let i = 0; i < 8; i++) {
    633      bytes[i] = Math.floor(Math.random() * 256)
    634        .toString(16)
    635        .padStart(2, '0');
    
  • L1045

    ts
    1043        // Fisher-Yates shuffle
    1044        for (let i = players.length - 1; i > 0; i--) {
    1045          const j = Math.floor(Math.random() * (i + 1));
    1046          const tmp = players[i];
    1047          players[i] = players[j];
    

libs/aphrodite/game-networking/src/server/game-server.ts#

  • L198

    ts
    196    const bytes = new Array(8);
    197    for (let i = 0; i < 8; i++) {
    198      bytes[i] = Math.floor(Math.random() * 256)
    199        .toString(16)
    200        .padStart(2, '0');
    
  • L213

    ts
    211    const bytes = new Array(6);
    212    for (let i = 0; i < 6; i++) {
    213      bytes[i] = Math.floor(Math.random() * 256)
    214        .toString(16)
    215        .padStart(2, '0');
    

libs/aphrodite/game-networking/src/spectator/game-spectator.ts#

  • L570

    ts
    568    const random = new Array(4);
    569    for (let i = 0; i < 4; i++) {
    570      random[i] = Math.floor(Math.random() * 256)
    571        .toString(16)
    572        .padStart(2, '0');
    

libs/aphrodite/game-openworld/src/music/music.ts#

  • L366

    ts
    364        id: nextNoteId(),
    365        pitch,
    366        velocity: phaseTheme.intensity * (0.7 + Math.random() * 0.3),
    367        duration: noteDuration * 0.8,
    368        instrument: inst,
    

libs/aphrodite/game-openworld/src/viewer/viewer.ts#

  • L343

    ts
    341    };
    342    const pool = names[type];
    343    // Deterministic based on counter — no Math.random
    344    return pool[_viewerNpcId % pool.length];
    345  }
    

libs/aphrodite/game-platformer/src/boss/boss.ts#

  • L266

    ts
    264    for (let i = 0; i < actualCount; i++) {
    265      const angle = (i / actualCount) * Math.PI * 2;
    266      const radius = 3 + Math.random() * 2;
    267      spawnPositions.push({
    268        x: b.position.x + Math.cos(angle) * radius,
    
  • L669

    ts
    667    private elapsed = 0;
    668    private initialized = false;
    669    private rng: RngFn = Math.random;
    670    private listeners = new Map<string, Set<PlatformerEventListener>>();
    671    private wildcardListeners = new Set<PlatformerEventListener>();
    

libs/aphrodite/game-platformer/src/collectible/collectible.ts#

  • L212

    ts
    210      bobAmplitude: config.bobEnabled ? preset.bobAmp : 0,
    211      bobSpeed: 2.5,
    212      bobOffset: Math.random() * Math.PI * 2,
    213      sparkle: config.sparkleEnabled && preset.sparkle,
    214    };
    

libs/aphrodite/game-platformer/src/enemy/enemy.ts#

  • L326

    ts
    324        e.burrowTimer = 0;
    325        // Teleport near player (offset slightly)
    326        const offset = (Math.random() > 0.5 ? 1 : -1) * (1.5 + Math.random() * 2);
    327        e.position.x = playerPos.x + offset;
    328        e.position.y = e.patrolOrigin.y;
    

libs/aphrodite/game-rhythm/src/visuals/visuals.ts#

  • L329

    ts
    327    for (let i = 0; i < effectiveCount; i++) {
    328      const angle = (i / effectiveCount) * Math.PI * 2;
    329      const spread = 0.15 + Math.random() * 0.2;
    330      const x = 0.5 + Math.cos(angle) * spread;
    331      const y = 0.5 + Math.sin(angle) * spread;
    
  • L334

    ts
    332      const vfx = createVfx(
    333        VfxType.PARTICLE_BURST,
    334        0.5 + Math.random() * 0.5,
    335        300 + Math.random() * 200,
    336        {
    
  • L335

    ts
    333        VfxType.PARTICLE_BURST,
    334        0.5 + Math.random() * 0.5,
    335        300 + Math.random() * 200,
    336        {
    337          r: 200 + Math.floor(Math.random() * 55),
    
  • L337

    ts
    335        300 + Math.random() * 200,
    336        {
    337          r: 200 + Math.floor(Math.random() * 55),
    338          g: 200 + Math.floor(Math.random() * 55),
    339          b: 200 + Math.floor(Math.random() * 55),
    
  • L338

    ts
    336        {
    337          r: 200 + Math.floor(Math.random() * 55),
    338          g: 200 + Math.floor(Math.random() * 55),
    339          b: 200 + Math.floor(Math.random() * 55),
    340        },
    
  • L339

    ts
    337          r: 200 + Math.floor(Math.random() * 55),
    338          g: 200 + Math.floor(Math.random() * 55),
    339          b: 200 + Math.floor(Math.random() * 55),
    340        },
    341        { x: clamp(x, 0, 1), y: clamp(y, 0, 1) }
    
  • L347

    ts
    345        params: {
    346          angle,
    347          speed: 0.3 + Math.random() * 0.7,
    348          particleIndex: i,
    349        },
    

libs/aphrodite/game-rpg/src/combat/combat.ts#

  • L224

    ts
    222    critDamageMultiplier: number
    223  ): { isCritical: boolean; multiplier: number } {
    224    const roll = Math.random();
    225    const capped = clamp(critRate, 0, 1);
    226    if (roll < capped) {
    
  • L243

    ts
    241    const defEva = Math.max(0, defenderEva);
    242    const hitChance = clamp(accuracy * (atkAcc / (atkAcc + defEva)), 0, 1);
    243    return Math.random() < hitChance;
    244  }
    245
    
  • L551

    ts
    549    const defLuck = Math.max(1, defenderLuck);
    550    const chance = clamp(baseChance * (atkLuck / (atkLuck + defLuck)) * 2, 0, 1);
    551    return Math.random() < chance;
    552  }
    553
    
  • L1027

    ts
    1025      case TargetType.RANDOM_ENEMY: {
    1026        if (aliveEnemies.length === 0) return [];
    1027        const idx = Math.floor(Math.random() * aliveEnemies.length);
    1028        return [aliveEnemies[idx]];
    1029      }
    
  • L1192

    ts
    1190    const speedRatio = avgEnemySpeed > 0 ? avgPartySpeed / avgEnemySpeed : 2;
    1191    const fleeChance = clamp(config.baseFleeChance * speedRatio, 0.05, 0.95);
    1192    return Math.random() < fleeChance;
    1193  }
    1194
    

libs/aphrodite/game-rpg/src/dialogue/dialogue.ts#

  • L441

    ts
    439        }
    440        const totalWeight = branches.reduce((sum, b) => sum + b.weight, 0);
    441        let roll = Math.random() * totalWeight;
    442        let selectedNodeId = branches[0].nodeId;
    443        for (const branch of branches) {
    

libs/aphrodite/game-rpg/src/dungeon/dungeon.ts#

  • L73

    ts
    71   * deterministic integers in [min, max] inclusive.
    72   *
    73   * If seed is 0, uses Math.random() instead (non-deterministic).
    74   */
    75  export function createDungeonRng(seed: number): (min: number, max: number) => number {
    
  • L78

    ts
    76    if (seed === 0) {
    77      return (min: number, max: number): number => {
    78        return Math.floor(Math.random() * (max - min + 1)) + min;
    79      };
    80    }
    

libs/aphrodite/game-rpg/src/equipment/equipment.ts#

  • L747

    ts
    745
    746    for (let r = 0; r < rollCount; r++) {
    747      let roll = Math.random() * totalWeight;
    748
    749      for (const entry of eligibleEntries) {
    
  • L754

    ts
    752          const quantity =
    753            entry.minQuantity +
    754            Math.floor(Math.random() * (entry.maxQuantity - entry.minQuantity + 1));
    755          // Check if we already dropped this item; if so, add to quantity
    756          const existing = drops.find((d) => d.itemId === entry.itemId);
    

libs/aphrodite/game-rpg/src/integration/integration.ts#

  • L514

    ts
    512        const tickCount = 5;
    513        for (let i = 0; i < tickCount; i++) {
    514          const intensity = config.burnIntensity * (0.7 + Math.random() * 0.3);
    515          const p = createRpgPulse(
    516            RpgHapticPattern.STATUS_BURN_TICK,
    

libs/aphrodite/game-rpg/src/monster/monster.ts#

  • L249

    ts
    247      case MonsterTargetType.SINGLE_PLAYER: {
    248        if (alivePlayers.length === 0) return [];
    249        const idx = Math.floor(Math.random() * alivePlayers.length);
    250        return [alivePlayers[idx].id];
    251      }
    
  • L303

    ts
    301        const all = [...alivePlayers, ...aliveAllies];
    302        if (all.length === 0) return [];
    303        const idx = Math.floor(Math.random() * all.length);
    304        return [all[idx].id];
    305      }
    
  • L500

    ts
    498
    499      case MonsterBehavior.RANDOM: {
    500        const idx = Math.floor(Math.random() * available.length);
    501        chosen = available[idx];
    502        break;
    
  • L614

    ts
    612    // Determine number of monsters
    613    const range = encounterConfig.maxMonsters - encounterConfig.minMonsters + 1;
    614    const count = encounterConfig.minMonsters + Math.floor(Math.random() * range);
    615
    616    // Roll for elite/miniboss
    
  • L617

    ts
    615
    616    // Roll for elite/miniboss
    617    const hasElite = Math.random() < encounterConfig.eliteChance;
    618    const hasMiniboss = Math.random() < encounterConfig.minibossChance;
    619
    
  • L618

    ts
    616    // Roll for elite/miniboss
    617    const hasElite = Math.random() < encounterConfig.eliteChance;
    618    const hasMiniboss = Math.random() < encounterConfig.minibossChance;
    619
    620    const monsters: MonsterInstance[] = [];
    
  • L625

    ts
    623    for (let i = 0; i < count; i++) {
    624      // Pick a random eligible template
    625      const templateIdx = Math.floor(Math.random() * eligible.length);
    626      let template = eligible[templateIdx];
    627
    
  • L633

    ts
    631        const minibossTemplates = eligible.filter((t) => t.rank === MonsterRank.MINIBOSS);
    632        if (minibossTemplates.length > 0) {
    633          template = minibossTemplates[Math.floor(Math.random() * minibossTemplates.length)];
    634          isElite = true;
    635        }
    
  • L640

    ts
    638        const eliteTemplates = eligible.filter((t) => t.rank === MonsterRank.ELITE);
    639        if (eliteTemplates.length > 0) {
    640          template = eliteTemplates[Math.floor(Math.random() * eliteTemplates.length)];
    641          isElite = true;
    642        }
    
  • L647

    ts
    645      // Scale level with variance
    646      const variance =
    647        Math.floor(Math.random() * (encounterConfig.levelVariance * 2 + 1)) -
    648        encounterConfig.levelVariance;
    649      const monsterLevel = Math.max(1, encounterConfig.areaLevel + variance);
    
  • L721

    ts
    719    const rate = clamp(encounterRate, 0, 1);
    720    const noEncounterChance = Math.pow(1 - rate, steps);
    721    return Math.random() > noEncounterChance;
    722  }
    723
    
  • L781

    ts
    779    for (const entry of template.lootTable) {
    780      const adjustedChance = clamp(entry.dropChance * luck, 0, 1);
    781      if (Math.random() < adjustedChance) {
    782        const bonusQty = Math.floor(level / 10);
    783        const maxQty = entry.maxQuantity + bonusQty;
    
  • L785

    ts
    783        const maxQty = entry.maxQuantity + bonusQty;
    784        const range = maxQty - entry.minQuantity + 1;
    785        const quantity = entry.minQuantity + Math.floor(Math.random() * range);
    786        drops.push({ itemId: entry.itemId, quantity: Math.max(entry.minQuantity, quantity) });
    787      }
    

libs/aphrodite/gamification/src/leaderboards/index.ts#

  • L669

    ts
    667  ): LeaderboardPrize {
    668    return {
    669      id: params.id ?? `prize_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    670      ...params,
    671    };
    

libs/aphrodite/growth/src/growth-engine.ts#

  • L444

    ts
    442
    443  function generateId(prefix: string): string {
    444    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    445  }
    446
    

libs/aphrodite/haptics/src/index.ts#

  • L61

    ts
    59
    60  function generateId(): string {
    61    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    62  }
    63
    
  • L156

    ts
    154          return t < (this.config.dutyCycle ?? 0.1) ? 1 : 0;
    155        case 'noise':
    156          return Math.random() * 2 - 1;
    157        case 'custom':
    158          if (this.config.customCurve && this.config.customCurve.length > 0) {
    
  • L240

    ts
    238
    239      if (this.config.noiseIntensity && this.config.noiseIntensity > 0) {
    240        value += (Math.random() - 0.5) * this.config.noiseIntensity * 20;
    241        value = clamp(value, 0, 100);
    242      }
    

libs/aphrodite/highlight-clipping/src/index.ts#

  • L71

    ts
    69  function generateId(prefix: string): string {
    70    const timestamp = Date.now().toString(36);
    71    const random = Math.random().toString(36).substring(2, 10);
    72    return `${prefix}_${timestamp}_${random}`;
    73  }
    
  • L786

    ts
    784      // Generate random signals over duration
    785      for (let t = 0; t < durationSeconds; t += 5) {
    786        if (Math.random() > 0.7) {
    787          const signal: HighlightSignal = {
    788            type: signalTypes[Math.floor(Math.random() * signalTypes.length)],
    
  • L788

    ts
    786        if (Math.random() > 0.7) {
    787          const signal: HighlightSignal = {
    788            type: signalTypes[Math.floor(Math.random() * signalTypes.length)],
    789            value: 0.3 + Math.random() * 0.7,
    790            timestamp: t,
    
  • L789

    ts
    787          const signal: HighlightSignal = {
    788            type: signalTypes[Math.floor(Math.random() * signalTypes.length)],
    789            value: 0.3 + Math.random() * 0.7,
    790            timestamp: t,
    791            duration: 2 + Math.random() * 5,
    
  • L791

    ts
    789            value: 0.3 + Math.random() * 0.7,
    790            timestamp: t,
    791            duration: 2 + Math.random() * 5,
    792          };
    793          this.processSignal(sourceId, signal);
    

libs/aphrodite/immersive-theater/src/discovery.ts#

  • L289

    ts
    287          );
    288          // Deterministic check using a hash-like function based on timestamp
    289          // This avoids Math.random() for testability
    290          const pseudoRandom =
    291            Math.abs(Math.sin(ctx.timestamp * 12.9898 + d.definition.id.length * 78.233)) % 1;
    

libs/aphrodite/interactables/src/index.ts#

  • L220

    ts
    218   */
    219  export function generateId(): string {
    220    return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
    221  }
    222
    

libs/aphrodite/lilith-game-bridge/src/lilith-game-bridge.ts#

  • L1120

    ts
    1118      // Discovery chance
    1119      const discoveries = [...exploration.discoveries];
    1120      const discoveryRoll = Math.random();
    1121      const adjustedChance = this.config.discoveryChanceBase * focus * (1 + newAwareness);
    1122
    
  • L1166

    ts
    1164        DiscoveryType.VISION,
    1165      ];
    1166      const type = types[Math.floor(Math.random() * types.length)];
    1167
    1168      const rarityBase = consciousnessIndex(level) / (CONSCIOUSNESS_ORDER.length - 1);
    
  • L1169

    ts
    1167
    1168      const rarityBase = consciousnessIndex(level) / (CONSCIOUSNESS_ORDER.length - 1);
    1169      const rarity = Math.min(1, rarityBase + Math.random() * 0.3);
    1170
    1171      const names: Record<string, string[]> = {
    
  • L1198

    ts
    1196
    1197      const nameList = names[type] ?? ['Unknown Discovery'];
    1198      const name = nameList[Math.floor(Math.random() * nameList.length)];
    1199
    1200      return {
    

libs/aphrodite/literary-engine/src/branching.ts#

  • L135

    ts
    133    let result = '';
    134    for (let i = 0; i < 12; i++) {
    135      result += chars[Math.floor(Math.random() * chars.length)];
    136    }
    137    return result;
    

libs/aphrodite/literary-engine/src/calligraphy.ts#

  • L221

    ts
    219          opacity: 1.0,
    220          drift: {
    221            x: (Math.random() - 0.5) * 2,
    222            y: (Math.random() - 0.5) * 2,
    223          },
    
  • L222

    ts
    220          drift: {
    221            x: (Math.random() - 0.5) * 2,
    222            y: (Math.random() - 0.5) * 2,
    223          },
    224          movement: 'shaking',
    
  • L401

    ts
    399        for (let w = 0; w < words.length; w++) {
    400          const angle = (w / Math.max(words.length, 1)) * Math.PI * 2;
    401          const radius = displayConfig.spread * (0.5 + Math.random() * 0.5);
    402          const cx = Math.cos(angle) * radius;
    403          const cy = Math.sin(angle) * radius;
    
  • L413

    ts
    411              },
    412              velocity: { x: 0, y: 0 },
    413              opacity: 0.6 + Math.random() * 0.4,
    414              scale: 0.8 + Math.random() * 0.4,
    415              rotation: (Math.random() - 0.5) * 0.2,
    
  • L414

    ts
    412              velocity: { x: 0, y: 0 },
    413              opacity: 0.6 + Math.random() * 0.4,
    414              scale: 0.8 + Math.random() * 0.4,
    415              rotation: (Math.random() - 0.5) * 0.2,
    416              weight: 0.5,
    
  • L415

    ts
    413              opacity: 0.6 + Math.random() * 0.4,
    414              scale: 0.8 + Math.random() * 0.4,
    415              rotation: (Math.random() - 0.5) * 0.2,
    416              weight: 0.5,
    417              age: 0,
    
  • L436

    ts
    434            position: { x: i * 12, y: 0 },
    435            velocity: {
    436              x: (Math.random() - 0.5) * displayConfig.spread * 0.1,
    437              y: displayConfig.gravity * 0.5 + Math.random() * 0.5,
    438            },
    
  • L437

    ts
    435            velocity: {
    436              x: (Math.random() - 0.5) * displayConfig.spread * 0.1,
    437              y: displayConfig.gravity * 0.5 + Math.random() * 0.5,
    438            },
    439            opacity: 1.0,
    
  • L442

    ts
    440            scale: 1.0,
    441            rotation: 0,
    442            weight: 0.8 + Math.random() * 0.4,
    443            age: 0,
    444          });
    
  • L454

    ts
    452          const targetX = i * 12;
    453          const targetY = 0;
    454          const scatterAngle = Math.random() * Math.PI * 2;
    455          const scatterDist = displayConfig.spread * (1 + Math.random());
    456          particles.push({
    
  • L455

    ts
    453          const targetY = 0;
    454          const scatterAngle = Math.random() * Math.PI * 2;
    455          const scatterDist = displayConfig.spread * (1 + Math.random());
    456          particles.push({
    457            char: chars[i],
    
  • L468

    ts
    466            opacity: 0.3,
    467            scale: 0.5,
    468            rotation: (Math.random() - 0.5) * Math.PI,
    469            weight: 1.0,
    470            age: 0,
    

libs/aphrodite/literary-engine/src/collaborative.ts#

  • L375

    ts
    373          x = width / 2 + Math.cos(angle) * radius;
    374          y = height / 2 + Math.sin(angle) * radius;
    375          rotation = (Math.random() - 0.5) * 30;
    376          break;
    377        }
    
  • L409

    ts
    407        default: {
    408          // FREEFORM
    409          x = Math.random() * width;
    410          y = Math.random() * height;
    411          rotation = (Math.random() - 0.5) * 60;
    
  • L410

    ts
    408          // FREEFORM
    409          x = Math.random() * width;
    410          y = Math.random() * height;
    411          rotation = (Math.random() - 0.5) * 60;
    412          break;
    
  • L411

    ts
    409          x = Math.random() * width;
    410          y = Math.random() * height;
    411          rotation = (Math.random() - 0.5) * 60;
    412          break;
    413        }
    
  • L631

    ts
    629          displayStyle: config.displayStyle,
    630          opacity: 1.0,
    631          x: Math.random() * 80 + 10,
    632          y: Math.random() * 80 + 10,
    633          fontSize: 14 + Math.random() * 10,
    
  • L632

    ts
    630          opacity: 1.0,
    631          x: Math.random() * 80 + 10,
    632          y: Math.random() * 80 + 10,
    633          fontSize: 14 + Math.random() * 10,
    634          color: `hsl(${Math.floor(Math.random() * 360)}, 60%, 70%)`,
    
  • L633

    ts
    631          x: Math.random() * 80 + 10,
    632          y: Math.random() * 80 + 10,
    633          fontSize: 14 + Math.random() * 10,
    634          color: `hsl(${Math.floor(Math.random() * 360)}, 60%, 70%)`,
    635        };
    
  • L634

    ts
    632          y: Math.random() * 80 + 10,
    633          fontSize: 14 + Math.random() * 10,
    634          color: `hsl(${Math.floor(Math.random() * 360)}, 60%, 70%)`,
    635        };
    636
    

libs/aphrodite/literary-engine/src/literary-engine.ts#

  • L1311

    ts
    1309      });
    1310      const totalWeight = weights.reduce((a, b) => a + b, 0);
    1311      let r = Math.random() * totalWeight;
    1312      for (let i = 0; i < candidates.length; i++) {
    1313        r -= weights[i];
    

libs/aphrodite/literary-engine/src/narrative.ts#

  • L120

    ts
    118    let result = '';
    119    for (let i = 0; i < 12; i++) {
    120      result += chars[Math.floor(Math.random() * chars.length)];
    121    }
    122    return result;
    

libs/aphrodite/literary-engine/src/synesthetic-text.ts#

  • L1805

    ts
    1803        // Select from top candidates with some randomness
    1804        const topN = Math.min(5, scored.length);
    1805        const selected = scored[Math.floor(Math.random() * topN)];
    1806
    1807        const result: TranslationResult = {
    

libs/aphrodite/literary-engine/src/text-env.ts#

  • L441

    ts
    439      const charIdx = i % Math.max(1, chars.length);
    440      const angle = (i / particleCount) * Math.PI * 2;
    441      const speed = 0.3 + Math.random() * 0.7;
    442
    443      particles.push({
    
  • L447

    ts
    445        velocity: {
    446          x: Math.cos(angle) * speed,
    447          y: (Math.random() - 0.3) * speed,
    448          z: Math.sin(angle) * speed,
    449        },
    
  • L452

    ts
    450        character: chars[charIdx] ?? '.',
    451        opacity: 1.0,
    452        size: 12 + Math.random() * 8,
    453        color: lerpColor(rgba(0.9, 0.9, 0.9), envColor, i / particleCount),
    454      });
    
  • L511

    ts
    509      default:
    510        position = {
    511          x: (Math.random() - 0.5) * roomSize,
    512          y: 0.5 + Math.random() * roomSize * 0.3,
    513          z: (Math.random() - 0.5) * roomSize,
    
  • L512

    ts
    510        position = {
    511          x: (Math.random() - 0.5) * roomSize,
    512          y: 0.5 + Math.random() * roomSize * 0.3,
    513          z: (Math.random() - 0.5) * roomSize,
    514        };
    
  • L513

    ts
    511          x: (Math.random() - 0.5) * roomSize,
    512          y: 0.5 + Math.random() * roomSize * 0.3,
    513          z: (Math.random() - 0.5) * roomSize,
    514        };
    515        rotation = {
    
  • L516

    ts
    514        };
    515        rotation = {
    516          x: (Math.random() - 0.5) * 20,
    517          y: Math.random() * 360,
    518          z: (Math.random() - 0.5) * 10,
    
  • L517

    ts
    515        rotation = {
    516          x: (Math.random() - 0.5) * 20,
    517          y: Math.random() * 360,
    518          z: (Math.random() - 0.5) * 10,
    519        };
    
  • L518

    ts
    516          x: (Math.random() - 0.5) * 20,
    517          y: Math.random() * 360,
    518          z: (Math.random() - 0.5) * 10,
    519        };
    520        break;
    

libs/aphrodite/market-intelligence/src/competitive-engine.ts#

  • L47

    ts
    45    const timestamp = Date.now().toString(36);
    46    const counter = competitiveIdCounter.toString(36).padStart(4, '0');
    47    const random = Math.random().toString(36).substring(2, 8);
    48    return `${prefix}_${timestamp}_${counter}_${random}`;
    49  }
    

libs/aphrodite/market-intelligence/src/jurisdiction-engine.ts#

  • L50

    ts
    48    const timestamp = Date.now().toString(36);
    49    const counter = idCounter.toString(36).padStart(4, '0');
    50    const random = Math.random().toString(36).substring(2, 8);
    51    return `${prefix}_${timestamp}_${counter}_${random}`;
    52  }
    

libs/aphrodite/market-intelligence/src/risk-entry-engine.ts#

  • L80

    ts
    78    const timestamp = Date.now().toString(36);
    79    const counter = riskEntryIdCounter.toString(36).padStart(4, '0');
    80    const random = Math.random().toString(36).substring(2, 8);
    81    return `${prefix}_${timestamp}_${counter}_${random}`;
    82  }
    

libs/aphrodite/market-intelligence/src/scoring-engine.ts#

  • L55

    ts
    53    const timestamp = Date.now().toString(36);
    54    const counter = scoringIdCounter.toString(36).padStart(4, '0');
    55    const random = Math.random().toString(36).substring(2, 8);
    56    return `${prefix}_${timestamp}_${counter}_${random}`;
    57  }
    

libs/aphrodite/maya-bridge/src/maya-bridge.ts#

  • L225

    ts
    223        state: AssetImportState.COMPLETE,
    224        outputPath: request.targetPath,
    225        outputSizeBytes: Math.floor(Math.random() * 10_000_000) + 100_000,
    226        durationMs: Date.now() - startTime,
    227        lods,
    

libs/aphrodite/meditation/src/body-celebration/celebration-engine.ts#

  • L491

    ts
    489    if (filtered.length === 0) {
    490      // Fallback to any phrase
    491      const idx = Math.floor(Math.random() * BODY_POSITIVE_PHRASES.length);
    492      return BODY_POSITIVE_PHRASES[idx];
    493    }
    
  • L495

    ts
    493    }
    494
    495    const idx = Math.floor(Math.random() * filtered.length);
    496    return filtered[idx];
    497  }
    

libs/aphrodite/meditation/src/body-positive/body-positive.ts#

  • L236

    ts
    234      const filtered = BPOS_TEXT_AFFIRMATIONS.filter((a) => a.category === category);
    235      if (filtered.length > 0) {
    236        const idx = Math.floor(Math.random() * filtered.length);
    237        return filtered[idx];
    238      }
    
  • L241

    ts
    239    }
    240
    241    const idx = Math.floor(Math.random() * BPOS_TEXT_AFFIRMATIONS.length);
    242    return BPOS_TEXT_AFFIRMATIONS[idx];
    243  }
    
  • L276

    ts
    274
    275      if (propMessages.length > 0) {
    276        celebrationText = propMessages[Math.floor(Math.random() * propMessages.length)];
    277      } else {
    278        celebrationText =
    
  • L280

    ts
    278        celebrationText =
    279          BPOS_MODIFICATION_CELEBRATIONS[
    280            Math.floor(Math.random() * BPOS_MODIFICATION_CELEBRATIONS.length)
    281          ];
    282      }
    
  • L286

    ts
    284      celebrationText =
    285        BPOS_MODIFICATION_CELEBRATIONS[
    286          Math.floor(Math.random() * BPOS_MODIFICATION_CELEBRATIONS.length)
    287        ];
    288    }
    

libs/aphrodite/meditation/src/breath-visualization/breath-viz.ts#

  • L211

    ts
    209      }
    210
    211      const angle = Math.random() * Math.PI * 2;
    212      const speed = 0.02 + Math.random() * 0.08;
    213      const colorIdx = Math.floor(Math.random() * this.config.colors.length);
    
  • L212

    ts
    210
    211      const angle = Math.random() * Math.PI * 2;
    212      const speed = 0.02 + Math.random() * 0.08;
    213      const colorIdx = Math.floor(Math.random() * this.config.colors.length);
    214
    
  • L213

    ts
    211      const angle = Math.random() * Math.PI * 2;
    212      const speed = 0.02 + Math.random() * 0.08;
    213      const colorIdx = Math.floor(Math.random() * this.config.colors.length);
    214
    215      const particle: ParticleState = {
    
  • L217

    ts
    215      const particle: ParticleState = {
    216        id: nextBreathVizId('p'),
    217        x: 0.5 + (Math.random() - 0.5) * 0.1,
    218        y: 0.5 + (Math.random() - 0.5) * 0.1,
    219        size: this.config.minSize + Math.random() * (this.config.maxSize - this.config.minSize),
    
  • L218

    ts
    216        id: nextBreathVizId('p'),
    217        x: 0.5 + (Math.random() - 0.5) * 0.1,
    218        y: 0.5 + (Math.random() - 0.5) * 0.1,
    219        size: this.config.minSize + Math.random() * (this.config.maxSize - this.config.minSize),
    220        opacity: 0.6 + Math.random() * 0.4,
    
  • L219

    ts
    217        x: 0.5 + (Math.random() - 0.5) * 0.1,
    218        y: 0.5 + (Math.random() - 0.5) * 0.1,
    219        size: this.config.minSize + Math.random() * (this.config.maxSize - this.config.minSize),
    220        opacity: 0.6 + Math.random() * 0.4,
    221        color: this.config.colors[colorIdx],
    
  • L220

    ts
    218        y: 0.5 + (Math.random() - 0.5) * 0.1,
    219        size: this.config.minSize + Math.random() * (this.config.maxSize - this.config.minSize),
    220        opacity: 0.6 + Math.random() * 0.4,
    221        color: this.config.colors[colorIdx],
    222        velocity: {
    
  • L226

    ts
    224          vy: Math.sin(angle) * speed,
    225        },
    226        lifetime: 2 + Math.random() * 4,
    227      };
    228
    

libs/aphrodite/meditation/src/voice-guide/voice-guide.ts#

  • L1205

    ts
    1203      // Simulate synthesis: mark as synthesized with a nominal latency
    1204      // In production, this would trigger the TTS provider and be async.
    1205      const simulatedLatencyMs = 50 + Math.random() * 150;
    1206      this.speechQueue.markSynthesized(next.id, simulatedLatencyMs);
    1207
    
  • L1303

    ts
    1301      // Mark as synthesized if not already (simulate instant synthesis)
    1302      if (!next.synthesized) {
    1303        const latencyMs = 30 + Math.random() * 100;
    1304        this.speechQueue.markSynthesized(next.id, latencyMs);
    1305        this.completedLatencies.push(latencyMs);
    

libs/aphrodite/motion-haptics/src/index.ts#

  • L45

    ts
    43
    44  function generateId(): string {
    45    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    46  }
    47
    

libs/aphrodite/movement-engine/src/particle-sculpt.ts#

  • L209

    ts
    207          basePosition: pos,
    208          velocity: { x: 0, y: 0, z: 0 },
    209          size: size * 0.08 * (0.8 + Math.random() * 0.4),
    210          color,
    211          opacity: 0.85 + Math.random() * 0.15,
    
  • L211

    ts
    209          size: size * 0.08 * (0.8 + Math.random() * 0.4),
    210          color,
    211          opacity: 0.85 + Math.random() * 0.15,
    212          vibrationOffset: { x: 0, y: 0, z: 0 },
    213        });
    
  • L246

    ts
    244        basePosition: pos,
    245        velocity: { x: 0, y: 0, z: 0 },
    246        size: radius * 0.06 * (0.8 + Math.random() * 0.4),
    247        color,
    248        opacity: 0.9,
    
  • L306

    ts
    304    for (let i = 0; i < particleCount; i++) {
    305      const angle = (i / particleCount) * Math.PI * 2;
    306      const jitter = (Math.random() - 0.5) * radius * 0.1;
    307
    308      const pos: Vec3 = {
    
  • L310

    ts
    308      const pos: Vec3 = {
    309        x: center.x + Math.cos(angle) * (radius + jitter),
    310        y: center.y + (Math.random() - 0.5) * radius * 0.15,
    311        z: center.z + Math.sin(angle) * (radius + jitter),
    312      };
    
  • L318

    ts
    316        basePosition: pos,
    317        velocity: { x: 0, y: 0, z: 0 },
    318        size: radius * 0.07 * (0.8 + Math.random() * 0.4),
    319        color,
    320        opacity: 0.85 + Math.random() * 0.15,
    
  • L320

    ts
    318        size: radius * 0.07 * (0.8 + Math.random() * 0.4),
    319        color,
    320        opacity: 0.85 + Math.random() * 0.15,
    321        vibrationOffset: { x: 0, y: 0, z: 0 },
    322      });
    
  • L346

    ts
    344    for (let i = 0; i < particleCount; i++) {
    345      const t = particleCount > 1 ? i / (particleCount - 1) - 0.5 : 0;
    346      const jitter = (Math.random() - 0.5) * length * 0.05;
    347
    348      const pos: Vec3 = {
    
  • L358

    ts
    356        basePosition: pos,
    357        velocity: { x: 0, y: 0, z: 0 },
    358        size: length * 0.02 * (0.8 + Math.random() * 0.4),
    359        color,
    360        opacity: 0.9,
    
  • L379

    ts
    377    for (let i = 0; i < particleCount; i++) {
    378      // Gaussian-ish distribution within sphere
    379      const u = Math.random();
    380      const v = Math.random();
    381      const theta = 2 * Math.PI * u;
    
  • L380

    ts
    378      // Gaussian-ish distribution within sphere
    379      const u = Math.random();
    380      const v = Math.random();
    381      const theta = 2 * Math.PI * u;
    382      const phi = Math.acos(2 * v - 1);
    
  • L383

    ts
    381      const theta = 2 * Math.PI * u;
    382      const phi = Math.acos(2 * v - 1);
    383      const r = radius * Math.pow(Math.random(), 1 / 3);
    384
    385      const pos: Vec3 = {
    
  • L395

    ts
    393        basePosition: pos,
    394        velocity: {
    395          x: (Math.random() - 0.5) * 0.05,
    396          y: Math.random() * 0.02,
    397          z: (Math.random() - 0.5) * 0.05,
    
  • L396

    ts
    394        velocity: {
    395          x: (Math.random() - 0.5) * 0.05,
    396          y: Math.random() * 0.02,
    397          z: (Math.random() - 0.5) * 0.05,
    398        },
    
  • L397

    ts
    395          x: (Math.random() - 0.5) * 0.05,
    396          y: Math.random() * 0.02,
    397          z: (Math.random() - 0.5) * 0.05,
    398        },
    399        size: radius * 0.06 * (0.6 + Math.random() * 0.8),
    
  • L399

    ts
    397          z: (Math.random() - 0.5) * 0.05,
    398        },
    399        size: radius * 0.06 * (0.6 + Math.random() * 0.8),
    400        color: lerpColor(color, rgba(1, 1, 1, 0.5), Math.random() * 0.2),
    401        opacity: 0.6 + Math.random() * 0.3,
    
  • L400

    ts
    398        },
    399        size: radius * 0.06 * (0.6 + Math.random() * 0.8),
    400        color: lerpColor(color, rgba(1, 1, 1, 0.5), Math.random() * 0.2),
    401        opacity: 0.6 + Math.random() * 0.3,
    402        vibrationOffset: { x: 0, y: 0, z: 0 },
    
  • L401

    ts
    399        size: radius * 0.06 * (0.6 + Math.random() * 0.8),
    400        color: lerpColor(color, rgba(1, 1, 1, 0.5), Math.random() * 0.2),
    401        opacity: 0.6 + Math.random() * 0.3,
    402        vibrationOffset: { x: 0, y: 0, z: 0 },
    403      });
    
  • L641

    ts
    639                opacity: p.opacity * (1 - clamp01(dissolveProgress)),
    640                position: {
    641                  x: p.position.x + (Math.random() - 0.5) * dissolveProgress * 0.3,
    642                  y: p.position.y + dissolveProgress * 0.2,
    643                  z: p.position.z + (Math.random() - 0.5) * dissolveProgress * 0.3,
    
  • L643

    ts
    641                  x: p.position.x + (Math.random() - 0.5) * dissolveProgress * 0.3,
    642                  y: p.position.y + dissolveProgress * 0.2,
    643                  z: p.position.z + (Math.random() - 0.5) * dissolveProgress * 0.3,
    644                },
    645              }));
    

libs/aphrodite/multi-performer/src/biometrics/group-effects.ts#

  • L615

    ts
    613          id,
    614          origin: {
    615            x: (Math.random() - 0.5) * 200,
    616            y: 50 + Math.random() * 100,
    617            z: (Math.random() - 0.5) * 200,
    
  • L616

    ts
    614          origin: {
    615            x: (Math.random() - 0.5) * 200,
    616            y: 50 + Math.random() * 100,
    617            z: (Math.random() - 0.5) * 200,
    618          },
    
  • L617

    ts
    615            x: (Math.random() - 0.5) * 200,
    616            y: 50 + Math.random() * 100,
    617            z: (Math.random() - 0.5) * 200,
    618          },
    619          color: fireworkColor(peakArousal, i),
    

libs/aphrodite/multi-performer/src/scenes/jungle-biodiversity.ts#

  • L369

    ts
    367      if (this.destroyed) return null;
    368      if (this.flora.size >= this.config.maxFloraInstances) return null;
    369      const ft = type ?? selectFloraType(Math.random());
    370      const id = generateJungleId('flora');
    371      const inst: FloraInstance = {
    
  • L375

    ts
    373        type: ft,
    374        position,
    375        scale: 0.5 + Math.random() * 1.5,
    376        layer: selectLayerForFlora(ft),
    377        bioluminescenceIntensity:
    
  • L378

    ts
    376        layer: selectLayerForFlora(ft),
    377        bioluminescenceIntensity:
    378          ft === FloraType.BIOLUMINESCENT_MUSHROOM ? 0.8 + Math.random() * 0.2 : 0,
    379        interactionRadius: this.config.performerInteractionRadius,
    380        healthNormalized: 1,
    

libs/aphrodite/multi-source/src/index.ts#

  • L2359

    ts
    2357        const min = this.config.randomMinInterval ?? 3000;
    2358        const max = this.config.randomMaxInterval ?? 10000;
    2359        const delay = min + Math.random() * (max - min);
    2360
    2361        this.timerInterval = setTimeout(() => {
    
  • L2421

    ts
    2419      if (availableSources.length === 0) return;
    2420
    2421      const randomIndex = Math.floor(Math.random() * availableSources.length);
    2422      const randomSourceId = availableSources[randomIndex];
    2423
    

libs/aphrodite/multi-source/src/test-setup.ts#

  • L28

    ts
    26    constructor(kind: 'audio' | 'video' = 'video', id?: string) {
    27      this.kind = kind;
    28      this.id = id ?? `track-${Date.now()}-${Math.random().toString(36).slice(2)}`;
    29      this.label = `Mock ${kind} track`;
    30    }
    
  • L95

    ts
    93
    94    constructor(tracks?: MockMediaStreamTrack[]) {
    95      this.id = `stream-${Date.now()}-${Math.random().toString(36).slice(2)}`;
    96      if (tracks) {
    97        this.tracks = tracks;
    
  • L370

    ts
    368      getFloatTimeDomainData: vi.fn((array: Float32Array) => {
    369        for (let i = 0; i < array.length; i++) {
    370          array[i] = Math.random() * 0.2 - 0.1;
    371        }
    372      }),
    

libs/aphrodite/neuro-design/src/dopamine-schedule.ts#

  • L174

    ts
    172    scheduleType: ScheduleType
    173  ): number {
    174    const jitter = (Math.random() * 2 - 1) * variance;
    175
    176    switch (scheduleType) {
    
  • L182

    ts
    180      }
    181      case ScheduleType.VARIABLE_RATIO: {
    182        const ratio = meanIntervalMs * (0.5 + Math.random());
    183        return lastDeliveryAt + Math.max(3000, ratio);
    184      }
    
  • L408

    ts
    406    function maybeCreateAnticipation(timestamp: number, rewardType: RewardType): void {
    407      if (activeAnticipation && !activeAnticipation.resolved) return;
    408      if (Math.random() > config.anticipationProbability) return;
    409
    410      activeAnticipation = {
    

libs/aphrodite/neuro-design/src/reward-system.ts#

  • L395

    ts
    393  // ---- Pseudo-random (deterministic seeded) ----------------------------------
    394
    395  /** Simple LCG for deterministic "random" numbers without Math.random(). */
    396  function createLCG(seed: number): () => number {
    397    let state = seed;
    

libs/aphrodite/nft-integration/src/index.ts#

  • L73

    ts
    71  function generateId(prefix: string): string {
    72    const timestamp = Date.now().toString(36);
    73    const random = Math.random().toString(36).substring(2, 10);
    74    return `${prefix}_${timestamp}_${random}`;
    75  }
    
  • L1193

    ts
    1191            // Would check staking contract for user's staked NFTs
    1192            // Simulated for now
    1193            result.passed = Math.random() > 0.7;
    1194            break;
    1195          }
    

libs/aphrodite/notification-intelligence/src/content-personalizer.ts#

  • L489

    ts
    487      // Weighted random selection
    488      const totalWeight = variations.reduce((sum, v) => sum + v.weight, 0);
    489      let random = Math.random() * totalWeight;
    490
    491      for (const variation of variations) {
    

libs/aphrodite/notification-intelligence/src/timing-optimizer.ts#

  • L588

    ts
    586
    587      // For standard notifications, apply exploration/exploitation
    588      if (Math.random() < this.config.explorationRate) {
    589        // Explore: try a different time
    590        return this.exploreAlternativeTime(request, profile, factors, now);
    
  • L802

    ts
    800    ): TimingRecommendation {
    801      // Add some randomness to explore different times
    802      const randomOffset = Math.floor(Math.random() * 120) - 60; // -60 to +60 minutes
    803      const explorationTime = new Date(now.getTime() + randomOffset * 60 * 1000);
    804
    

libs/aphrodite/partnerships/src/partnership-engine.ts#

  • L39

    ts
    37   */
    38  function generateId(prefix: string): string {
    39    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    40  }
    41
    

libs/aphrodite/payments/src/processors/index.ts#

  • L73

    ts
    71     */
    72    protected generateIdempotencyKey(): string {
    73      return `${Date.now()}_${Math.random().toString(36).substring(2, 15)}`;
    74    }
    75  }
    
  • L454

    ts
    452
    453    private generateSessionId(): string {
    454      return `epoch_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    455    }
    456  }
    

libs/aphrodite/payments/src/tax/index.ts#

  • L315

    ts
    313
    314      const document: TaxDocument = {
    315        id: `tax_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`,
    316        userId,
    317        type: 'W-9',
    
  • L346

    ts
    344
    345      const document: TaxDocument = {
    346        id: `tax_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`,
    347        userId,
    348        type: 'W-8BEN',
    

libs/aphrodite/performer-presence/src/artistic.ts#

  • L962

    ts
    960      const gc = this.config.glassConfig;
    961      const usedShape = shape ?? this._shapeForStyle(effect.style);
    962      const usedSize = size ?? 10 + Math.random() * 15;
    963
    964      const vertices = generateFragmentVertices(center, usedShape, usedSize);
    

libs/aphrodite/performer-presence/src/nature.ts#

  • L890

    ts
    888        opacity: 1.0,
    889        form: waterForm,
    890        ripplePhase: Math.random() * Math.PI * 2,
    891      };
    892
    

libs/aphrodite/performer-sovereignty/src/data-ownership.ts#

  • L313

    ts
    311
    312  function generateId(prefix: string): string {
    313    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    314  }
    315
    

libs/aphrodite/platform-accessibility/src/audio-desc/index.ts#

  • L83

    ts
    81  ): AudioDescriptionSegment {
    82    return {
    83      id: `ad-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    84      text,
    85      startMs,
    

libs/aphrodite/platform-accessibility/src/captions/index.ts#

  • L76

    ts
    74  ): CaptionSegment {
    75    return {
    76      id: `cap-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    77      text,
    78      startMs,
    

libs/aphrodite/platform-accessibility/src/compliance/index.ts#

  • L93

    ts
    91  ): ComplianceRequirement {
    92    return {
    93      id: `req-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    94      standard,
    95      criterionId,
    
  • L112

    ts
    110  ): RemediationTask {
    111    return {
    112      id: `rem-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    113      requirementId,
    114      title,
    
  • L242

    ts
    240      this.assertAlive();
    241      const report: ComplianceReport = {
    242        reportId: `rpt-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    243        generatedAt: Date.now(),
    244        standards: [...this.config.targetStandards],
    

libs/aphrodite/platform-accessibility/src/hearing/index.ts#

  • L104

    ts
    102  ): VisualAlert {
    103    return {
    104      id: `alert-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    105      type,
    106      triggerSound,
    

libs/aphrodite/platform-accessibility/src/motor/index.ts#

  • L136

    ts
    134    if (switchCount >= 4) actions.push({ switchIndex: 3, action: SwitchAction.Back });
    135    return {
    136      id: `switch-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    137      name,
    138      switchCount,
    

libs/aphrodite/platform-accessibility/src/personalization/index.ts#

  • L104

    ts
    102    const now = Date.now();
    103    return {
    104      profileId: `prof-${now}-${Math.random().toString(36).slice(2, 6)}`,
    105      userId,
    106      displayName,
    
  • L177

    ts
    175  ): AdaptationRule {
    176    return {
    177      id: `rule-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    178      name,
    179      condition,
    

libs/aphrodite/platform-accessibility/src/testing/index.ts#

  • L354

    ts
    352      const summary = computeAuditSummary(results, this.rules.length);
    353      const audit: AuditResult = {
    354        auditId: `audit-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    355        scope: this.config.scope,
    356        startedAt,
    

libs/aphrodite/platform-accessibility/src/wcag/index.ts#

  • L319

    ts
    317            const issue: AccessibilityIssue = {
    318              ...raw,
    319              id: `issue-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    320              createdAt: Date.now(),
    321            };
    

libs/aphrodite/platform-analytics/src/dashboard/global-dashboard.ts#

  • L44

    ts
    42
    43    return {
    44      widgetId: `widget-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    45      widgetType,
    46      title,
    

libs/aphrodite/platform-analytics/src/realtime/realtime-analytics.ts#

  • L26

    ts
    24  /** Create a unique subscription ID */
    25  export function generateSubscriptionId(prefix: string): string {
    26    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    27  }
    28
    

libs/aphrodite/platform-analytics/src/reporting/analytics-reporting.ts#

  • L28

    ts
    26  /** Generate a unique report ID */
    27  export function generateReportId(): string {
    28    return `report-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    29  }
    30
    

libs/aphrodite/ppv/src/index.ts#

  • L55

    ts
    53  function generateId(prefix: string): string {
    54    const timestamp = Date.now().toString(36);
    55    const random = Math.random().toString(36).substring(2, 10);
    56    return `${prefix}_${timestamp}_${random}`;
    57  }
    
  • L75

    ts
    73   */
    74  function generateAccessToken(): string {
    75    return `ppv_access_${Date.now()}_${Math.random().toString(36).substring(2, 15)}`;
    76  }
    77
    

libs/aphrodite/privacy-coins/src/index.ts#

  • L1360

    ts
    1358      );
    1359
    1360      const paymentId = `priv_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
    1361
    1362      if (coin === 'XMR') {
    

libs/aphrodite/procedural-art/src/tuning.ts#

  • L582

    ts
    580        const range = def.max - def.min;
    581        const maxOffset = range * bounds;
    582        const offset = (Math.random() - 0.5) * 2 * maxOffset;
    583        const newValue = def.defaultValue + offset;
    584        state.currentValues[def.name] = clampToParam(newValue, def);
    
  • L735

    ts
    733        const currentVal = state.currentValues[def.name] ?? def.defaultValue;
    734        const range = def.max - def.min;
    735        const targetOffset = (Math.random() - 0.5) * range * 0.3;
    736        const targetVal = clampToParam(currentVal + targetOffset, def);
    737        const duration = (5000 + Math.random() * 10000) / state.driftSpeedScale;
    
  • L737

    ts
    735        const targetOffset = (Math.random() - 0.5) * range * 0.3;
    736        const targetVal = clampToParam(currentVal + targetOffset, def);
    737        const duration = (5000 + Math.random() * 10000) / state.driftSpeedScale;
    738
    739        const animation: ParameterAnimation = {
    
  • L818

    ts
    816            const currentVal = state.currentValues[def.name] ?? def.defaultValue;
    817            const range = def.max - def.min;
    818            const targetOffset = (Math.random() - 0.5) * range * 0.3;
    819            const targetVal = clampToParam(currentVal + targetOffset, def);
    820            const duration = (5000 + Math.random() * 10000) / state.driftSpeedScale;
    
  • L820

    ts
    818            const targetOffset = (Math.random() - 0.5) * range * 0.3;
    819            const targetVal = clampToParam(currentVal + targetOffset, def);
    820            const duration = (5000 + Math.random() * 10000) / state.driftSpeedScale;
    821
    822            state.animations.push({
    

libs/aphrodite/production/src/analytics/show-analytics.ts#

  • L223

    ts
    221    let result = '';
    222    for (let i = 0; i < 12; i++) {
    223      result += chars[Math.floor(Math.random() * chars.length)];
    224    }
    225    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/assets/production-assets.ts#

  • L203

    ts
    201    let result = '';
    202    for (let i = 0; i < 16; i++) {
    203      result += chars[Math.floor(Math.random() * chars.length)];
    204    }
    205    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/automation/show-automation.ts#

  • L198

    ts
    196    let result = '';
    197    for (let i = 0; i < 12; i++) {
    198      result += chars[Math.floor(Math.random() * chars.length)];
    199    }
    200    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/budget/budget-tracker.ts#

  • L192

    ts
    190    let result = '';
    191    for (let i = 0; i < 16; i++) {
    192      result += chars[Math.floor(Math.random() * chars.length)];
    193    }
    194    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/callsheet/call-sheet.ts#

  • L188

    ts
    186    let result = '';
    187    for (let i = 0; i < 16; i++) {
    188      result += chars[Math.floor(Math.random() * chars.length)];
    189    }
    190    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/collaboration/team-workspace.ts#

  • L213

    ts
    211    let result = '';
    212    for (let i = 0; i < 16; i++) {
    213      result += chars[Math.floor(Math.random() * chars.length)];
    214    }
    215    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/comms/live-comms.ts#

  • L155

    ts
    153    let result = '';
    154    for (let i = 0; i < 16; i++) {
    155      result += chars[Math.floor(Math.random() * chars.length)];
    156    }
    157    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/communication/live-comms.ts#

  • L115

    ts
    113    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    114    let id = '';
    115    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    116    return `ch-${id}`;
    117  }
    
  • L122

    ts
    120    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    121    let id = '';
    122    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    123    return `msg-${id}`;
    124  }
    

libs/aphrodite/production/src/cue/cue-editor.ts#

  • L285

    ts
    283    let result = '';
    284    for (let i = 0; i < 12; i++) {
    285      result += chars[Math.floor(Math.random() * chars.length)];
    286    }
    287    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/cue/cue-execution.ts#

  • L158

    ts
    156    let result = '';
    157    for (let i = 0; i < 12; i++) {
    158      result += chars[Math.floor(Math.random() * chars.length)];
    159    }
    160    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/cues/cue-editor.ts#

  • L109

    ts
    107    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    108    let id = '';
    109    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    110    return `ec-${id}`;
    111  }
    

libs/aphrodite/production/src/cues/cue-executor.ts#

  • L114

    ts
    112    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    113    let id = '';
    114    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    115    return `cue-${id}`;
    116  }
    

libs/aphrodite/production/src/cues/cue-preview.ts#

  • L122

    ts
    120    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    121    let id = '';
    122    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    123    return `ly-${id}`;
    124  }
    
  • L129

    ts
    127    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    128    let id = '';
    129    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    130    return `it-${id}`;
    131  }
    

libs/aphrodite/production/src/emergency/emergency-control.ts#

  • L211

    ts
    209    let result = '';
    210    for (let i = 0; i < 16; i++) {
    211      result += chars[Math.floor(Math.random() * chars.length)];
    212    }
    213    return `${prefix}-${result}`;
    
  • L517

    ts
    515        executedAt: timestamp,
    516        executedBy,
    517        responseTimeMs: Math.floor(Math.random() * 80) + 10, // simulated sub-100ms
    518        success: true,
    519        notes: '',
    

libs/aphrodite/production/src/emergency/emergency-controls.ts#

  • L130

    ts
    128    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    129    let id = '';
    130    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    131    return `ea-${id}`;
    132  }
    

libs/aphrodite/production/src/multistage/multi-stage-manager.ts#

  • L173

    ts
    171    let result = '';
    172    for (let i = 0; i < 16; i++) {
    173      result += chars[Math.floor(Math.random() * chars.length)];
    174    }
    175    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/operators/multi-operator.ts#

  • L151

    ts
    149    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    150    let id = '';
    151    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    152    return `op-${id}`;
    153  }
    
  • L158

    ts
    156    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    157    let id = '';
    158    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    159    return `cf-${id}`;
    160  }
    

libs/aphrodite/production/src/performance/team-performance.ts#

  • L212

    ts
    210    let result = '';
    211    for (let i = 0; i < 16; i++) {
    212      result += chars[Math.floor(Math.random() * chars.length)];
    213    }
    214    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/postshow/postshow-manager.ts#

  • L229

    ts
    227    let result = '';
    228    for (let i = 0; i < 12; i++) {
    229      result += chars[Math.floor(Math.random() * chars.length)];
    230    }
    231    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/preshow/preshow-manager.ts#

  • L188

    ts
    186    let result = '';
    187    for (let i = 0; i < 12; i++) {
    188      result += chars[Math.floor(Math.random() * chars.length)];
    189    }
    190    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/preview/cue-preview.ts#

  • L175

    ts
    173    let result = '';
    174    for (let i = 0; i < 16; i++) {
    175      result += chars[Math.floor(Math.random() * chars.length)];
    176    }
    177    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/production.ts#

  • L278

    ts
    276    let result = '';
    277    for (let i = 0; i < 16; i++) {
    278      result += chars[Math.floor(Math.random() * chars.length)];
    279    }
    280    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/promotion/show-promotion.ts#

  • L152

    ts
    150    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    151    let id = '';
    152    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    153    return `cmp-${id}`;
    154  }
    
  • L159

    ts
    157    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    158    let id = '';
    159    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    160    return `pst-${id}`;
    161  }
    

libs/aphrodite/production/src/quality/production-quality.ts#

  • L149

    ts
    147    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    148    let id = '';
    149    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    150    return `qs-${id}`;
    151  }
    

libs/aphrodite/production/src/quality/quality-checklist.ts#

  • L191

    ts
    189    let result = '';
    190    for (let i = 0; i < 16; i++) {
    191      result += chars[Math.floor(Math.random() * chars.length)];
    192    }
    193    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/rehearsal/rehearsal-manager.ts#

  • L197

    ts
    195    let result = '';
    196    for (let i = 0; i < 12; i++) {
    197      result += chars[Math.floor(Math.random() * chars.length)];
    198    }
    199    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/reporting/post-show-report.ts#

  • L137

    ts
    135    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    136    let id = '';
    137    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    138    return `rpt-${id}`;
    139  }
    
  • L144

    ts
    142    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    143    let id = '';
    144    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    145    return `mt-${id}`;
    146  }
    
  • L151

    ts
    149    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    150    let id = '';
    151    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    152    return `hl-${id}`;
    153  }
    

libs/aphrodite/production/src/reporting/show-reporting.ts#

  • L187

    ts
    185    let result = '';
    186    for (let i = 0; i < 16; i++) {
    187      result += chars[Math.floor(Math.random() * chars.length)];
    188    }
    189    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/runbook/show-runbook.ts#

  • L212

    ts
    210    let result = '';
    211    for (let i = 0; i < 16; i++) {
    212      result += chars[Math.floor(Math.random() * chars.length)];
    213    }
    214    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/runbooks/show-runbook.ts#

  • L131

    ts
    129    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    130    let id = '';
    131    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    132    return `rb-${id}`;
    133  }
    
  • L138

    ts
    136    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    137    let id = '';
    138    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    139    return `st-${id}`;
    140  }
    

libs/aphrodite/production/src/rundown/rundown-engine.ts#

  • L186

    ts
    184    let result = '';
    185    for (let i = 0; i < 12; i++) {
    186      result += chars[Math.floor(Math.random() * chars.length)];
    187    }
    188    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/scenes/scene-manager.ts#

  • L175

    ts
    173    let result = '';
    174    for (let i = 0; i < 16; i++) {
    175      result += chars[Math.floor(Math.random() * chars.length)];
    176    }
    177    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/scheduling/call-sheets.ts#

  • L130

    ts
    128    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    129    let id = '';
    130    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    131    return `cs-${id}`;
    132  }
    
  • L137

    ts
    135    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    136    let id = '';
    137    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    138    return `call-${id}`;
    139  }
    

libs/aphrodite/production/src/scheduling/show-calendar.ts#

  • L178

    ts
    176    let result = '';
    177    for (let i = 0; i < 16; i++) {
    178      result += chars[Math.floor(Math.random() * chars.length)];
    179    }
    180    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/templates/show-templates.ts#

  • L169

    ts
    167    let result = '';
    168    for (let i = 0; i < 16; i++) {
    169      result += chars[Math.floor(Math.random() * chars.length)];
    170    }
    171    return `${prefix}-${result}`;
    

libs/aphrodite/production/src/ticketing/ticket-integration.ts#

  • L193

    ts
    191    let result = '';
    192    for (let i = 0; i < 16; i++) {
    193      result += chars[Math.floor(Math.random() * chars.length)];
    194    }
    195    return `${prefix}-${result}`;
    

libs/aphrodite/property/src/design/aesthetic-standards.ts#

  • L30

    ts
    28    aestheticIdCounter++;
    29    const timestamp = Date.now().toString(36);
    30    const random = Math.random().toString(36).slice(2, 8);
    31    return `${prefix}_${timestamp}_${random}_${aestheticIdCounter}`;
    32  }
    

libs/aphrodite/property/src/design/space-planning.ts#

  • L29

    ts
    27    spaceIdCounter++;
    28    const timestamp = Date.now().toString(36);
    29    const random = Math.random().toString(36).slice(2, 8);
    30    return `${prefix}_${timestamp}_${random}_${spaceIdCounter}`;
    31  }
    

libs/aphrodite/property/src/design/tech-infrastructure.ts#

  • L29

    ts
    27    techIdCounter++;
    28    const timestamp = Date.now().toString(36);
    29    const random = Math.random().toString(36).slice(2, 8);
    30    return `${prefix}_${timestamp}_${random}_${techIdCounter}`;
    31  }
    

libs/aphrodite/property/src/legal/neighbor-relations.ts#

  • L26

    ts
    24    nrIdCounter++;
    25    const timestamp = Date.now().toString(36);
    26    const random = Math.random().toString(36).slice(2, 8);
    27    return `${prefix}_${timestamp}_${random}_${nrIdCounter}`;
    28  }
    

libs/aphrodite/property/src/legal/portfolio-optimization.ts#

  • L25

    ts
    23    poIdCounter++;
    24    const timestamp = Date.now().toString(36);
    25    const random = Math.random().toString(36).slice(2, 8);
    26    return `${prefix}_${timestamp}_${random}_${poIdCounter}`;
    27  }
    

libs/aphrodite/property/src/legal/regulatory-compliance.ts#

  • L25

    ts
    23    rcIdCounter++;
    24    const timestamp = Date.now().toString(36);
    25    const random = Math.random().toString(36).slice(2, 8);
    26    return `${prefix}_${timestamp}_${random}_${rcIdCounter}`;
    27  }
    

libs/aphrodite/property/src/legal/risk-assessment.ts#

  • L26

    ts
    24    raIdCounter++;
    25    const timestamp = Date.now().toString(36);
    26    const random = Math.random().toString(36).slice(2, 8);
    27    return `${prefix}_${timestamp}_${random}_${raIdCounter}`;
    28  }
    

libs/aphrodite/property/src/legal/sustainability.ts#

  • L26

    ts
    24    susIdCounter++;
    25    const timestamp = Date.now().toString(36);
    26    const random = Math.random().toString(36).slice(2, 8);
    27    return `${prefix}_${timestamp}_${random}_${susIdCounter}`;
    28  }
    

libs/aphrodite/property/src/operations/insurance.ts#

  • L25

    ts
    23    insIdCounter++;
    24    const timestamp = Date.now().toString(36);
    25    const random = Math.random().toString(36).slice(2, 8);
    26    return `${prefix}_${timestamp}_${random}_${insIdCounter}`;
    27  }
    

libs/aphrodite/property/src/operations/maintenance.ts#

  • L25

    ts
    23    maintIdCounter++;
    24    const timestamp = Date.now().toString(36);
    25    const random = Math.random().toString(36).slice(2, 8);
    26    return `${prefix}_${timestamp}_${random}_${maintIdCounter}`;
    27  }
    

libs/aphrodite/property/src/operations/multi-venue-dashboard.ts#

  • L26

    ts
    24    opsIdCounter++;
    25    const timestamp = Date.now().toString(36);
    26    const random = Math.random().toString(36).slice(2, 8);
    27    return `${prefix}_${timestamp}_${random}_${opsIdCounter}`;
    28  }
    

libs/aphrodite/property/src/property-engine.ts#

  • L52

    ts
    50    idCounter++;
    51    const timestamp = Date.now().toString(36);
    52    const random = Math.random().toString(36).slice(2, 8);
    53    return `${prefix}_${timestamp}_${random}_${idCounter}`;
    54  }
    

libs/aphrodite/property/src/renovation/project-management.ts#

  • L25

    ts
    23    renovationIdCounter++;
    24    const timestamp = Date.now().toString(36);
    25    const random = Math.random().toString(36).slice(2, 8);
    26    return `${prefix}_${timestamp}_${random}_${renovationIdCounter}`;
    27  }
    

libs/aphrodite/property/src/renovation/tech-installation.ts#

  • L27

    ts
    25    techIdCounter++;
    26    const timestamp = Date.now().toString(36);
    27    const random = Math.random().toString(36).slice(2, 8);
    28    return `${prefix}_${timestamp}_${random}_${techIdCounter}`;
    29  }
    

libs/aphrodite/recommendations/src/realtime.ts#

  • L749

    ts
    747     */
    748    private applyExploration(items: RecommendationItem[]): void {
    749      if (Math.random() > this.config.explorationRate) return;
    750
    751      // Randomly boost some items from lower positions
    
  • L756

    ts
    754
    755      for (let i = 0; i < numToBoost; i++) {
    756        const randomIndex = minPosition + Math.floor(Math.random() * (items.length - minPosition));
    757        if (randomIndex < items.length) {
    758          items[randomIndex].score *= 1.3; // Boost exploration items
    
  • L997

    ts
    995
    996      // Apply exploration
    997      if (Math.random() < this.config.explorationRate && liveBroadcasters.length > 5) {
    998        // Swap a random lower item with a top item
    999        const lowIdx = Math.floor(
    
  • L1000

    ts
    998        // Swap a random lower item with a top item
    999        const lowIdx = Math.floor(
    1000          liveBroadcasters.length * 0.7 + Math.random() * liveBroadcasters.length * 0.3
    1001        );
    1002        const highIdx = Math.floor(Math.random() * 3);
    
  • L1002

    ts
    1000          liveBroadcasters.length * 0.7 + Math.random() * liveBroadcasters.length * 0.3
    1001        );
    1002        const highIdx = Math.floor(Math.random() * 3);
    1003        if (lowIdx < liveBroadcasters.length) {
    1004          [liveBroadcasters[highIdx], liveBroadcasters[lowIdx]] = [
    

libs/aphrodite/recommendations/src/test-helpers.ts#

  • L28

    ts
    26   */
    27  export function createMockViewerProfile(overrides: Partial<ViewerProfile> = {}): ViewerProfile {
    28    const viewerId = overrides.viewerId ?? `viewer-${Math.random().toString(36).substring(7)}`;
    29
    30    return {
    
  • L125

    ts
    123  ): BroadcasterProfile {
    124    const broadcasterId =
    125      overrides.broadcasterId ?? `broadcaster-${Math.random().toString(36).substring(7)}`;
    126
    127    return {
    
  • L189

    ts
    187   */
    188  export function createMockStreamMetadata(overrides: Partial<StreamMetadata> = {}): StreamMetadata {
    189    const streamId = overrides.streamId ?? `stream-${Math.random().toString(36).substring(7)}`;
    190
    191    return {
    
  • L241

    ts
    239  ): ViewerInteraction {
    240    return {
    241      id: overrides.id ?? `interaction-${Math.random().toString(36).substring(7)}`,
    242      viewerId: overrides.viewerId ?? 'viewer-1',
    243      broadcasterId: overrides.broadcasterId ?? 'broadcaster-1',
    
  • L304

    ts
    302      for (let i = 0; i < countPerBroadcaster; i++) {
    303        const type = types[i % types.length];
    304        const timestamp = new Date(Date.now() - Math.random() * daysAgo * 24 * 60 * 60 * 1000);
    305
    306        interactions.push(
    
  • L312

    ts
    310            interactionType: type,
    311            timestamp,
    312            duration: type === 'watch_duration' ? Math.floor(Math.random() * 60 * 60) : undefined,
    313            amount: type === 'tip' ? Math.floor(Math.random() * 100) + 10 : undefined,
    314          })
    
  • L313

    ts
    311            timestamp,
    312            duration: type === 'watch_duration' ? Math.floor(Math.random() * 60 * 60) : undefined,
    313            amount: type === 'tip' ? Math.floor(Math.random() * 100) + 10 : undefined,
    314          })
    315        );
    

libs/aphrodite/research-agents/src/agent-engine.ts#

  • L54

    ts
    52    const timestamp = Date.now().toString(36);
    53    const counter = idCounter.toString(36).padStart(4, '0');
    54    const random = Math.random().toString(36).substring(2, 8);
    55    return `${prefix}_${timestamp}_${counter}_${random}`;
    56  }
    

libs/aphrodite/revenue-sharing/src/index.ts#

  • L46

    ts
    44
    45  function generateId(prefix: string): string {
    46    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    47  }
    48
    
  • L53

    ts
    51    let code = '';
    52    for (let i = 0; i < length; i++) {
    53      code += chars.charAt(Math.floor(Math.random() * chars.length));
    54    }
    55    return code;
    

libs/aphrodite/risk-crisis/src/risk-engine.ts#

  • L356

    ts
    354
    355  function generateId(prefix: string): string {
    356    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    357  }
    358
    

libs/aphrodite/sacred-architecture/src/composition.ts#

  • L276

    ts
    274
    275  function generateId(): string {
    276    return `comp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    277  }
    278
    

libs/aphrodite/sacred-architecture/src/destruction-rebirth.ts#

  • L375

    ts
    373    for (let i = 0; i < count; i++) {
    374      const angle = (i / count) * Math.PI * 2;
    375      const elevation = (Math.random() - 0.5) * Math.PI;
    376      const speed = preset.spreadForce * (0.5 + Math.random() * 0.5);
    377
    
  • L376

    ts
    374      const angle = (i / count) * Math.PI * 2;
    375      const elevation = (Math.random() - 0.5) * Math.PI;
    376      const speed = preset.spreadForce * (0.5 + Math.random() * 0.5);
    377
    378      const t = i / count;
    
  • L381

    ts
    379      const color = t < 0.6 ? preset.color : preset.secondaryColor;
    380      const size =
    381        preset.particleMinSize + Math.random() * (preset.particleMaxSize - preset.particleMinSize);
    382
    383      particles.push({
    
  • L392

    ts
    390        size,
    391        color,
    392        opacity: 0.8 + Math.random() * 0.2,
    393        rotation: Math.random() * 360,
    394        angularVelocity: (Math.random() - 0.5) * 720,
    
  • L393

    ts
    391        color,
    392        opacity: 0.8 + Math.random() * 0.2,
    393        rotation: Math.random() * 360,
    394        angularVelocity: (Math.random() - 0.5) * 720,
    395      });
    
  • L394

    ts
    392        opacity: 0.8 + Math.random() * 0.2,
    393        rotation: Math.random() * 360,
    394        angularVelocity: (Math.random() - 0.5) * 720,
    395      });
    396    }
    

libs/aphrodite/sacred-architecture/src/japanese-space.ts#

  • L443

    ts
    441          // Cycle through transience types based on accumulated time
    442          const types = Object.values(Transience);
    443          const idx = Math.floor(Math.random() * types.length);
    444          triggerTransience(types[idx]);
    445        }
    

libs/aphrodite/sacred-dance/src/devices/dance-device-profiles.ts#

  • L491

    ts
    489        sensorOffsets: offsets,
    490        accuracy,
    491        durationMs: Math.round(Math.random() * 5000 + 1000),
    492        calibratedAt: Date.now(),
    493      };
    

libs/aphrodite/sacred-dance/src/engagement/viewer-engagement.ts#

  • L769

    ts
    767        : this.triviaQuestions;
    768      if (filtered.length === 0) return null;
    769      return filtered[Math.floor(Math.random() * filtered.length)];
    770    }
    771
    

libs/aphrodite/sacred-dance/src/sacred-dance.ts#

  • L631

    ts
    629    let result = '';
    630    for (let i = 0; i < 16; i++) {
    631      result += chars[Math.floor(Math.random() * chars.length)];
    632    }
    633    return `${prefix}-${result}`;
    

libs/aphrodite/scene-fantasy/src/fairy-forest/fairy-forest.ts#

  • L1130

    ts
    1128      // Emit from slightly behind performer
    1129      const offset: FairyVec3 = {
    1130        x: (Math.random() - 0.5) * 0.3,
    1131        y: 0.5 + Math.random() * 1.0,
    1132        z: (Math.random() - 0.5) * 0.3,
    
  • L1131

    ts
    1129      const offset: FairyVec3 = {
    1130        x: (Math.random() - 0.5) * 0.3,
    1131        y: 0.5 + Math.random() * 1.0,
    1132        z: (Math.random() - 0.5) * 0.3,
    1133      };
    
  • L1132

    ts
    1130        x: (Math.random() - 0.5) * 0.3,
    1131        y: 0.5 + Math.random() * 1.0,
    1132        z: (Math.random() - 0.5) * 0.3,
    1133      };
    1134      const emitPos = fairyVec3Add(performerPos, offset);
    

libs/aphrodite/scene-fantasy/src/temple/temple.ts#

  • L409

    ts
    407   */
    408  export function spawnGoldenDust(config: GoldenDustConfig, center: TempleVec3): GoldenDustParticle {
    409    const seed = Date.now() * 0.001 + Math.random() * 1000;
    410
    411    // Spawn within a sphere around the center
    
  • L519

    ts
    517      spawned.push(spawnGoldenDust(config, center));
    518    }
    519    if (Math.random() < fractional) {
    520      spawned.push(spawnGoldenDust(config, center));
    521    }
    

libs/aphrodite/scene-goddess/src/ocean/ocean.ts#

  • L398

    ts
    396          if (updated.awareness > 0.6) {
    397            updated.targetPosition = {
    398              x: performerPos.x + (Math.random() - 0.5) * 100,
    399              y: -creature.depth,
    400              z: performerPos.z + (Math.random() - 0.5) * 100,
    
  • L400

    ts
    398              x: performerPos.x + (Math.random() - 0.5) * 100,
    399              y: -creature.depth,
    400              z: performerPos.z + (Math.random() - 0.5) * 100,
    401            };
    402          } else {
    
  • L406

    ts
    404            const angle =
    405              Math.atan2(creature.velocity.z, creature.velocity.x) +
    406              (Math.random() - 0.5) * Math.PI * 0.5;
    407            const dist = 50 + Math.random() * 200;
    408            updated.targetPosition = {
    
  • L407

    ts
    405              Math.atan2(creature.velocity.z, creature.velocity.x) +
    406              (Math.random() - 0.5) * Math.PI * 0.5;
    407            const dist = 50 + Math.random() * 200;
    408            updated.targetPosition = {
    409              x: creature.position.x + Math.cos(angle) * dist,
    
  • L459

    ts
    457          updated.depth =
    458            CREATURE_PRESETS[creature.type].depthRange.min +
    459            Math.random() *
    460              (CREATURE_PRESETS[creature.type].depthRange.max -
    461                CREATURE_PRESETS[creature.type].depthRange.min) *
    
  • L2089

    ts
    2087      };
    2088
    2089      const intensity = 0.8 + Math.random() * 0.2;
    2090
    2091      return { position, intensity: clamp(intensity, 0, 1) };
    

libs/aphrodite/scene-nature/src/performer-physics/physics-engine.ts#

  • L616

    ts
    614      // Rise upward (negative y in screen coords)
    615      const newPos: Vec2 = {
    616        x: particle.position.x + (Math.random() - 0.5) * spreadRate * dt * 0.5,
    617        y: particle.position.y - riseSpeed * dt,
    618      };
    

libs/aphrodite/scene-nature/src/storm/storm.ts#

  • L876

    ts
    874   */
    875  export function spawnRainDrop(config: RainConfig, areaSize: number, altitude: number): RainDrop {
    876    const seed = Date.now() * 0.001 + Math.random() * 1000;
    877
    878    // Random position within area
    
  • L980

    ts
    978
    979    // Probabilistic spawn for fractional part
    980    if (Math.random() < fractional) {
    981      spawned.push(spawnRainDrop(config, areaSize, 200 + config.intensity * 100));
    982    }
    

libs/aphrodite/scene-nature/src/underwater/underwater.ts#

  • L1125

    ts
    1123   */
    1124  export function emitBubble(emitter: BubbleEmitter): BubbleParticle {
    1125    const seed = Date.now() * 0.001 + Math.random() * 100;
    1126
    1127    // Random offset within emitter spread radius
    
  • L1231

    ts
    1229
    1230      // Probabilistic emission for fractional part
    1231      if (Math.random() < fractionalEmit) {
    1232        newBubbles.push(emitBubble(emitter));
    1233      }
    

libs/aphrodite/scene-nature/src/volcanic/volcanic.ts#

  • L953

    ts
    951   */
    952  export function spawnEmber(position: VolcanicVec3, config?: Partial<EmberParticle>): EmberParticle {
    953    const seed = Date.now() * 0.001 + Math.random() * 100;
    954
    955    // Random initial velocity: primarily upward with some lateral spread
    
  • L1876

    ts
    1874        }
    1875      }
    1876      if (Math.random() < fractionalSpawn && this.lavaPools.length > 0) {
    1877        const poolIdx = Math.floor(Math.random() * this.lavaPools.length);
    1878        this.embers.push(spawnEmber(this.lavaPools[poolIdx].position));
    
  • L1877

    ts
    1875      }
    1876      if (Math.random() < fractionalSpawn && this.lavaPools.length > 0) {
    1877        const poolIdx = Math.floor(Math.random() * this.lavaPools.length);
    1878        this.embers.push(spawnEmber(this.lavaPools[poolIdx].position));
    1879      }
    

libs/aphrodite/scene-nature/src/zen/zen.ts#

  • L327

    ts
    325      position: { ...origin },
    326      velocity: { x: 0, y: -0.25, z: 0 },
    327      rotation: Math.random() * Math.PI * 2,
    328      ...config,
    329    };
    

libs/aphrodite/sensation-bus/src/profiles.ts#

  • L124

    ts
    122    let id = '';
    123    for (let i = 0; i < 16; i++) {
    124      id += chars[Math.floor(Math.random() * chars.length)];
    125    }
    126    return id;
    

libs/aphrodite/sensation-bus/src/sensation-bus.ts#

  • L143

    ts
    141
    142  function generateId(): string {
    143    return `sb_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
    144  }
    145
    

libs/aphrodite/spatial-audio/src/hrtf.ts#

  • L411

    ts
    409    for (let i = 0; i < length; i++) {
    410      const decay = Math.exp(-i / (decaySamples * 0.2));
    411      const noise = (Math.random() - 0.5) * 0.01; // Add slight diffusion
    412
    413      if (azimuth >= 0 && azimuth <= 180) {
    
  • L1503

    ts
    1501
    1502      const profile: PersonalizedHRTFProfile = {
    1503        id: `hrtf-profile-${now}-${Math.random().toString(36).substring(2, 9)}`,
    1504        userId,
    1505        name,
    
  • L1737

    ts
    1735
    1736        // Generate new ID to avoid conflicts
    1737        profile.id = `hrtf-profile-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    1738        this.profiles.set(profile.id, profile);
    1739
    

libs/aphrodite/spatial-audio/src/index.ts#

  • L1100

    ts
    1098   */
    1099  function generateId(): string {
    1100    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    1101  }
    1102
    
  • L1389

    ts
    1387
    1388        // Random noise with density control
    1389        const noise = (Math.random() * 2 - 1) * config.density;
    1390        // Diffusion affects early vs late energy
    1391        const diffusionFactor = 1 - Math.exp(-t * config.diffusion * 10);
    

libs/aphrodite/spatial-audio/src/voice-zones.ts#

  • L700

    ts
    698
    699      const conversation: PrivateConversation = {
    700        id: `conv-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`,
    701        participantIds: allParticipants,
    702        anchorPosition,
    

libs/aphrodite/storage/src/utils.ts#

  • L141

    ts
    139    const name = sanitized.replace(`.${ext}`, '');
    140    const timestamp = Date.now().toString(36);
    141    const random = Math.random().toString(36).substring(2, 8);
    142
    143    const uniqueName = prefix ? `${prefix}_${timestamp}${random}` : `${name}_${timestamp}${random}`;
    

libs/aphrodite/stream-upscaling/src/index.ts#

  • L859

    ts
    857      // Simulate varying bandwidth between 2-15 Mbps
    858      const baseBps = 8_000_000; // 8 Mbps
    859      const variance = Math.random() * 7_000_000; // 0-7 Mbps variance
    860      return baseBps + variance;
    861    }
    
  • L888

    ts
    886        maxBps,
    887        stdDevBps,
    888        packetLossPercent: Math.random() * 2, // Simulated
    889        rttMs: 20 + Math.random() * 30, // Simulated 20-50ms
    890        jitterMs: Math.random() * 10, // Simulated
    
  • L889

    ts
    887        stdDevBps,
    888        packetLossPercent: Math.random() * 2, // Simulated
    889        rttMs: 20 + Math.random() * 30, // Simulated 20-50ms
    890        jitterMs: Math.random() * 10, // Simulated
    891        timestamp: Date.now(),
    
  • L890

    ts
    888        packetLossPercent: Math.random() * 2, // Simulated
    889        rttMs: 20 + Math.random() * 30, // Simulated 20-50ms
    890        jitterMs: Math.random() * 10, // Simulated
    891        timestamp: Date.now(),
    892      };
    
  • L2329

    ts
    2327     */
    2328    private generateSessionId(): string {
    2329      return `upscale-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
    2330    }
    2331
    

libs/aphrodite/stream-watermarking/src/viewer-watermark.ts#

  • L177

    ts
    175        active: true,
    176        config: sessionConfig,
    177        spatialSeed: Math.floor(Math.random() * 0xffffffff),
    178      };
    179
    

libs/aphrodite/symbol-engine/src/dream-logic.ts#

  • L19

    ts
    17
    18  function createRng(seed?: number): () => number {
    19    if (seed === undefined) return () => Math.random();
    20    let state = seed | 0;
    21    if (state === 0) state = 1;
    

libs/aphrodite/symbol-engine/src/tarot-overlay.ts#

  • L367

    ts
    365    for (let i = 0; i < count; i++) {
    366      const angle = (i / count) * Math.PI * 2;
    367      const edgeDist = 0.5 + Math.random() * 0.5;
    368      const px = cardPosition.x + Math.cos(angle) * halfW * edgeDist;
    369      const py = cardPosition.y + Math.sin(angle) * halfH * edgeDist;
    
  • L371

    ts
    369      const py = cardPosition.y + Math.sin(angle) * halfH * edgeDist;
    370
    371      const maxLifetime = 1 + Math.random() * 2;
    372      particles.push({
    373        position: { x: px, y: py },
    
  • L375

    ts
    373        position: { x: px, y: py },
    374        velocity: {
    375          x: Math.cos(angle) * speed * (0.5 + Math.random() * 0.5),
    376          y: Math.sin(angle) * speed * (0.5 + Math.random() * 0.5) - speed * 0.3,
    377        },
    
  • L376

    ts
    374        velocity: {
    375          x: Math.cos(angle) * speed * (0.5 + Math.random() * 0.5),
    376          y: Math.sin(angle) * speed * (0.5 + Math.random() * 0.5) - speed * 0.3,
    377        },
    378        size: 2 + Math.random() * 4,
    
  • L378

    ts
    376          y: Math.sin(angle) * speed * (0.5 + Math.random() * 0.5) - speed * 0.3,
    377        },
    378        size: 2 + Math.random() * 4,
    379        opacity: 0.8 + Math.random() * 0.2,
    380        color: rgba(
    
  • L379

    ts
    377        },
    378        size: 2 + Math.random() * 4,
    379        opacity: 0.8 + Math.random() * 0.2,
    380        color: rgba(
    381          0.85 + Math.random() * 0.15,
    
  • L381

    ts
    379        opacity: 0.8 + Math.random() * 0.2,
    380        color: rgba(
    381          0.85 + Math.random() * 0.15,
    382          0.7 + Math.random() * 0.2,
    383          0.2 + Math.random() * 0.3,
    
  • L382

    ts
    380        color: rgba(
    381          0.85 + Math.random() * 0.15,
    382          0.7 + Math.random() * 0.2,
    383          0.2 + Math.random() * 0.3,
    384          0.9
    
  • L383

    ts
    381          0.85 + Math.random() * 0.15,
    382          0.7 + Math.random() * 0.2,
    383          0.2 + Math.random() * 0.3,
    384          0.9
    385        ),
    
  • L579

    ts
    577      const shuffled = [...ALL_TAROT_CARD_IDS];
    578      for (let i = shuffled.length - 1; i > 0; i--) {
    579        const j = Math.floor(Math.random() * (i + 1));
    580        const tmp = shuffled[i];
    581        shuffled[i] = shuffled[j];
    
  • L638

    ts
    636
    637        const orientation =
    638          Math.random() < config.reversalProbability
    639            ? CardOrientation.REVERSED
    640            : CardOrientation.UPRIGHT;
    

libs/aphrodite/symbol-engine/src/tarot.ts#

  • L779

    ts
    777   * Seeded pseudo-random number generator (xorshift32).
    778   * Provides deterministic results when a seed is given,
    779   * or uses Math.random() as a fallback.
    780   */
    781  function createRng(seed?: number): () => number {
    
  • L783

    ts
    781  function createRng(seed?: number): () => number {
    782    if (seed === undefined) {
    783      return () => Math.random();
    784    }
    785
    

libs/aphrodite/talent/src/analytics/career-analytics.ts#

  • L216

    ts
    214    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    215    let r = '';
    216    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    217    return `${prefix}-${r}`;
    218  }
    

libs/aphrodite/talent/src/analytics/talent-analytics.ts#

  • L114

    ts
    112    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    113    let r = '';
    114    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    115    return `${prefix}-${r}`;
    116  }
    

libs/aphrodite/talent/src/availability/availability-tracker.ts#

  • L103

    ts
    101    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    102    let r = '';
    103    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    104    return `${prefix}-${r}`;
    105  }
    

libs/aphrodite/talent/src/calendar/availability-calendar.ts#

  • L175

    ts
    173    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    174    let r = '';
    175    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    176    return `${prefix}-${r}`;
    177  }
    

libs/aphrodite/talent/src/casting/casting-engine.ts#

  • L138

    ts
    136    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    137    let result = '';
    138    for (let i = 0; i < 16; i++) result += chars[Math.floor(Math.random() * chars.length)];
    139    return `${prefix}-${result}`;
    140  }
    

libs/aphrodite/talent/src/communication/performer-comms.ts#

  • L156

    ts
    154    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    155    let r = '';
    156    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    157    return `${prefix}-${r}`;
    158  }
    

libs/aphrodite/talent/src/community/performer-community.ts#

  • L163

    ts
    161    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    162    let r = '';
    163    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    164    return `${prefix}-${r}`;
    165  }
    

libs/aphrodite/talent/src/consent/talent-consent.ts#

  • L192

    ts
    190    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    191    let r = '';
    192    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    193    return `${prefix}-${r}`;
    194  }
    

libs/aphrodite/talent/src/contracts/contract-manager.ts#

  • L108

    ts
    106    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    107    let r = '';
    108    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    109    return `${prefix}-${r}`;
    110  }
    

libs/aphrodite/talent/src/cultural/exchange-program.ts#

  • L204

    ts
    202    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    203    let r = '';
    204    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    205    return `${prefix}-${r}`;
    206  }
    

libs/aphrodite/talent/src/development/career-development.ts#

  • L194

    ts
    192    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    193    let r = '';
    194    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    195    return `${prefix}-${r}`;
    196  }
    

libs/aphrodite/talent/src/development/talent-development.ts#

  • L115

    ts
    113    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    114    let r = '';
    115    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    116    return `${prefix}-${r}`;
    117  }
    

libs/aphrodite/talent/src/emergency/crisis-support.ts#

  • L246

    ts
    244    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    245    let r = '';
    246    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    247    return `${prefix}-${r}`;
    248  }
    

libs/aphrodite/talent/src/logistics/travel-management.ts#

  • L255

    ts
    253    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    254    let r = '';
    255    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    256    return `${prefix}-${r}`;
    257  }
    

libs/aphrodite/talent/src/onboarding/performer-onboarding.ts#

  • L190

    ts
    188    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    189    let r = '';
    190    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    191    return `${prefix}-${r}`;
    192  }
    

libs/aphrodite/talent/src/payment/performer-payment.ts#

  • L221

    ts
    219    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    220    let r = '';
    221    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    222    return `${prefix}-${r}`;
    223  }
    

libs/aphrodite/talent/src/portfolio/performer-portfolio.ts#

  • L106

    ts
    104    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    105    let r = '';
    106    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    107    return `${prefix}-${r}`;
    108  }
    

libs/aphrodite/talent/src/reputation/performer-reputation.ts#

  • L185

    ts
    183    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    184    let r = '';
    185    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    186    return `${prefix}-${r}`;
    187  }
    

libs/aphrodite/talent/src/reputation/trust-system.ts#

  • L231

    ts
    229    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    230    let r = '';
    231    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    232    return `${prefix}-${r}`;
    233  }
    

libs/aphrodite/talent/src/retention/performer-retention.ts#

  • L188

    ts
    186    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    187    let r = '';
    188    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    189    return `${prefix}-${r}`;
    190  }
    

libs/aphrodite/talent/src/scheduling/conflict-resolution.ts#

  • L156

    ts
    154    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    155    let r = '';
    156    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    157    return `${prefix}-${r}`;
    158  }
    

libs/aphrodite/talent/src/strategy/content-strategy.ts#

  • L210

    ts
    208    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    209    let r = '';
    210    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    211    return `${prefix}-${r}`;
    212  }
    

libs/aphrodite/talent/src/talent.ts#

  • L210

    ts
    208    let result = '';
    209    for (let i = 0; i < 16; i++) {
    210      result += chars[Math.floor(Math.random() * chars.length)];
    211    }
    212    return `${prefix}-${result}`;
    

libs/aphrodite/talent/src/training/talent-training.ts#

  • L195

    ts
    193    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    194    let r = '';
    195    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    196    return `${prefix}-${r}`;
    197  }
    

libs/aphrodite/talent/src/wellness/burnout-prevention.ts#

  • L251

    ts
    249    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    250    let r = '';
    251    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    252    return `${prefix}-${r}`;
    253  }
    

libs/aphrodite/talent/src/wellness/performer-wellness.ts#

  • L172

    ts
    170    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    171    let r = '';
    172    for (let i = 0; i < 16; i++) r += chars[Math.floor(Math.random() * chars.length)];
    173    return `${prefix}-${r}`;
    174  }
    

libs/aphrodite/technical-direction/src/ai-camera/ai-camera-direction.ts#

  • L195

    ts
    193    let result = '';
    194    for (let i = 0; i < 16; i++) {
    195      result += chars[Math.floor(Math.random() * chars.length)];
    196    }
    197    return `${prefix}-${result}`;
    
  • L443

    ts
    441      const now = timestamp ?? Date.now();
    442      if (now - this.lastCutMs < this.config.minCutIntervalMs) return null;
    443      const latencyMs = Math.round(Math.random() * this.config.maxDecisionLatencyMs);
    444      const cut: CutDecision = {
    445        cutId: generateAICameraId('cut'),
    

libs/aphrodite/technical-direction/src/ai/camera-ai-director.ts#

  • L239

    ts
    237    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    238    let id = '';
    239    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    240    return `sc-${id}`;
    241  }
    
  • L246

    ts
    244    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    245    let id = '';
    246    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    247    return `sh-${id}`;
    248  }
    
  • L253

    ts
    251    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    252    let id = '';
    253    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    254    return `seq-${id}`;
    255  }
    
  • L467

    ts
    465        const size = scored[0]?.size ?? ShotSize.MEDIUM;
    466
    467        const variation = (Math.random() - 0.5) * avgDuration * 0.3;
    468        const dur = Math.max(
    469          this.config.minShotDurationMs,
    

libs/aphrodite/technical-direction/src/audio/audio-routing.ts#

  • L181

    ts
    179    let result = '';
    180    for (let i = 0; i < 16; i++) {
    181      result += chars[Math.floor(Math.random() * chars.length)];
    182    }
    183    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/camera/calibration.ts#

  • L127

    ts
    125    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    126    let id = '';
    127    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    128    return `lp-${id}`;
    129  }
    

libs/aphrodite/technical-direction/src/camera/camera-calibration.ts#

  • L169

    ts
    167    let result = '';
    168    for (let i = 0; i < 16; i++) {
    169      result += chars[Math.floor(Math.random() * chars.length)];
    170    }
    171    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/camera/camera-plan.ts#

  • L160

    ts
    158    let result = '';
    159    for (let i = 0; i < 16; i++) {
    160      result += chars[Math.floor(Math.random() * chars.length)];
    161    }
    162    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/camera/immersive-capture.ts#

  • L148

    ts
    146    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    147    let id = '';
    148    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    149    return `pnl-${id}`;
    150  }
    
  • L155

    ts
    153    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    154    let id = '';
    155    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    156    return `imf-${id}`;
    157  }
    

libs/aphrodite/technical-direction/src/camera/motion-control.ts#

  • L125

    ts
    123    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    124    let id = '';
    125    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    126    return `mp-${id}`;
    127  }
    
  • L132

    ts
    130    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    131    let id = '';
    132    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    133    return `kf-${id}`;
    134  }
    

libs/aphrodite/technical-direction/src/camera/switching-plan.ts#

  • L123

    ts
    121    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    122    let id = '';
    123    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    124    return `cut-${id}`;
    125  }
    

libs/aphrodite/technical-direction/src/camera/thermal-capture.ts#

  • L124

    ts
    122    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    123    let id = '';
    124    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    125    return `tf-${id}`;
    126  }
    

libs/aphrodite/technical-direction/src/contingency/contingency-system.ts#

  • L163

    ts
    161    let result = '';
    162    for (let i = 0; i < 16; i++) {
    163      result += chars[Math.floor(Math.random() * chars.length)];
    164    }
    165    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/contingency/failover.ts#

  • L115

    ts
    113    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    114    let id = '';
    115    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    116    return `fp-${id}`;
    117  }
    
  • L122

    ts
    120    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    121    let id = '';
    122    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    123    return `fh-${id}`;
    124  }
    

libs/aphrodite/technical-direction/src/documentation/tech-docs.ts#

  • L210

    ts
    208    let result = '';
    209    for (let i = 0; i < 16; i++) {
    210      result += chars[Math.floor(Math.random() * chars.length)];
    211    }
    212    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/drone/flight-designer.ts#

  • L119

    ts
    117    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    118    let id = '';
    119    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    120    return `wp-${id}`;
    121  }
    

libs/aphrodite/technical-direction/src/drone/flight-path.ts#

  • L179

    ts
    177    let result = '';
    178    for (let i = 0; i < 16; i++) {
    179      result += chars[Math.floor(Math.random() * chars.length)];
    180    }
    181    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/equipment-monitoring/equipment-monitor.ts#

  • L165

    ts
    163    let result = '';
    164    for (let i = 0; i < 16; i++) {
    165      result += chars[Math.floor(Math.random() * chars.length)];
    166    }
    167    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/immersive/immersive-capture.ts#

  • L160

    ts
    158    let result = '';
    159    for (let i = 0; i < 16; i++) {
    160      result += chars[Math.floor(Math.random() * chars.length)];
    161    }
    162    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/lighting/dmx-control.ts#

  • L194

    ts
    192    let result = '';
    193    for (let i = 0; i < 16; i++) {
    194      result += chars[Math.floor(Math.random() * chars.length)];
    195    }
    196    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/logistics/tech-inventory.ts#

  • L136

    ts
    134    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    135    let id = '';
    136    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    137    return `eq-${id}`;
    138  }
    
  • L143

    ts
    141    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    142    let id = '';
    143    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    144    return `cr-${id}`;
    145  }
    

libs/aphrodite/technical-direction/src/logistics/tech-logistics.ts#

  • L165

    ts
    163    let result = '';
    164    for (let i = 0; i < 16; i++) {
    165      result += chars[Math.floor(Math.random() * chars.length)];
    166    }
    167    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/monitoring/stream-quality.ts#

  • L165

    ts
    163    let result = '';
    164    for (let i = 0; i < 16; i++) {
    165      result += chars[Math.floor(Math.random() * chars.length)];
    166    }
    167    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/motion-control/camera-motion.ts#

  • L172

    ts
    170    let result = '';
    171    for (let i = 0; i < 16; i++) {
    172      result += chars[Math.floor(Math.random() * chars.length)];
    173    }
    174    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/quality/stream-monitor.ts#

  • L122

    ts
    120    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    121    let id = '';
    122    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    123    return `ss-${id}`;
    124  }
    

libs/aphrodite/technical-direction/src/recording/multi-camera-recording.ts#

  • L170

    ts
    168    let result = '';
    169    for (let i = 0; i < 16; i++) {
    170      result += chars[Math.floor(Math.random() * chars.length)];
    171    }
    172    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/rehearsal-automation/tech-rehearsal.ts#

  • L181

    ts
    179    let result = '';
    180    for (let i = 0; i < 16; i++) {
    181      result += chars[Math.floor(Math.random() * chars.length)];
    182    }
    183    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/rehearsal/tech-rehearsal.ts#

  • L146

    ts
    144    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    145    let id = '';
    146    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    147    return `rs-${id}`;
    148  }
    
  • L153

    ts
    151    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    152    let id = '';
    153    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    154    return `ri-${id}`;
    155  }
    
  • L160

    ts
    158    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    159    let id = '';
    160    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    161    return `run-${id}`;
    162  }
    

libs/aphrodite/technical-direction/src/remote/remote-control.ts#

  • L178

    ts
    176    let result = '';
    177    for (let i = 0; i < 16; i++) {
    178      result += chars[Math.floor(Math.random() * chars.length)];
    179    }
    180    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/technical-direction.ts#

  • L235

    ts
    233    let result = '';
    234    for (let i = 0; i < 16; i++) {
    235      result += chars[Math.floor(Math.random() * chars.length)];
    236    }
    237    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/thermal/thermal-capture.ts#

  • L158

    ts
    156    let result = '';
    157    for (let i = 0; i < 16; i++) {
    158      result += chars[Math.floor(Math.random() * chars.length)];
    159    }
    160    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/training-sim/td-training.ts#

  • L203

    ts
    201    let result = '';
    202    for (let i = 0; i < 16; i++) {
    203      result += chars[Math.floor(Math.random() * chars.length)];
    204    }
    205    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/underwater/underwater-capture.ts#

  • L147

    ts
    145    let result = '';
    146    for (let i = 0; i < 16; i++) {
    147      result += chars[Math.floor(Math.random() * chars.length)];
    148    }
    149    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/video-switching/video-switcher.ts#

  • L182

    ts
    180    let result = '';
    181    for (let i = 0; i < 16; i++) {
    182      result += chars[Math.floor(Math.random() * chars.length)];
    183    }
    184    return `${prefix}-${result}`;
    

libs/aphrodite/technical-direction/src/video/switching-effects.ts#

  • L132

    ts
    130    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    131    let id = '';
    132    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    133    return `tr-${id}`;
    134  }
    
  • L139

    ts
    137    const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    138    let id = '';
    139    for (let i = 0; i < 12; i++) id += chars[Math.floor(Math.random() * chars.length)];
    140    return `ep-${id}`;
    141  }
    

libs/aphrodite/testing/src/fixtures/index.ts#

  • L29

    ts
    27    let result = '';
    28    for (let i = 0; i < length; i++) {
    29      result += chars.charAt(Math.floor(Math.random() * chars.length));
    30    }
    31    return result;
    
  • L52

    ts
    50   */
    51  export function randomInt(min: number, max: number): number {
    52    return Math.floor(Math.random() * (max - min + 1)) + min;
    53  }
    54
    
  • L59

    ts
    57   */
    58  export function randomPick<T>(array: T[]): T {
    59    return array[Math.floor(Math.random() * array.length)];
    60  }
    61
    
  • L66

    ts
    64   */
    65  export function randomDate(start: Date = new Date(2024, 0, 1), end: Date = new Date()): Date {
    66    return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
    67  }
    68
    

libs/aphrodite/thumbnail-generation/src/frame-analyzer.ts#

  • L105

    ts
    103      // In production, calculate actual luminance
    104      // Return mid-range brightness as default
    105      return 0.5 + (Math.random() * 0.3 - 0.15);
    106    }
    107
    
  • L113

    ts
    111    private async calculateContrast(_frame: VideoFrame): Promise<number> {
    112      // In production, calculate actual contrast
    113      return 0.6 + (Math.random() * 0.3 - 0.15);
    114    }
    115
    
  • L121

    ts
    119    private async calculateSaturation(_frame: VideoFrame): Promise<number> {
    120      // In production, calculate actual saturation from HSV
    121      return 0.5 + (Math.random() * 0.4 - 0.2);
    122    }
    123
    
  • L130

    ts
    128      // In production, use gradient analysis or frequency domain methods
    129      // Lower is better (less blur)
    130      return 0.1 + Math.random() * 0.2;
    131    }
    132
    
  • L139

    ts
    137      // In production, analyze high-frequency components
    138      // Lower is better (less noise)
    139      return 0.1 + Math.random() * 0.15;
    140    }
    141
    
  • L565

    ts
    563
    564      // Simulate face detection based on frame characteristics
    565      const numFaces = Math.floor(Math.random() * 3) + 1;
    566
    567      for (let i = 0; i < numFaces; i++) {
    
  • L568

    ts
    566
    567      for (let i = 0; i < numFaces; i++) {
    568        const faceWidth = frame.width * (0.1 + Math.random() * 0.15);
    569        const faceHeight = faceWidth * 1.3;
    570        const faceX = (frame.width - faceWidth) * (0.2 + Math.random() * 0.6);
    
  • L570

    ts
    568        const faceWidth = frame.width * (0.1 + Math.random() * 0.15);
    569        const faceHeight = faceWidth * 1.3;
    570        const faceX = (frame.width - faceWidth) * (0.2 + Math.random() * 0.6);
    571        const faceY = frame.height * (0.1 + Math.random() * 0.3);
    572
    
  • L571

    ts
    569        const faceHeight = faceWidth * 1.3;
    570        const faceX = (frame.width - faceWidth) * (0.2 + Math.random() * 0.6);
    571        const faceY = frame.height * (0.1 + Math.random() * 0.3);
    572
    573        const landmarks: FaceLandmarks = this.config.detectLandmarks
    
  • L583

    ts
    581        faces.push({
    582          id: `face-${frame.id}-${i}`,
    583          confidence: 0.8 + Math.random() * 0.2,
    584          boundingBox: {
    585            x: faceX,
    
  • L623

    ts
    621    private generateAttributes(): FaceAttributes {
    622      const emotions: FaceEmotion[] = ['happy', 'neutral', 'surprised', 'sad'];
    623      const emotion = emotions[Math.floor(Math.random() * emotions.length)];
    624
    625      return {
    
  • L627

    ts
    625      return {
    626        ageRange: {
    627          min: 20 + Math.floor(Math.random() * 10),
    628          max: 35 + Math.floor(Math.random() * 10),
    629        },
    
  • L628

    ts
    626        ageRange: {
    627          min: 20 + Math.floor(Math.random() * 10),
    628          max: 35 + Math.floor(Math.random() * 10),
    629        },
    630        emotion,
    
  • L631

    ts
    629        },
    630        emotion,
    631        emotionConfidence: 0.7 + Math.random() * 0.3,
    632        pose: {
    633          pitch: (Math.random() - 0.5) * 30,
    
  • L633

    ts
    631        emotionConfidence: 0.7 + Math.random() * 0.3,
    632        pose: {
    633          pitch: (Math.random() - 0.5) * 30,
    634          yaw: (Math.random() - 0.5) * 40,
    635          roll: (Math.random() - 0.5) * 20,
    
  • L634

    ts
    632        pose: {
    633          pitch: (Math.random() - 0.5) * 30,
    634          yaw: (Math.random() - 0.5) * 40,
    635          roll: (Math.random() - 0.5) * 20,
    636        },
    
  • L635

    ts
    633          pitch: (Math.random() - 0.5) * 30,
    634          yaw: (Math.random() - 0.5) * 40,
    635          roll: (Math.random() - 0.5) * 20,
    636        },
    637        eyesOpen: 0.7 + Math.random() * 0.3,
    
  • L637

    ts
    635          roll: (Math.random() - 0.5) * 20,
    636        },
    637        eyesOpen: 0.7 + Math.random() * 0.3,
    638        mouthOpen: Math.random() * 0.4,
    639        smile: emotion === 'happy' ? 0.7 + Math.random() * 0.3 : Math.random() * 0.3,
    
  • L638

    ts
    636        },
    637        eyesOpen: 0.7 + Math.random() * 0.3,
    638        mouthOpen: Math.random() * 0.4,
    639        smile: emotion === 'happy' ? 0.7 + Math.random() * 0.3 : Math.random() * 0.3,
    640        glasses: Math.random() > 0.7,
    
  • L639

    ts
    637        eyesOpen: 0.7 + Math.random() * 0.3,
    638        mouthOpen: Math.random() * 0.4,
    639        smile: emotion === 'happy' ? 0.7 + Math.random() * 0.3 : Math.random() * 0.3,
    640        glasses: Math.random() > 0.7,
    641        sunglasses: Math.random() > 0.95,
    
  • L640

    ts
    638        mouthOpen: Math.random() * 0.4,
    639        smile: emotion === 'happy' ? 0.7 + Math.random() * 0.3 : Math.random() * 0.3,
    640        glasses: Math.random() > 0.7,
    641        sunglasses: Math.random() > 0.95,
    642        occlusion: {
    
  • L641

    ts
    639        smile: emotion === 'happy' ? 0.7 + Math.random() * 0.3 : Math.random() * 0.3,
    640        glasses: Math.random() > 0.7,
    641        sunglasses: Math.random() > 0.95,
    642        occlusion: {
    643          forehead: Math.random() * 0.2,
    
  • L643

    ts
    641        sunglasses: Math.random() > 0.95,
    642        occlusion: {
    643          forehead: Math.random() * 0.2,
    644          eyes: Math.random() * 0.1,
    645          mouth: Math.random() * 0.15,
    
  • L644

    ts
    642        occlusion: {
    643          forehead: Math.random() * 0.2,
    644          eyes: Math.random() * 0.1,
    645          mouth: Math.random() * 0.15,
    646        },
    
  • L645

    ts
    643          forehead: Math.random() * 0.2,
    644          eyes: Math.random() * 0.1,
    645          mouth: Math.random() * 0.15,
    646        },
    647      };
    
  • L986

    ts
    984        'concert',
    985      ];
    986      const primaryScene = scenes[Math.floor(Math.random() * scenes.length)];
    987
    988      const environments: Array<'indoor' | 'outdoor' | 'mixed' | 'virtual'> = [
    
  • L996

    ts
    994
    995      const sceneScores: Record<string, number> = {};
    996      sceneScores[primaryScene] = 0.8 + Math.random() * 0.2;
    997
    998      // Add some secondary scenes
    
  • L999

    ts
    997
    998      // Add some secondary scenes
    999      const numSecondary = Math.floor(Math.random() * 3);
    1000      const secondaryScenes: string[] = [];
    1001      for (let i = 0; i < numSecondary; i++) {
    
  • L1002

    ts
    1000      const secondaryScenes: string[] = [];
    1001      for (let i = 0; i < numSecondary; i++) {
    1002        const scene = scenes[Math.floor(Math.random() * scenes.length)];
    1003        if (scene !== primaryScene && !secondaryScenes.includes(scene)) {
    1004          secondaryScenes.push(scene);
    
  • L1005

    ts
    1003        if (scene !== primaryScene && !secondaryScenes.includes(scene)) {
    1004          secondaryScenes.push(scene);
    1005          sceneScores[scene] = 0.3 + Math.random() * 0.4;
    1006        }
    1007      }
    
  • L1013

    ts
    1011        secondaryScenes,
    1012        sceneScores,
    1013        environment: environments[Math.floor(Math.random() * environments.length)],
    1014        detectedGame:
    1015          primaryScene === 'gaming'
    
  • L1018

    ts
    1016            ? {
    1017                name: ['Valorant', 'League of Legends', 'Minecraft', 'Fortnite'][
    1018                  Math.floor(Math.random() * 4)
    1019                ],
    1020                confidence: 0.7 + Math.random() * 0.3,
    
  • L1020

    ts
    1018                  Math.floor(Math.random() * 4)
    1019                ],
    1020                confidence: 0.7 + Math.random() * 0.3,
    1021              }
    1022            : undefined,
    
  • L1056

    ts
    1054      ];
    1055
    1056      const numObjects = 2 + Math.floor(Math.random() * 4);
    1057      const objects: DetectedObject[] = [];
    1058
    
  • L1060

    ts
    1058
    1059      for (let i = 0; i < numObjects; i++) {
    1060        const type = objectTypes[Math.floor(Math.random() * objectTypes.length)];
    1061        const width = frame.width * (0.1 + Math.random() * 0.3);
    1062        const height = frame.height * (0.1 + Math.random() * 0.3);
    
  • L1061

    ts
    1059      for (let i = 0; i < numObjects; i++) {
    1060        const type = objectTypes[Math.floor(Math.random() * objectTypes.length)];
    1061        const width = frame.width * (0.1 + Math.random() * 0.3);
    1062        const height = frame.height * (0.1 + Math.random() * 0.3);
    1063        const x = Math.random() * (frame.width - width);
    
  • L1062

    ts
    1060        const type = objectTypes[Math.floor(Math.random() * objectTypes.length)];
    1061        const width = frame.width * (0.1 + Math.random() * 0.3);
    1062        const height = frame.height * (0.1 + Math.random() * 0.3);
    1063        const x = Math.random() * (frame.width - width);
    1064        const y = Math.random() * (frame.height - height);
    
  • L1063

    ts
    1061        const width = frame.width * (0.1 + Math.random() * 0.3);
    1062        const height = frame.height * (0.1 + Math.random() * 0.3);
    1063        const x = Math.random() * (frame.width - width);
    1064        const y = Math.random() * (frame.height - height);
    1065
    
  • L1064

    ts
    1062        const height = frame.height * (0.1 + Math.random() * 0.3);
    1063        const x = Math.random() * (frame.width - width);
    1064        const y = Math.random() * (frame.height - height);
    1065
    1066        objects.push({
    
  • L1068

    ts
    1066        objects.push({
    1067          type,
    1068          confidence: 0.6 + Math.random() * 0.4,
    1069          boundingBox: { x, y, width, height },
    1070          isKeyObject: type === 'person' || Math.random() > 0.7,
    
  • L1070

    ts
    1068          confidence: 0.6 + Math.random() * 0.4,
    1069          boundingBox: { x, y, width, height },
    1070          isKeyObject: type === 'person' || Math.random() > 0.7,
    1071          importance: type === 'person' ? 0.9 : 0.3 + Math.random() * 0.4,
    1072        });
    
  • L1071

    ts
    1069          boundingBox: { x, y, width, height },
    1070          isKeyObject: type === 'person' || Math.random() > 0.7,
    1071          importance: type === 'person' ? 0.9 : 0.3 + Math.random() * 0.4,
    1072        });
    1073      }
    
  • L1096

    ts
    1094      // In production, call actual AI API
    1095      const textItems: DetectedText[] = [];
    1096      const numText = Math.floor(Math.random() * 3);
    1097
    1098      const textTypes: DetectedText['textType'][] = [
    
  • L1108

    ts
    1106
    1107      for (let i = 0; i < numText; i++) {
    1108        const textType = textTypes[Math.floor(Math.random() * textTypes.length)];
    1109        const width = frame.width * (0.1 + Math.random() * 0.2);
    1110        const height = 20 + Math.random() * 30;
    
  • L1109

    ts
    1107      for (let i = 0; i < numText; i++) {
    1108        const textType = textTypes[Math.floor(Math.random() * textTypes.length)];
    1109        const width = frame.width * (0.1 + Math.random() * 0.2);
    1110        const height = 20 + Math.random() * 30;
    1111        const x = Math.random() * (frame.width - width);
    
  • L1110

    ts
    1108        const textType = textTypes[Math.floor(Math.random() * textTypes.length)];
    1109        const width = frame.width * (0.1 + Math.random() * 0.2);
    1110        const height = 20 + Math.random() * 30;
    1111        const x = Math.random() * (frame.width - width);
    1112        const y = Math.random() * (frame.height - height);
    
  • L1111

    ts
    1109        const width = frame.width * (0.1 + Math.random() * 0.2);
    1110        const height = 20 + Math.random() * 30;
    1111        const x = Math.random() * (frame.width - width);
    1112        const y = Math.random() * (frame.height - height);
    1113
    
  • L1112

    ts
    1110        const height = 20 + Math.random() * 30;
    1111        const x = Math.random() * (frame.width - width);
    1112        const y = Math.random() * (frame.height - height);
    1113
    1114        textItems.push({
    
  • L1116

    ts
    1114        textItems.push({
    1115          text: ['Stream Title', 'Player Name', '1000 pts', 'Subscribe!'][
    1116            Math.floor(Math.random() * 4)
    1117          ],
    1118          confidence: 0.7 + Math.random() * 0.3,
    
  • L1118

    ts
    1116            Math.floor(Math.random() * 4)
    1117          ],
    1118          confidence: 0.7 + Math.random() * 0.3,
    1119          boundingBox: { x, y, width, height },
    1120          isImportant: textType === 'game_ui' || textType === 'overlay',
    
  • L1146

    ts
    1144      // In production, call actual AI API (often requires temporal context)
    1145      const actions: ActionDetection[] = [];
    1146      const hasAction = Math.random() > 0.7;
    1147
    1148      if (hasAction) {
    
  • L1160

    ts
    1158
    1159        actions.push({
    1160          actionType: actionTypes[Math.floor(Math.random() * actionTypes.length)],
    1161          confidence: 0.6 + Math.random() * 0.4,
    1162          intensity: 0.4 + Math.random() * 0.6,
    
  • L1161

    ts
    1159        actions.push({
    1160          actionType: actionTypes[Math.floor(Math.random() * actionTypes.length)],
    1161          confidence: 0.6 + Math.random() * 0.4,
    1162          intensity: 0.4 + Math.random() * 0.6,
    1163          region: {
    
  • L1162

    ts
    1160          actionType: actionTypes[Math.floor(Math.random() * actionTypes.length)],
    1161          confidence: 0.6 + Math.random() * 0.4,
    1162          intensity: 0.4 + Math.random() * 0.6,
    1163          region: {
    1164            x: frame.width * 0.2,
    
  • L1169

    ts
    1167            height: frame.height * 0.6,
    1168          },
    1169          isHighlight: Math.random() > 0.5,
    1170        });
    1171      }
    

libs/aphrodite/tip-acknowledgment/src/thank-you-messages.ts#

  • L580

    ts
    578      broadcasterName,
    579      timeGreeting: getTimeGreeting(),
    580      compliment: COMPLIMENTS[Math.floor(Math.random() * COMPLIMENTS.length)],
    581      emoji: emojis[Math.floor(Math.random() * emojis.length)],
    582      vipTier: tip.tipperStats.badges.includes('tip_king') ? 'Diamond' : undefined,
    
  • L581

    ts
    579      timeGreeting: getTimeGreeting(),
    580      compliment: COMPLIMENTS[Math.floor(Math.random() * COMPLIMENTS.length)],
    581      emoji: emojis[Math.floor(Math.random() * emojis.length)],
    582      vipTier: tip.tipperStats.badges.includes('tip_king') ? 'Diamond' : undefined,
    583      daysSinceLastTip: tip.tipperStats.daysSinceLastTip,
    
  • L822

    ts
    820
    821      // Random selection
    822      let random = Math.random() * totalWeight;
    823      for (const { template, weight } of weightedTemplates) {
    824        random -= weight;
    
  • L847

    ts
    845          return true;
    846        case 'rare':
    847          return Math.random() < 0.1;
    848        case 'sometimes':
    849          return Math.random() < 0.3;
    
  • L849

    ts
    847          return Math.random() < 0.1;
    848        case 'sometimes':
    849          return Math.random() < 0.3;
    850        case 'often':
    851          return Math.random() < 0.6;
    
  • L851

    ts
    849          return Math.random() < 0.3;
    850        case 'often':
    851          return Math.random() < 0.6;
    852        default:
    853          return false;
    

libs/aphrodite/tip-effects/src/index.ts#

  • L52

    ts
    50   */
    51  function generateId(): string {
    52    return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
    53  }
    54
    
  • L154

    ts
    152   */
    153  function randomRange(min: number, max: number): number {
    154    return min + Math.random() * (max - min);
    155  }
    156
    
  • L161

    ts
    159   */
    160  function randomItem<T>(items: T[]): T {
    161    return items[Math.floor(Math.random() * items.length)];
    162  }
    163
    
  • L346

    ts
    344        velocity,
    345        size: randomRange(particle.minSize, particle.maxSize),
    346        rotation: Math.random() * Math.PI * 2,
    347        rotationSpeed: particle.rotation ? particle.rotationSpeed * (Math.random() - 0.5) * 2 : 0,
    348        color: { ...color },
    
  • L347

    ts
    345        size: randomRange(particle.minSize, particle.maxSize),
    346        rotation: Math.random() * Math.PI * 2,
    347        rotationSpeed: particle.rotation ? particle.rotationSpeed * (Math.random() - 0.5) * 2 : 0,
    348        color: { ...color },
    349        opacity: particle.opacity,
    
  • L392

    ts
    390        // Apply turbulence
    391        if (physics.turbulence > 0) {
    392          p.velocity.x += (Math.random() - 0.5) * physics.turbulence * deltaTime;
    393          p.velocity.y += (Math.random() - 0.5) * physics.turbulence * deltaTime;
    394          p.velocity.z += (Math.random() - 0.5) * physics.turbulence * deltaTime;
    
  • L393

    ts
    391        if (physics.turbulence > 0) {
    392          p.velocity.x += (Math.random() - 0.5) * physics.turbulence * deltaTime;
    393          p.velocity.y += (Math.random() - 0.5) * physics.turbulence * deltaTime;
    394          p.velocity.z += (Math.random() - 0.5) * physics.turbulence * deltaTime;
    395        }
    
  • L394

    ts
    392          p.velocity.x += (Math.random() - 0.5) * physics.turbulence * deltaTime;
    393          p.velocity.y += (Math.random() - 0.5) * physics.turbulence * deltaTime;
    394          p.velocity.z += (Math.random() - 0.5) * physics.turbulence * deltaTime;
    395        }
    396
    
  • L544

    ts
    542        const finaleProgress =
    543          (this.elapsed - this.config.duration * 0.8) / (this.config.duration * 0.2);
    544        if (Math.random() < finaleProgress * this.config.finaleIntensity * deltaTime * 5) {
    545          this.launchRandomShell();
    546        }
    
  • L597

    ts
    595        trailLength: 5,
    596        fadeTime: randomRange(1, 2),
    597        crackleEffect: Math.random() > 0.7,
    598        flashEffect: Math.random() > 0.5,
    599        soundType: randomItem(['bang', 'boom', 'crackle']),
    
  • L598

    ts
    596        fadeTime: randomRange(1, 2),
    597        crackleEffect: Math.random() > 0.7,
    598        flashEffect: Math.random() > 0.5,
    599        soundType: randomItem(['bang', 'boom', 'crackle']),
    600      };
    
  • L711

    ts
    709          }
    710          case 'willow': {
    711            const willowAngle = Math.random() * Math.PI * 2;
    712            const willowElevation = Math.random() * Math.PI * 0.4 + 0.1;
    713            velocity = {
    
  • L712

    ts
    710          case 'willow': {
    711            const willowAngle = Math.random() * Math.PI * 2;
    712            const willowElevation = Math.random() * Math.PI * 0.4 + 0.1;
    713            velocity = {
    714              x: Math.sin(willowElevation) * Math.cos(willowAngle) * config.burstRadius * 4,
    
  • L723

    ts
    721          case 'peony':
    722          default: {
    723            const phi = Math.random() * Math.PI * 2;
    724            const theta = Math.acos(2 * Math.random() - 1);
    725            const speed = config.burstRadius * (3 + Math.random() * 2);
    
  • L724

    ts
    722          default: {
    723            const phi = Math.random() * Math.PI * 2;
    724            const theta = Math.acos(2 * Math.random() - 1);
    725            const speed = config.burstRadius * (3 + Math.random() * 2);
    726            velocity = {
    
  • L725

    ts
    723            const phi = Math.random() * Math.PI * 2;
    724            const theta = Math.acos(2 * Math.random() - 1);
    725            const speed = config.burstRadius * (3 + Math.random() * 2);
    726            velocity = {
    727              x: Math.sin(theta) * Math.cos(phi) * speed,
    
  • L746

    ts
    744          opacity: 1,
    745          lifetime: 0,
    746          maxLifetime: Math.max(0.1, config.fadeTime) + 2 + Math.random() * 0.5,
    747          shape: 'spark',
    748          trail: config.trailLength > 0 ? [{ ...shell.position }] : [],
    
  • L806

    ts
    804
    805        // Crackle effect
    806        if (shell.config.crackleEffect && Math.random() < 0.01) {
    807          p.opacity = 1;
    808          p.color = { r: 1, g: 1, b: 1, a: 1 };
    
  • L2018

    ts
    2016            trailLength: 5,
    2017            fadeTime: randomRange(1, 2),
    2018            crackleEffect: Math.random() > 0.6,
    2019            flashEffect: Math.random() > 0.5,
    2020            soundType: randomItem(['bang', 'boom', 'crackle']),
    
  • L2019

    ts
    2017            fadeTime: randomRange(1, 2),
    2018            crackleEffect: Math.random() > 0.6,
    2019            flashEffect: Math.random() > 0.5,
    2020            soundType: randomItem(['bang', 'boom', 'crackle']),
    2021          },
    
  • L2022

    ts
    2020            soundType: randomItem(['bang', 'boom', 'crackle']),
    2021          },
    2022          launchTime: i * 0.5 + Math.random() * 0.3,
    2023          launchPosition: launchPos,
    2024          targetPosition: targetPos,
    

libs/aphrodite/tip-goals/src/index.ts#

  • L44

    ts
    42   */
    43  function generateId(): string {
    44    return `goal_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    45  }
    46
    
  • L632

    ts
    630      // Create contribution record
    631      const contribution: GoalContribution = {
    632        id: `contrib_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    633        goalId: input.goalId,
    634        streamId: input.streamId,
    
  • L1015

    ts
    1013      }
    1014
    1015      const contentId = `content_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1016      const now = new Date();
    1017
    

libs/aphrodite/venue-management/src/accessibility/venue-accessibility.ts#

  • L346

    ts
    344    let result = '';
    345    for (let i = 0; i < 12; i++) {
    346      result += chars[Math.floor(Math.random() * chars.length)];
    347    }
    348    return result;
    

libs/aphrodite/venue-management/src/analytics/venue-benchmarks.ts#

  • L181

    ts
    179    let result = '';
    180    for (let i = 0; i < 12; i++) {
    181      result += chars[Math.floor(Math.random() * chars.length)];
    182    }
    183    return result;
    

libs/aphrodite/venue-management/src/audience/venue-audience.ts#

  • L208

    ts
    206    let result = '';
    207    for (let i = 0; i < 12; i++) {
    208      result += chars[Math.floor(Math.random() * chars.length)];
    209    }
    210    return result;
    

libs/aphrodite/venue-management/src/communication/partner-comms.ts#

  • L253

    ts
    251    let result = '';
    252    for (let i = 0; i < 12; i++) {
    253      result += chars[Math.floor(Math.random() * chars.length)];
    254    }
    255    return result;
    

libs/aphrodite/venue-management/src/coordination/multi-venue-events.ts#

  • L191

    ts
    189    let result = '';
    190    for (let i = 0; i < 12; i++) {
    191      result += chars[Math.floor(Math.random() * chars.length)];
    192    }
    193    return result;
    

libs/aphrodite/venue-management/src/dashboard/global-dashboard.ts#

  • L161

    ts
    159    let result = '';
    160    for (let i = 0; i < 12; i++) {
    161      result += chars[Math.floor(Math.random() * chars.length)];
    162    }
    163    return result;
    

libs/aphrodite/venue-management/src/equipment/equipment-manager.ts#

  • L193

    ts
    191    let result = '';
    192    for (let i = 0; i < 12; i++) {
    193      result += chars[Math.floor(Math.random() * chars.length)];
    194    }
    195    return result;
    

libs/aphrodite/venue-management/src/finance/revenue-sharing.ts#

  • L286

    ts
    284    let result = '';
    285    for (let i = 0; i < 12; i++) {
    286      result += chars[Math.floor(Math.random() * chars.length)];
    287    }
    288    return result;
    

libs/aphrodite/venue-management/src/infrastructure/network-manager.ts#

  • L195

    ts
    193    let result = '';
    194    for (let i = 0; i < 12; i++) {
    195      result += chars[Math.floor(Math.random() * chars.length)];
    196    }
    197    return result;
    

libs/aphrodite/venue-management/src/infrastructure/power-management.ts#

  • L279

    ts
    277    let result = '';
    278    for (let i = 0; i < 12; i++) {
    279      result += chars[Math.floor(Math.random() * chars.length)];
    280    }
    281    return result;
    

libs/aphrodite/venue-management/src/legal/insurance-manager.ts#

  • L312

    ts
    310    let result = '';
    311    for (let i = 0; i < 12; i++) {
    312      result += chars[Math.floor(Math.random() * chars.length)];
    313    }
    314    return result;
    

libs/aphrodite/venue-management/src/marketing/venue-promotion.ts#

  • L185

    ts
    183    let result = '';
    184    for (let i = 0; i < 12; i++) {
    185      result += chars[Math.floor(Math.random() * chars.length)];
    186    }
    187    return result;
    

libs/aphrodite/venue-management/src/onboarding/application.ts#

  • L251

    ts
    249    let result = '';
    250    for (let i = 0; i < 12; i++) {
    251      result += chars[Math.floor(Math.random() * chars.length)];
    252    }
    253    return result;
    

libs/aphrodite/venue-management/src/onboarding/inspection.ts#

  • L556

    ts
    554    let result = '';
    555    for (let i = 0; i < 12; i++) {
    556      result += chars[Math.floor(Math.random() * chars.length)];
    557    }
    558    return result;
    

libs/aphrodite/venue-management/src/onboarding/integration-test.ts#

  • L255

    ts
    253    let result = '';
    254    for (let i = 0; i < 12; i++) {
    255      result += chars[Math.floor(Math.random() * chars.length)];
    256    }
    257    return result;
    

libs/aphrodite/venue-management/src/profile/venue-profile.ts#

  • L235

    ts
    233    let result = '';
    234    for (let i = 0; i < 12; i++) {
    235      result += chars[Math.floor(Math.random() * chars.length)];
    236    }
    237    return result;
    

libs/aphrodite/venue-management/src/quality/tier-system.ts#

  • L270

    ts
    268    let result = '';
    269    for (let i = 0; i < 12; i++) {
    270      result += chars[Math.floor(Math.random() * chars.length)];
    271    }
    272    return result;
    

libs/aphrodite/venue-management/src/quality/upgrade-tracker.ts#

  • L338

    ts
    336    let result = '';
    337    for (let i = 0; i < 12; i++) {
    338      result += chars[Math.floor(Math.random() * chars.length)];
    339    }
    340    return result;
    

libs/aphrodite/venue-management/src/safety-tracking/safety-tracking.ts#

  • L609

    ts
    607    let result = '';
    608    for (let i = 0; i < length; i++) {
    609      result += chars[Math.floor(Math.random() * chars.length)];
    610    }
    611    return result;
    

libs/aphrodite/venue-management/src/scheduling/venue-scheduler.ts#

  • L201

    ts
    199    let result = '';
    200    for (let i = 0; i < 12; i++) {
    201      result += chars[Math.floor(Math.random() * chars.length)];
    202    }
    203    return result;
    

libs/aphrodite/venue-management/src/security/access-control.ts#

  • L251

    ts
    249    let result = '';
    250    for (let i = 0; i < 12; i++) {
    251      result += chars[Math.floor(Math.random() * chars.length)];
    252    }
    253    return result;
    

libs/aphrodite/venue-management/src/staff/staff-manager.ts#

  • L207

    ts
    205    let result = '';
    206    for (let i = 0; i < 12; i++) {
    207      result += chars[Math.floor(Math.random() * chars.length)];
    208    }
    209    return result;
    

libs/aphrodite/venue-management/src/venue-management.ts#

  • L588

    ts
    586    const timestamp = Date.now().toString(36);
    587    const counter = venueIdCounter.toString(36).padStart(4, '0');
    588    const random = Math.random().toString(36).substring(2, 6);
    589    return `venue-${timestamp}-${counter}-${random}`;
    590  }
    

libs/aphrodite/vfx-particles/src/physics.ts#

  • L1559

    ts
    1557      for (let i = 0; i < flockConfig.particleCount; i++) {
    1558        const angle = (i / flockConfig.particleCount) * Math.PI * 2;
    1559        const r = Math.random() * flockConfig.boundaryRadius * 0.5;
    1560        particles.push({
    1561          position: v3(
    
  • L1563

    ts
    1561          position: v3(
    1562            Math.cos(angle) * r,
    1563            (Math.random() - 0.5) * flockConfig.boundaryRadius * 0.3,
    1564            Math.sin(angle) * r
    1565          ),
    
  • L1567

    ts
    1565          ),
    1566          velocity: v3(
    1567            (Math.random() - 0.5) * flockConfig.maxSpeed,
    1568            (Math.random() - 0.5) * flockConfig.maxSpeed * 0.3,
    1569            (Math.random() - 0.5) * flockConfig.maxSpeed
    
  • L1568

    ts
    1566          velocity: v3(
    1567            (Math.random() - 0.5) * flockConfig.maxSpeed,
    1568            (Math.random() - 0.5) * flockConfig.maxSpeed * 0.3,
    1569            (Math.random() - 0.5) * flockConfig.maxSpeed
    1570          ),
    
  • L1569

    ts
    1567            (Math.random() - 0.5) * flockConfig.maxSpeed,
    1568            (Math.random() - 0.5) * flockConfig.maxSpeed * 0.3,
    1569            (Math.random() - 0.5) * flockConfig.maxSpeed
    1570          ),
    1571          acceleration: v3(0, 0, 0),
    

libs/aphrodite/viewer-avatars/src/index.ts#

  • L46

    ts
    44   */
    45  function generateId(): string {
    46    return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
    47  }
    48
    

libs/aphrodite/viewer-interactions/src/index.ts#

  • L46

    ts
    44   */
    45  function generateId(): string {
    46    return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
    47  }
    48
    

libs/aphrodite/vip-areas/src/index.ts#

  • L46

    ts
    44   */
    45  function generateId(): string {
    46    return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
    47  }
    48
    

libs/aphrodite/virtual-gifts/src/index.ts#

  • L51

    ts
    49   */
    50  function generateId(): string {
    51    return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
    52  }
    53
    
  • L158

    ts
    156  function randomInBox(min: Vector3D, max: Vector3D): Vector3D {
    157    return {
    158      x: min.x + Math.random() * (max.x - min.x),
    159      y: min.y + Math.random() * (max.y - min.y),
    160      z: min.z + Math.random() * (max.z - min.z),
    
  • L159

    ts
    157    return {
    158      x: min.x + Math.random() * (max.x - min.x),
    159      y: min.y + Math.random() * (max.y - min.y),
    160      z: min.z + Math.random() * (max.z - min.z),
    161    };
    
  • L160

    ts
    158      x: min.x + Math.random() * (max.x - min.x),
    159      y: min.y + Math.random() * (max.y - min.y),
    160      z: min.z + Math.random() * (max.z - min.z),
    161    };
    162  }
    
  • L735

    ts
    733          const definitionId =
    734            this.config.giftDefinitionIds[
    735              Math.floor(Math.random() * this.config.giftDefinitionIds.length)
    736            ];
    737          const position = randomInBox(this.config.spawnArea.min, this.config.spawnArea.max);
    
  • L746

    ts
    744            velocity: {
    745              x: 0,
    746              y: -(this.config.fallSpeed + (Math.random() - 0.5) * 2 * this.config.fallSpeedVariance),
    747              z: 0,
    748            },
    
  • L749

    ts
    747              z: 0,
    748            },
    749            rotation: Math.random() * Math.PI * 2,
    750            collected: false,
    751          };
    
  • L1048

    ts
    1046        case 'random_room':
    1047          pos = {
    1048            x: (Math.random() - 0.5) * 6,
    1049            y: 1 + Math.random() * 2,
    1050            z: 1 + Math.random() * 2,
    
  • L1049

    ts
    1047          pos = {
    1048            x: (Math.random() - 0.5) * 6,
    1049            y: 1 + Math.random() * 2,
    1050            z: 1 + Math.random() * 2,
    1051          };
    
  • L1050

    ts
    1048            x: (Math.random() - 0.5) * 6,
    1049            y: 1 + Math.random() * 2,
    1050            z: 1 + Math.random() * 2,
    1051          };
    1052          break;
    
  • L1060

    ts
    1058          break;
    1059        case 'sky':
    1060          pos = { x: (Math.random() - 0.5) * 4, y: 5, z: 2 };
    1061          break;
    1062        case 'custom':
    

libs/aphrodite/virtual-rooms/src/environmental-effects.ts#

  • L1324

    ts
    1322     */
    1323    private createParticle(config: ParticleConfig, emitter: EmitterConfig): ParticleInstance {
    1324      const randomRange = (range: ValueRange) => range.min + Math.random() * (range.max - range.min);
    1325
    1326      // Get emission position based on emitter shape
    
  • L1333

    ts
    1331      const direction = this.getEmissionDirection(emitter);
    1332      const velocity: Vector3 = {
    1333        x: direction.x * speed + (Math.random() - 0.5) * config.velocityRandomness * speed,
    1334        y: direction.y * speed + (Math.random() - 0.5) * config.velocityRandomness * speed,
    1335        z: direction.z * speed + (Math.random() - 0.5) * config.velocityRandomness * speed,
    
  • L1334

    ts
    1332      const velocity: Vector3 = {
    1333        x: direction.x * speed + (Math.random() - 0.5) * config.velocityRandomness * speed,
    1334        y: direction.y * speed + (Math.random() - 0.5) * config.velocityRandomness * speed,
    1335        z: direction.z * speed + (Math.random() - 0.5) * config.velocityRandomness * speed,
    1336      };
    
  • L1335

    ts
    1333        x: direction.x * speed + (Math.random() - 0.5) * config.velocityRandomness * speed,
    1334        y: direction.y * speed + (Math.random() - 0.5) * config.velocityRandomness * speed,
    1335        z: direction.z * speed + (Math.random() - 0.5) * config.velocityRandomness * speed,
    1336      };
    1337
    
  • L1341

    ts
    1339      let color: ParticleColor;
    1340      if (Array.isArray(config.startColor)) {
    1341        const stop = config.startColor[Math.floor(Math.random() * config.startColor.length)];
    1342        color = stop ? { ...stop.color } : { r: 1, g: 1, b: 1, a: 1 };
    1343      } else {
    
  • L1348

    ts
    1346
    1347      return {
    1348        id: `${config.id}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    1349        configId: config.id,
    1350        position,
    
  • L1367

    ts
    1365    private getEmissionPosition(emitter: EmitterConfig): Vector3 {
    1366      const { position, shape, shapeRadius = 1 } = emitter;
    1367      const r = emitter.emitFromShell ? shapeRadius : Math.random() * shapeRadius;
    1368
    1369      switch (shape) {
    
  • L1375

    ts
    1373        case 'box':
    1374          return {
    1375            x: position.x + (Math.random() - 0.5) * emitter.scale.x,
    1376            y: position.y + (Math.random() - 0.5) * emitter.scale.y,
    1377            z: position.z + (Math.random() - 0.5) * emitter.scale.z,
    
  • L1376

    ts
    1374          return {
    1375            x: position.x + (Math.random() - 0.5) * emitter.scale.x,
    1376            y: position.y + (Math.random() - 0.5) * emitter.scale.y,
    1377            z: position.z + (Math.random() - 0.5) * emitter.scale.z,
    1378          };
    
  • L1377

    ts
    1375            x: position.x + (Math.random() - 0.5) * emitter.scale.x,
    1376            y: position.y + (Math.random() - 0.5) * emitter.scale.y,
    1377            z: position.z + (Math.random() - 0.5) * emitter.scale.z,
    1378          };
    1379
    
  • L1381

    ts
    1379
    1380        case 'sphere': {
    1381          const theta = Math.random() * 2 * Math.PI;
    1382          const phi = Math.acos(2 * Math.random() - 1);
    1383          return {
    
  • L1382

    ts
    1380        case 'sphere': {
    1381          const theta = Math.random() * 2 * Math.PI;
    1382          const phi = Math.acos(2 * Math.random() - 1);
    1383          return {
    1384            x: position.x + r * Math.sin(phi) * Math.cos(theta),
    
  • L1391

    ts
    1389
    1390        case 'hemisphere': {
    1391          const theta = Math.random() * 2 * Math.PI;
    1392          const phi = Math.acos(Math.random());
    1393          return {
    
  • L1392

    ts
    1390        case 'hemisphere': {
    1391          const theta = Math.random() * 2 * Math.PI;
    1392          const phi = Math.acos(Math.random());
    1393          return {
    1394            x: position.x + r * Math.sin(phi) * Math.cos(theta),
    
  • L1402

    ts
    1400        case 'cone': {
    1401          const angle = (emitter.shapeAngle ?? 45) * (Math.PI / 180);
    1402          const theta = Math.random() * 2 * Math.PI;
    1403          const h = Math.random();
    1404          const coneR = h * Math.tan(angle) * r;
    
  • L1403

    ts
    1401          const angle = (emitter.shapeAngle ?? 45) * (Math.PI / 180);
    1402          const theta = Math.random() * 2 * Math.PI;
    1403          const h = Math.random();
    1404          const coneR = h * Math.tan(angle) * r;
    1405          return {
    
  • L1414

    ts
    1412        case 'plane':
    1413          return {
    1414            x: position.x + (Math.random() - 0.5) * emitter.scale.x,
    1415            y: position.y,
    1416            z: position.z + (Math.random() - 0.5) * emitter.scale.z,
    
  • L1416

    ts
    1414            x: position.x + (Math.random() - 0.5) * emitter.scale.x,
    1415            y: position.y,
    1416            z: position.z + (Math.random() - 0.5) * emitter.scale.z,
    1417          };
    1418
    
  • L1420

    ts
    1418
    1419        case 'circle': {
    1420          const theta = Math.random() * 2 * Math.PI;
    1421          return {
    1422            x: position.x + r * Math.cos(theta),
    
  • L1450

    ts
    1448        case 'sphere': {
    1449          // Emit in random direction from center
    1450          const theta = Math.random() * 2 * Math.PI;
    1451          const phi = Math.acos(2 * Math.random() - 1);
    1452          direction = {
    
  • L1451

    ts
    1449          // Emit in random direction from center
    1450          const theta = Math.random() * 2 * Math.PI;
    1451          const phi = Math.acos(2 * Math.random() - 1);
    1452          direction = {
    1453            x: Math.sin(phi) * Math.cos(theta),
    
  • L1465

    ts
    1463      // Apply randomization
    1464      if (randomize > 0) {
    1465        direction.x += (Math.random() - 0.5) * 2 * randomize;
    1466        direction.y += (Math.random() - 0.5) * 2 * randomize;
    1467        direction.z += (Math.random() - 0.5) * 2 * randomize;
    
  • L1466

    ts
    1464      if (randomize > 0) {
    1465        direction.x += (Math.random() - 0.5) * 2 * randomize;
    1466        direction.y += (Math.random() - 0.5) * 2 * randomize;
    1467        direction.z += (Math.random() - 0.5) * 2 * randomize;
    1468
    
  • L1467

    ts
    1465        direction.x += (Math.random() - 0.5) * 2 * randomize;
    1466        direction.y += (Math.random() - 0.5) * 2 * randomize;
    1467        direction.z += (Math.random() - 0.5) * 2 * randomize;
    1468
    1469        // Normalize
    
  • L1625

    ts
    1623      // Random lightning strikes based on frequency
    1624      const strikeChance = _deltaTime / ((lightning.frequency.min + lightning.frequency.max) / 2);
    1625      if (Math.random() < strikeChance) {
    1626        const intensity =
    1627          lightning.intensity.min +
    
  • L1628

    ts
    1626        const intensity =
    1627          lightning.intensity.min +
    1628          Math.random() * (lightning.intensity.max - lightning.intensity.min);
    1629        const position: Vector3 = {
    1630          x: (Math.random() - 0.5) * 100,
    
  • L1630

    ts
    1628          Math.random() * (lightning.intensity.max - lightning.intensity.min);
    1629        const position: Vector3 = {
    1630          x: (Math.random() - 0.5) * 100,
    1631          y: 50,
    1632          z: (Math.random() - 0.5) * 100,
    
  • L1632

    ts
    1630          x: (Math.random() - 0.5) * 100,
    1631          y: 50,
    1632          z: (Math.random() - 0.5) * 100,
    1633        };
    1634        this.emit('lightning-strike', { position, intensity });
    

libs/aphrodite/virtual-rooms/src/room-customization.ts#

  • L546

    ts
    544
    545      const propInstance: RoomPropInstance = {
    546        instanceId: `prop-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    547        propId: prop.id,
    548        transform: {
    
  • L844

    ts
    842    loadRoom(saveData: RoomSaveData, template: RoomTemplate): RoomInstance | null {
    843      const room: RoomInstance = {
    844        id: `room-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    845        templateId: saveData.templateId,
    846        props: [...saveData.props],
    

libs/aphrodite/virtual-rooms/src/room-editor-hooks.ts#

  • L54

    ts
    52   */
    53  function generateId(): string {
    54    return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
    55  }
    56
    

libs/aphrodite/virtual-rooms/src/room-templates.ts#

  • L1129

    ts
    1127
    1128      const instance: RoomInstance = {
    1129        id: `room-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    1130        templateId,
    1131        props: template.props.map((prop) => ({
    
  • L1132

    ts
    1130        templateId,
    1131        props: template.props.map((prop) => ({
    1132          instanceId: `${prop.id}-${Math.random().toString(36).slice(2, 9)}`,
    1133          propId: prop.id,
    1134          transform: { ...prop.transform },
    

libs/aphrodite/vod-chaptering/src/index.ts#

  • L48

    ts
    46  function generateId(prefix: string): string {
    47    const timestamp = Date.now().toString(36);
    48    const random = Math.random().toString(36).substring(2, 10);
    49    return `${prefix}_${timestamp}_${random}`;
    50  }
    
  • L273

    ts
    271        await new Promise((resolve) => setTimeout(resolve, 10));
    272
    273        const frameDiff = Math.random();
    274        if (frameDiff > 1 - this.config.sceneSensitivity) {
    275          results.push({
    
  • L279

    ts
    277            confidence: frameDiff,
    278            frameDifference: frameDiff,
    279            histogramDifference: Math.random() * 0.5,
    280            motionMagnitude: Math.random(),
    281          });
    
  • L280

    ts
    278            frameDifference: frameDiff,
    279            histogramDifference: Math.random() * 0.5,
    280            motionMagnitude: Math.random(),
    281          });
    282        }
    
  • L300

    ts
    298        results.push({
    299          timestamp: t,
    300          level: -30 + Math.random() * 40,
    301          isSpeech: Math.random() > 0.3,
    302          isMusic: Math.random() > 0.7,
    
  • L301

    ts
    299          timestamp: t,
    300          level: -30 + Math.random() * 40,
    301          isSpeech: Math.random() > 0.3,
    302          isMusic: Math.random() > 0.7,
    303          isSilence: Math.random() > 0.9,
    
  • L302

    ts
    300          level: -30 + Math.random() * 40,
    301          isSpeech: Math.random() > 0.3,
    302          isMusic: Math.random() > 0.7,
    303          isSilence: Math.random() > 0.9,
    304          speakerChange: Math.random() > 0.85,
    
  • L303

    ts
    301          isSpeech: Math.random() > 0.3,
    302          isMusic: Math.random() > 0.7,
    303          isSilence: Math.random() > 0.9,
    304          speakerChange: Math.random() > 0.85,
    305        });
    
  • L304

    ts
    302          isMusic: Math.random() > 0.7,
    303          isSilence: Math.random() > 0.9,
    304          speakerChange: Math.random() > 0.85,
    305        });
    306      }
    
  • L326

    ts
    324        results.push({
    325          timestamp: t,
    326          activityLevel: Math.random(),
    327          motionScore: Math.random(),
    328          chatActivity: Math.random(),
    
  • L327

    ts
    325          timestamp: t,
    326          activityLevel: Math.random(),
    327          motionScore: Math.random(),
    328          chatActivity: Math.random(),
    329          reactionActivity: Math.random(),
    
  • L328

    ts
    326          activityLevel: Math.random(),
    327          motionScore: Math.random(),
    328          chatActivity: Math.random(),
    329          reactionActivity: Math.random(),
    330        });
    
  • L329

    ts
    327          motionScore: Math.random(),
    328          chatActivity: Math.random(),
    329          reactionActivity: Math.random(),
    330        });
    331      }
    
  • L347

    ts
    345
    346      while (t < duration) {
    347        const segmentDuration = 30 + Math.random() * 60;
    348
    349        await new Promise((resolve) => setTimeout(resolve, 5));
    
  • L355

    ts
    353          endTime: Math.min(t + segmentDuration, duration),
    354          text: `[Simulated transcript for segment at ${formatDuration(t)}]`,
    355          confidence: 0.8 + Math.random() * 0.2,
    356          keywords: [topics[topicIndex % topics.length]],
    357        });
    

libs/aphrodite/volumetric-capture/src/multi-cam/multi-cam.ts#

  • L131

    ts
    129
    130        // Image points: projected grid centered in image with small jitter
    131        const jx = (Math.random() - 0.5) * 2 * jitterPx;
    132        const jy = (Math.random() - 0.5) * 2 * jitterPx;
    133        imagePoints[i2] = cx + (c - cols / 2) * gridPixelSize + jx;
    
  • L132

    ts
    130        // Image points: projected grid centered in image with small jitter
    131        const jx = (Math.random() - 0.5) * 2 * jitterPx;
    132        const jy = (Math.random() - 0.5) * 2 * jitterPx;
    133        imagePoints[i2] = cx + (c - cols / 2) * gridPixelSize + jx;
    134        imagePoints[i2 + 1] = cy + (r - rows / 2) * gridPixelSize + jy;
    

libs/aphrodite/wearables/src/index.ts#

  • L1377

    ts
    1375
    1376      // Add random variation
    1377      const variation = (Math.random() - 0.5) * 2 * this.variability;
    1378      const bpm = Math.round(this.baseHeartRate + variation);
    1379
    
  • L1382

    ts
    1380      // Generate realistic RR intervals
    1381      const rrIntervals: number[] = [];
    1382      const numRR = Math.floor(Math.random() * 3) + 1;
    1383      for (let i = 0; i < numRR; i++) {
    1384        const rrBase = 60000 / bpm;
    
  • L1385

    ts
    1383      for (let i = 0; i < numRR; i++) {
    1384        const rrBase = 60000 / bpm;
    1385        const rrVariation = (Math.random() - 0.5) * 50;
    1386        rrIntervals.push(Math.round(rrBase + rrVariation));
    1387      }
    

libs/arete/ai-coach/src/coaching.ts#

  • L263

    ts
    261
    262  function selectQuote(): { text: string; author: string } {
    263    const index = Math.floor(Math.random() * MOTIVATIONAL_QUOTES.length);
    264    return MOTIVATIONAL_QUOTES[index];
    265  }
    

libs/arete/gamification/src/accountability.ts#

  • L15

    ts
    13  function uuid(): string {
    14    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    15      const r = (Math.random() * 16) | 0;
    16      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    17      return v.toString(16);
    

libs/arete/gamification/src/badges.ts#

  • L15

    ts
    13  function uuid(): string {
    14    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    15      const r = (Math.random() * 16) | 0;
    16      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    17      return v.toString(16);
    

libs/arete/gamification/src/challenges.ts#

  • L15

    ts
    13  function uuid(): string {
    14    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    15      const r = (Math.random() * 16) | 0;
    16      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    17      return v.toString(16);
    

libs/arete/gamification/src/contracts.ts#

  • L15

    ts
    13  function uuid(): string {
    14    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    15      const r = (Math.random() * 16) | 0;
    16      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    17      return v.toString(16);
    

libs/arete/gamification/src/points.ts#

  • L44

    ts
    42  function uuid(): string {
    43    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    44      const r = (Math.random() * 16) | 0;
    45      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    46      return v.toString(16);
    

libs/arete/gamification/src/rewards.ts#

  • L15

    ts
    13  function uuid(): string {
    14    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    15      const r = (Math.random() * 16) | 0;
    16      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    17      return v.toString(16);
    

libs/arete/habits/src/reminders.ts#

  • L267

    ts
    265    // Comeback after break
    266    if (streak?.current === 0 && streak.best > 0) {
    267      const msg = COMEBACK_MESSAGES[Math.floor(Math.random() * COMEBACK_MESSAGES.length)];
    268      return {
    269        habitId: habit.id,
    
  • L287

    ts
    285
    286    // General encouragement
    287    const msg = ENCOURAGEMENT_MESSAGES[Math.floor(Math.random() * ENCOURAGEMENT_MESSAGES.length)];
    288    return {
    289      habitId: habit.id,
    

libs/asase/export/src/logistics-optimizer.ts#

  • L1441

    ts
    1439            port,
    1440            estimatedDeparture: depDate,
    1441            availableSlotsTEU: Math.floor(50 + Math.random() * 200),
    1442            bookingCutoffDate: cutoff.toISOString().slice(0, 10),
    1443            destinationsServed: destinations[port],
    

libs/asase/processing/src/raw-material-receiving.ts#

  • L868

    ts
    866
    867  function genLotId(): string {
    868    return `LOT-${Date.now()}-${String(Math.floor(Math.random() * 1000)).padStart(3, '0')}`;
    869  }
    870
    

libs/asase/sota/src/ml-predictions.ts#

  • L262

    ts
    260
    261  function generateId(prefix: string): string {
    262    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    263  }
    264
    

libs/asase/supply-chain/src/delivery-proof.ts#

  • L334

    ts
    332   */
    333  export function generateOtpCode(): string {
    334    const code = Math.floor(Math.random() * 10 ** OTP_CODE_LENGTH);
    335    return String(code).padStart(OTP_CODE_LENGTH, '0');
    336  }
    

libs/bellona/adapters/src/bridge/message-codec.ts#

  • L21

    ts
    19    const timestamp = Date.now().toString(36);
    20    const counter = (++messageIdCounter).toString(36).padStart(4, '0');
    21    const random = Math.random().toString(36).substring(2, 6);
    22    return `${timestamp}-${counter}-${random}`;
    23  }
    

libs/bellona/adapters/src/bridge/reconnection.ts#

  • L241

    ts
    239      if (this.options.jitter > 0) {
    240        const jitterAmount = delay * this.options.jitter;
    241        delay += Math.random() * jitterAmount * 2 - jitterAmount;
    242      }
    243
    

libs/bellona/audio/src/export/index.ts#

  • L520

    ts
    518   */
    519  function tpdfDither(): number {
    520    return Math.random() - 0.5 + (Math.random() - 0.5);
    521  }
    522
    

libs/bellona/bridge-core/src/index.ts#

  • L30

    ts
    28
    29  export function createMessageId(): MessageId {
    30    return `msg_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as MessageId;
    31  }
    32
    
  • L431

    ts
    429
    430      const connectionId = createConnectionId(
    431        `conn_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
    432      );
    433
    

libs/bellona/gameplay-systems/src/ai-behavior/index.ts#

  • L1227

    ts
    1225    constructor(type: BehaviorNodeType, name: string) {
    1226      this.node = {
    1227        id: createBehaviorNodeId(`${type}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`),
    1228        type,
    1229        name,
    

libs/bellona/gameplay-systems/src/combat/index.ts#

  • L183

    ts
    181
    182      const entity: CombatEntity = {
    183        id: createEntityId(`entity_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`),
    184        name,
    185        stats: defaultStats,
    
  • L453

    ts
    451
    452      // Step 3: Check for crit
    453      const critRoll = Math.random();
    454      const isCrit = critRoll < attacker.stats.critChance;
    455      if (isCrit) {
    
  • L472

    ts
    470      const effectiveDodge =
    471        defender.stats.dodgeChance / (defender.stats.dodgeChance + dodgeConstant);
    472      const dodgeRoll = Math.random();
    473      const isDodged = dodgeRoll < effectiveDodge;
    474
    
  • L485

    ts
    483        const effectiveBlock =
    484          defender.stats.blockChance / (defender.stats.blockChance + blockConstant);
    485        const blockRoll = Math.random();
    486        isBlocked = blockRoll < effectiveBlock;
    487        if (isBlocked) {
    
  • L1000

    ts
    998    ): void {
    999      // Check chance
    1000      if (effect.chance !== undefined && Math.random() > effect.chance) {
    1001        return;
    1002      }
    
  • L1005

    ts
    1003
    1004      const combatEffect: CombatEffect = {
    1005        id: createEffectId(`effect_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`),
    1006        name: `${ability.name} - ${effect.type}`,
    1007        type: effect.type,
    

libs/bellona/gameplay-systems/src/inventory/index.ts#

  • L229

    ts
    227    ): ContainerId {
    228      const id = createContainerId(
    229        `container_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
    230      );
    231      const container: InventoryContainer = {
    
  • L283

    ts
    281
    282      return {
    283        id: createItemInstanceId(`item_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`),
    284        definitionId,
    285        quantity: Math.min(quantity, definition.maxStack),
    

libs/bellona/godot/src/assets/index.ts#

  • L2415

    ts
    2413
    2414    private generateAssetId(): string {
    2415      return `asset_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    2416    }
    2417
    
  • L2422

    ts
    2420      let result = '';
    2421      for (let i = 0; i < 13; i++) {
    2422        result += chars[Math.floor(Math.random() * chars.length)];
    2423      }
    2424      return result;
    

libs/bellona/interchange-models/src/animation/index.ts#

  • L69

    ts
    67
    68  function generateAnimationId(): AnimationModelId {
    69    return `anim_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as AnimationModelId;
    70  }
    71
    
  • L73

    ts
    71
    72  function generateTrackId(): TrackId {
    73    return `track_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as TrackId;
    74  }
    75
    
  • L77

    ts
    75
    76  function generateKeyframeId(): KeyframeId {
    77    return `key_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as KeyframeId;
    78  }
    79
    

libs/bellona/interchange-models/src/index.ts#

  • L174

    ts
    172  export function generateModelId<T extends string>(prefix: string): T {
    173    const timestamp = Date.now();
    174    const random = Math.random().toString(36).substr(2, 9);
    175    return `${prefix}_${timestamp}_${random}` as T;
    176  }
    

libs/bellona/interchange-models/src/material/index.ts#

  • L67

    ts
    65
    66  function generateMaterialId(): MaterialModelId {
    67    return `mat_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as MaterialModelId;
    68  }
    69
    
  • L71

    ts
    69
    70  function generateShaderNodeId(): ShaderNodeId {
    71    return `node_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as ShaderNodeId;
    72  }
    73
    

libs/bellona/interchange-models/src/scene/index.ts#

  • L63

    ts
    61
    62  function generateSceneId(): SceneModelId {
    63    return `scene_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as SceneModelId;
    64  }
    65
    
  • L67

    ts
    65
    66  function generateNodeId(): NodeModelId {
    67    return `node_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as NodeModelId;
    68  }
    69
    
  • L71

    ts
    69
    70  function generateMeshId(): MeshModelId {
    71    return `mesh_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as MeshModelId;
    72  }
    73
    
  • L75

    ts
    73
    74  function generateMaterialId(): MaterialModelId {
    75    return `mat_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as MaterialModelId;
    76  }
    77
    
  • L79

    ts
    77
    78  function generateAnimationId(): AnimationModelId {
    79    return `anim_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as AnimationModelId;
    80  }
    81
    

libs/bellona/interchange/src/fbx/index.ts#

  • L1766

    ts
    1764    // Utility methods
    1765    private generateAssetId(): AssetId {
    1766      return `asset_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as AssetId;
    1767    }
    1768
    
  • L1770

    ts
    1768
    1769    private generateMeshId(): MeshId {
    1770      return `mesh_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as MeshId;
    1771    }
    1772
    
  • L1774

    ts
    1772
    1773    private generateMaterialId(): MaterialId {
    1774      return `mat_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as MaterialId;
    1775    }
    1776
    
  • L1778

    ts
    1776
    1777    private generateTextureId(): TextureId {
    1778      return `tex_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as TextureId;
    1779    }
    1780
    

libs/bellona/interchange/src/index.ts#

  • L317

    ts
    315
    316    private generateJobId(): JobId {
    317      return `job_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as JobId;
    318    }
    319  }
    

libs/bellona/interchange/src/usd/index.ts#

  • L1522

    ts
    1520
    1521    private generateAssetId(): AssetId {
    1522      return `asset_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as AssetId;
    1523    }
    1524
    
  • L1526

    ts
    1524
    1525    private generateMeshId(): MeshId {
    1526      return `mesh_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as MeshId;
    1527    }
    1528
    
  • L1530

    ts
    1528
    1529    private generateMaterialId(): MaterialId {
    1530      return `mat_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as MaterialId;
    1531    }
    1532
    

libs/bellona/metahuman/src/customization/appearance-editor.ts#

  • L1256

    ts
    1254      for (const region of regions) {
    1255        const changes: Record<string, number> = {
    1256          size: 0.5 + (Math.random() - 0.5) * intensity,
    1257          position: 0.5 + (Math.random() - 0.5) * intensity,
    1258          rotation: 0.5 + (Math.random() - 0.5) * intensity,
    
  • L1257

    ts
    1255        const changes: Record<string, number> = {
    1256          size: 0.5 + (Math.random() - 0.5) * intensity,
    1257          position: 0.5 + (Math.random() - 0.5) * intensity,
    1258          rotation: 0.5 + (Math.random() - 0.5) * intensity,
    1259        };
    
  • L1258

    ts
    1256          size: 0.5 + (Math.random() - 0.5) * intensity,
    1257          position: 0.5 + (Math.random() - 0.5) * intensity,
    1258          rotation: 0.5 + (Math.random() - 0.5) * intensity,
    1259        };
    1260
    

libs/bellona/mocap/src/recording/index.ts#

  • L167

    ts
    165    constructor(config: RecordingConfig) {
    166      this.id =
    167        config.id ?? (`rec_${Date.now()}_${Math.random().toString(36).slice(2, 8)}` as RecordingId);
    168      this.config = {
    169        ...config,
    
  • L2174

    ts
    2172    createSession(config: MocapSessionConfig): MocapSessionId {
    2173      const sessionId =
    2174        `sess_${Date.now()}_${Math.random().toString(36).slice(2, 8)}` as MocapSessionId;
    2175
    2176      this.sessions.set(sessionId, {
    

libs/bellona/mocap/src/retarget/index.ts#

  • L219

    ts
    217      if (!this.profile.id) {
    218        this.profile.id =
    219          `rtgt_${Date.now()}_${Math.random().toString(36).slice(2, 8)}` as RetargetProfileId;
    220      }
    221
    
  • L991

    ts
    989
    990      const profile: RetargetProfile = {
    991        id: `rtgt_${Date.now()}_${Math.random().toString(36).slice(2, 8)}` as RetargetProfileId,
    992        name,
    993        sourceSkeletonId: sourceId,
    

libs/bellona/mocap/src/skeleton/index.ts#

  • L257

    ts
    255      // Generate ID if not set
    256      if (!this.definition.id) {
    257        this.definition.id = `skel_${Date.now()}_${Math.random().toString(36).slice(2, 8)}` as SkeletonTemplateId;
    258      }
    259
    

libs/bellona/openusd/src/advanced/usd-sota.ts#

  • L24

    ts
    22
    23  function generateId(prefix: string): string {
    24    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    25  }
    26
    

libs/bellona/unity/src/assets/index.ts#

  • L1468

    ts
    1466
    1467    private generateId(): string {
    1468      return `asset_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    1469    }
    1470
    
  • L1475

    ts
    1473      let result = '';
    1474      for (let i = 0; i < 32; i++) {
    1475        result += chars[Math.floor(Math.random() * chars.length)];
    1476      }
    1477      return result;
    

libs/bellona/unity/src/gaussian-splatting/index.ts#

  • L2315

    ts
    2313      const bytes = new Uint8Array(16);
    2314      for (let i = 0; i < 16; i++) {
    2315        bytes[i] = Math.floor(Math.random() * 256);
    2316      }
    2317      return Array.from(bytes)
    

libs/bellona/unity/src/project/index.ts#

  • L1673

    ts
    1671      let result = '';
    1672      for (let i = 0; i < 32; i++) {
    1673        result += chars[Math.floor(Math.random() * chars.length)];
    1674      }
    1675      return result;
    

libs/bellona/unity/src/scene/index.ts#

  • L1011

    ts
    1009
    1010    private generateId(): string {
    1011      return `scene_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
    1012    }
    1013
    
  • L1022

    ts
    1020      let result = '';
    1021      for (let i = 0; i < 32; i++) {
    1022        result += chars[Math.floor(Math.random() * chars.length)];
    1023      }
    1024      return result;
    

libs/bellona/unity/src/scripts/index.ts#

  • L1557

    ts
    1555      let result = '';
    1556      for (let i = 0; i < 32; i++) {
    1557        result += chars[Math.floor(Math.random() * chars.length)];
    1558      }
    1559      return result;
    

libs/bellona/unreal/src/metahuman/appearance-editor.ts#

  • L722

    ts
    720
    721      const randomize = (base: number, v: number) => {
    722        const offset = (Math.random() - 0.5) * 2 * v;
    723        return Math.max(0, Math.min(1, base + offset));
    724      };
    
  • L752

    ts
    750
    751      if (options?.randomizeEyes !== false) {
    752        const r = Math.random();
    753        const g = Math.random();
    754        const b = Math.random();
    
  • L753

    ts
    751      if (options?.randomizeEyes !== false) {
    752        const r = Math.random();
    753        const g = Math.random();
    754        const b = Math.random();
    755        config.eyes = {
    
  • L754

    ts
    752        const r = Math.random();
    753        const g = Math.random();
    754        const b = Math.random();
    755        config.eyes = {
    756          irisColor: [r * 0.3 + 0.1, g * 0.3 + 0.2, b * 0.5 + 0.3],
    
  • L763

    ts
    761
    762      if (options?.randomizeHair !== false) {
    763        const r = Math.random();
    764        const g = Math.random();
    765        const b = Math.random();
    
  • L764

    ts
    762      if (options?.randomizeHair !== false) {
    763        const r = Math.random();
    764        const g = Math.random();
    765        const b = Math.random();
    766        config.hair = {
    
  • L765

    ts
    763        const r = Math.random();
    764        const g = Math.random();
    765        const b = Math.random();
    766        config.hair = {
    767          color: [r * 0.5, g * 0.3, b * 0.2],
    
  • L768

    ts
    766        config.hair = {
    767          color: [r * 0.5, g * 0.3, b * 0.2],
    768          waviness: Math.random(),
    769          density: randomize(0.8, variance * 0.2),
    770        };
    

libs/bellona/video/src/processing/index.ts#

  • L5076

    ts
    5074    private emitParticle(emitter: ParticleEmitterConfig): void {
    5075      // Random angle within spread cone
    5076      const angle = emitter.direction + (Math.random() - 0.5) * 2 * emitter.spreadAngle;
    5077      const speed = emitter.speed * (0.8 + Math.random() * 0.4); // 80-120% speed variation
    5078
    
  • L5077

    ts
    5075      // Random angle within spread cone
    5076      const angle = emitter.direction + (Math.random() - 0.5) * 2 * emitter.spreadAngle;
    5077      const speed = emitter.speed * (0.8 + Math.random() * 0.4); // 80-120% speed variation
    5078
    5079      const particle: Particle = {
    
  • L5080

    ts
    5078
    5079      const particle: Particle = {
    5080        x: emitter.position.x + (Math.random() - 0.5) * 4, // small positional jitter
    5081        y: emitter.position.y + (Math.random() - 0.5) * 4,
    5082        vx: Math.cos(angle) * speed,
    
  • L5081

    ts
    5079      const particle: Particle = {
    5080        x: emitter.position.x + (Math.random() - 0.5) * 4, // small positional jitter
    5081        y: emitter.position.y + (Math.random() - 0.5) * 4,
    5082        vx: Math.cos(angle) * speed,
    5083        vy: Math.sin(angle) * speed,
    
  • L5085

    ts
    5083        vy: Math.sin(angle) * speed,
    5084        age: 0,
    5085        lifetime: emitter.lifetime * (0.7 + Math.random() * 0.6), // 70-130% lifetime variation
    5086        color: [...emitter.color] as [number, number, number],
    5087        size: emitter.size,
    

libs/bellona/virtual-production/src/led-wall/index.ts#

  • L78

    ts
    76
    77  function generateWallId(): LEDWallId {
    78    return `wall_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as LEDWallId;
    79  }
    80
    
  • L82

    ts
    80
    81  function generateSectionId(): LEDSectionId {
    82    return `section_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as LEDSectionId;
    83  }
    84
    
  • L86

    ts
    84
    85  function generateCalibrationId(): CalibrationProfileId {
    86    return `cal_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as CalibrationProfileId;
    87  }
    88
    

libs/bellona/virtual-production/src/tracking/index.ts#

  • L72

    ts
    70
    71  function generateDeviceId(): TrackingDeviceId {
    72    return `tracker_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as TrackingDeviceId;
    73  }
    74
    
  • L76

    ts
    74
    75  function generateCalibrationId(): CalibrationProfileId {
    76    return `cal_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` as CalibrationProfileId;
    77  }
    78
    

libs/bellona/xr/src/quest/index.ts#

  • L790

    ts
    788     */
    789    createEntity(name: string, transform?: Transform): XREntity {
    790      const id = createXREntityId(`entity_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`);
    791
    792      const entity: XREntity = {
    
  • L851

    ts
    849     */
    850    async createAnchor(pose: Pose, persistent: boolean = false): Promise<XRAnchor> {
    851      const id = createXRAnchorId(`anchor_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`);
    852
    853      const anchor: XRAnchor = {
    

libs/bellona/xr/src/spatial-ar/persistent-ar-content-anchoring.ts#

  • L378

    ts
    376    createPersistentAnchor(request: PersistentARAnchorCreateRequest): PersistentARAnchorRecord {
    377      const id = createXRAnchorId(
    378        `persistent_anchor_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`
    379      );
    380      const spaceId = request.spaceId ?? createXRSpaceId('world');
    

libs/bellona/xr/src/spatial-ar/visual-positioning-system.ts#

  • L226

    ts
    224    registerReferenceFrame(request: VPSReferenceFrameRegistrationRequest): VPSReferenceFrame {
    225      const id =
    226        request.frameId ?? `vps-frame-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    227      const frame: VPSReferenceFrame = {
    228        id,
    

libs/bellona/xr/src/visionos/index.ts#

  • L491

    ts
    489     */
    490    createEntity(name: string, transform?: Transform): XREntity {
    491      const id = createXREntityId(`entity_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`);
    492
    493      const entity: XREntity = {
    
  • L552

    ts
    550     */
    551    async createAnchor(pose: Pose, persistent: boolean = false): Promise<XRAnchor> {
    552      const id = createXRAnchorId(`anchor_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`);
    553
    554      const anchor: XRAnchor = {
    

libs/brigid/ai-industrial/src/computer-vision.ts#

  • L836

    ts
    834          return features.map((v) => Math.min(255, v * 1.2));
    835        case 'noise':
    836          return features.map((v) => v + (Math.random() - 0.5) * 0.05 * v);
    837        default:
    838          return [...features];
    

libs/brigid/ai-industrial/src/edge-ai.ts#

  • L891

    ts
    889    /** Box-Muller Gaussian noise sample. */
    890    private _gaussianNoise(std: number): number {
    891      const u1 = Math.random(),
    892        u2 = Math.random();
    893      return std * Math.sqrt(-2 * Math.log(u1 + 1e-12)) * Math.cos(2 * Math.PI * u2);
    
  • L892

    ts
    890    private _gaussianNoise(std: number): number {
    891      const u1 = Math.random(),
    892        u2 = Math.random();
    893      return std * Math.sqrt(-2 * Math.log(u1 + 1e-12)) * Math.cos(2 * Math.PI * u2);
    894    }
    
  • L1036

    ts
    1034        this.replayBuffer.push({ x: [...x], y });
    1035      } else {
    1036        const replaceIdx = Math.floor(Math.random() * this.samplesProcessed);
    1037        if (replaceIdx < this.bufferSize) {
    1038          this.replayBuffer[replaceIdx] = { x: [...x], y };
    

libs/brigid/ai-industrial/src/process-optim.ts#

  • L52

    ts
    50      for (let i = 0; i < n; i++) {
    51        // Random point within stratum
    52        const u = (intervals[i] + Math.random()) / n;
    53        samples[i][j] = bounds[j].min + u * (bounds[j].max - bounds[j].min);
    54      }
    

libs/brigid/ai-industrial/src/sota.ts#

  • L1225

    ts
    1223     */
    1224    selectAction(state: ProcessState): { paramIndex: number; direction: RLAction } {
    1225      if (Math.random() < this.currentEpsilon) {
    1226        // Explore: random action
    1227        const randomActionIdx = Math.floor(Math.random() * this.actionCount);
    
  • L1227

    ts
    1225      if (Math.random() < this.currentEpsilon) {
    1226        // Explore: random action
    1227        const randomActionIdx = Math.floor(Math.random() * this.actionCount);
    1228        return this.decodeAction(randomActionIdx);
    1229      }
    
  • L1239

    ts
    1237        return acc;
    1238      }, []);
    1239      const chosen = maxActions[Math.floor(Math.random() * maxActions.length)];
    1240      return this.decodeAction(chosen);
    1241    }
    

libs/brigid/cybersecurity/src/threat-detection.ts#

  • L497

    ts
    495      const mitreMapping = mitreT ? MITRE_TECHNIQUE_MAP[mitreT] : undefined;
    496      return {
    497        alertId: `IDS-${packet.protocol.toUpperCase()}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    498        timestamp: packet.timestamp,
    499        severity,
    

libs/brigid/factory/src/communications.ts#

  • L408

    ts
    406    private generateMAC(): string {
    407      return Array.from({ length: 6 }, () =>
    408        Math.floor(Math.random() * 256)
    409          .toString(16)
    410          .padStart(2, '0')
    

libs/brigid/factory/src/production.ts#

  • L630

    ts
    628      const copy = [...arr];
    629      for (let i = copy.length - 1; i > 0; i--) {
    630        const j = Math.floor(Math.random() * (i + 1));
    631        [copy[i], copy[j]] = [copy[j], copy[i]];
    632      }
    
  • L637

    ts
    635
    636    function crossover(parent1: Job[], parent2: Job[]): Job[] {
    637      const cut1 = Math.floor(Math.random() * n);
    638      const cut2 = Math.floor(Math.random() * n);
    639      const [start, end] = [Math.min(cut1, cut2), Math.max(cut1, cut2)];
    
  • L638

    ts
    636    function crossover(parent1: Job[], parent2: Job[]): Job[] {
    637      const cut1 = Math.floor(Math.random() * n);
    638      const cut2 = Math.floor(Math.random() * n);
    639      const [start, end] = [Math.min(cut1, cut2), Math.max(cut1, cut2)];
    640      const segment = parent1.slice(start, end);
    
  • L646

    ts
    644
    645    function mutate(individual: Job[]): Job[] {
    646      if (Math.random() > mutationRate) return individual;
    647      const copy = [...individual];
    648      const i = Math.floor(Math.random() * n);
    
  • L648

    ts
    646      if (Math.random() > mutationRate) return individual;
    647      const copy = [...individual];
    648      const i = Math.floor(Math.random() * n);
    649      const j = Math.floor(Math.random() * n);
    650      [copy[i], copy[j]] = [copy[j], copy[i]];
    
  • L649

    ts
    647      const copy = [...individual];
    648      const i = Math.floor(Math.random() * n);
    649      const j = Math.floor(Math.random() * n);
    650      [copy[i], copy[j]] = [copy[j], copy[i]];
    651      return copy;
    
  • L662

    ts
    660      const offspring: Job[][] = [];
    661      while (offspring.length < populationSize - elite.length) {
    662        const p1 = elite[Math.floor(Math.random() * elite.length)];
    663        const p2 = elite[Math.floor(Math.random() * elite.length)];
    664        offspring.push(mutate(crossover(p1, p2)));
    
  • L663

    ts
    661      while (offspring.length < populationSize - elite.length) {
    662        const p1 = elite[Math.floor(Math.random() * elite.length)];
    663        const p2 = elite[Math.floor(Math.random() * elite.length)];
    664        offspring.push(mutate(crossover(p1, p2)));
    665      }
    
  • L864

    ts
    862  /** Box-Muller transform for normal random sample (truncated to > 0). */
    863  function normalSample(mean: number, stdDev: number): number {
    864    const u1 = Math.random();
    865    const u2 = Math.random();
    866    const z = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L865

    ts
    863  function normalSample(mean: number, stdDev: number): number {
    864    const u1 = Math.random();
    865    const u2 = Math.random();
    866    const z = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    867    return Math.max(mean * 0.1, mean + stdDev * z);
    

libs/brigid/financials/src/portfolio-analysis.ts#

  • L551

    ts
    549     */
    550    static triangularSample(min: number, mode: number, max: number): number {
    551      const u = Math.random();
    552      const fc = (mode - min) / (max - min);
    553      if (u < fc) {
    
  • L569

    ts
    567     * @param iterations  Number of simulations (default 1000)
    568     * @param variableRangePct  Width of triangular distribution (default ±20%)
    569     * @param seed  Optional: override Math.random with seeded function for testing
    570     */
    571    static monteCarlo(
    
  • L578

    ts
    576      seed?: () => number
    577    ): MonteCarloResult {
    578      const rng = seed ?? Math.random;
    579      const originalRandom = Math.random;
    580      if (seed) {
    
  • L579

    ts
    577    ): MonteCarloResult {
    578      const rng = seed ?? Math.random;
    579      const originalRandom = Math.random;
    580      if (seed) {
    581        // Temporarily substitute
    

libs/brigid/robotics/src/robot-programming.ts#

  • L1010

    ts
    1008      this.stats.serviceCallCount++;
    1009      // Simulate service execution (echo response in bridge model)
    1010      const latencyMs = Math.round(Math.random() * 5 + 1); // 1–6ms simulated latency
    1011      return {
    1012        success: true,
    

libs/brigid/sota-enhancements/src/digital-thread-quantum.ts#

  • L467

    ts
    465
    466      for (let iter = 0; iter < iterations; iter++) {
    467        const i = Math.floor(Math.random() * n);
    468        const j = Math.floor(Math.random() * n);
    469        const newSchedule = [...schedule];
    
  • L468

    ts
    466      for (let iter = 0; iter < iterations; iter++) {
    467        const i = Math.floor(Math.random() * n);
    468        const j = Math.floor(Math.random() * n);
    469        const newSchedule = [...schedule];
    470        // swap
    
  • L476

    ts
    474        const delta = newMakespan - calcMakespan(schedule);
    475
    476        if (delta < 0 || Math.random() < Math.exp(-delta / temp)) {
    477          schedule = newSchedule;
    478          if (newMakespan < bestMakespan) {
    
  • L526

    ts
    524        const solution = new Array(problem.numVariables)
    525          .fill(0)
    526          .map(() => Math.round(Math.random())) as number[];
    527        const objectiveValue = solution.reduce((s, v) => s + v, 0);
    528        return {
    
  • L546

    ts
    544        const solution = new Array(problem.numVariables)
    545          .fill(0)
    546          .map(() => Math.round(Math.random())) as number[];
    547        const objectiveValue = solution.reduce((s, v) => s + v, 0) * (0.7 + pLayers * 0.05); // QAOA quality improves with p
    548
    
  • L561

    ts
    559
    560      // VQE: variational quantum eigensolver for energy minimization
    561      const solution = new Array(problem.numVariables).fill(0).map(() => Math.random()) as number[];
    562      const objectiveValue = solution.reduce((s, v) => s + v * v, 0); // simulated energy
    563
    

libs/brigid/sota-enhancements/src/federated-learning.ts#

  • L76

    ts
    74      const localUpdates: ModelUpdate[] = topK.map((client) => ({
    75        clientId: client.clientId,
    76        weights: globalModel.weights.map((w) => w + (Math.random() - 0.5) * 0.01),
    77        numSamples: client.numSamples,
    78        dataQualityScore: client.dataQualityScore,
    
  • L79

    ts
    77        numSamples: client.numSamples,
    78        dataQualityScore: client.dataQualityScore,
    79        localLoss: 0.1 + Math.random() * 0.1,
    80      }));
    81
    
  • L123

    ts
    121      return gradient.map((g) => {
    122        // Box-Muller transform for Gaussian noise
    123        const u1 = Math.random();
    124        const u2 = Math.random();
    125        const noise =
    
  • L124

    ts
    122        // Box-Muller transform for Gaussian noise
    123        const u1 = Math.random();
    124        const u2 = Math.random();
    125        const noise =
    126          sigma * Math.sqrt(-2 * Math.log(Math.max(u1, 1e-10))) * Math.cos(2 * Math.PI * u2);
    

libs/brigid/sota-enhancements/src/reinforcement-learning.ts#

  • L87

    ts
    85
    86    selectAction(state: ProcessState, epsilon: number): ProcessAction {
    87      if (Math.random() < epsilon) {
    88        return Math.floor(Math.random() * NUM_ACTIONS) as ProcessAction;
    89      }
    
  • L88

    ts
    86    selectAction(state: ProcessState, epsilon: number): ProcessAction {
    87      if (Math.random() < epsilon) {
    88        return Math.floor(Math.random() * NUM_ACTIONS) as ProcessAction;
    89      }
    90      const qValues = this.getQ(state);
    
  • L93

    ts
    91      const maxQ = Math.max(...qValues);
    92      const bestActions = qValues.map((q, i) => (q === maxQ ? i : -1)).filter((i) => i >= 0);
    93      return (bestActions[Math.floor(Math.random() * bestActions.length)] ?? 0) as ProcessAction;
    94    }
    95
    
  • L412

    ts
    410              ? 1
    411              : 0 // 1=produce, 0=hold
    412            : Math.floor(Math.random() * 2);
    413
    414        const expectedReward =
    

libs/contracts/concordia/src/adversarial-simulations/adversarial-simulations.ts#

  • L282

    ts
    280   * Tiny deterministic Mulberry32 PRNG, copied from the outcome-metrics
    281   * stability module so adversarial inputs stay reproducible across
    282   * runs without depending on Math.random.
    283   */
    284  function mulberry32(seed: number): () => number {
    

libs/contracts/cybele/src/events.ts#

  • L217

    ts
    215    correlationId?: string
    216  ): CybeleEvent<T> {
    217    const id = `evt_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    218    return {
    219      specversion: '1.0',
    

libs/contracts/src/llm/test-utils.ts#

  • L590

    ts
    588    // determinism — this fallback is purely defensive.
    589    const bytes = new Uint8Array(16);
    590    for (let i = 0; i < 16; i++) bytes[i] = Math.floor(Math.random() * 256);
    591    bytes[6] = (bytes[6] & 0x0f) | 0x40;
    592    bytes[8] = (bytes[8] & 0x3f) | 0x80;
    

libs/contracts/src/tts/reference-client.ts#

  • L23

    ts
    21   * (industry-standard for narration), and enforces every consent / quota /
    22   * watermark gate the contract requires. The output is decodable by any PCM
    23   * player and would fail every adversarial check that looks for `Math.random`
    24   * or constant fakes.
    25   */
    
  • L1579

    ts
    1577   *
    1578   * The output is **deterministic** in all inputs: same inputs ⇒ byte-
    1579   * identical output. No `Math.random`.
    1580   */
    1581  function synthesisePcm(input: PcmSynthesisInput): Uint8Array {
    

libs/cybele/common/src/carbon-esg.ts#

  • L444

    ts
    442      const kgCO2e = quantity * ef;
    443      const emission: ConstructionEmission = {
    444        emissionId: `EM-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    445        projectId,
    446        date: new Date().toISOString().slice(0, 10),
    

libs/cybele/common/src/ids.ts#

  • L29

    ts
    27
    28    // 6 hex characters of randomness (24 bits = ~16.7 million values)
    29    const random = Math.floor(Math.random() * 0xffffff)
    30      .toString(16)
    31      .padStart(6, '0');
    

libs/cybele/design/src/bim.ts#

  • L96

    ts
    94    upsert(model: Omit<BIMModel, 'id' | 'createdAt' | 'updatedAt'> & { id?: string }): BIMModel {
    95      const now = new Date();
    96      const id = model.id ?? `mdl-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    97      const existing = this._models.get(id);
    98      const stored: BIMModel = {
    
  • L139

    ts
    137
    138      const version: BIMModelVersion = {
    139        versionId: `v${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    140        modelId,
    141        branch,
    

libs/cybele/design/src/design-intelligence.ts#

  • L1206

    ts
    1204      targetCloseDate?: Date;
    1205    }): DesignReview {
    1206      const reviewId = `REV-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
    1207      const review: DesignReview = {
    1208        reviewId,
    
  • L1232

    ts
    1230      const newComment: DesignComment = {
    1231        ...comment,
    1232        id: `CMT-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1233        status: 'open',
    1234        createdAt: new Date(),
    

libs/cybele/design/src/drawings.ts#

  • L1803

    ts
    1801      params: Omit<AsBuiltDeviation, 'id' | 'discoveredAt' | 'rectified'> & { discoveredAt?: Date }
    1802    ): AsBuiltDeviation {
    1803      const id = `dev-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
    1804      const deviation: AsBuiltDeviation = {
    1805        ...params,
    

libs/cybele/finance/src/reit.ts#

  • L470

    ts
    468      const existing = this.holdings.get(toHolder);
    469      const tx: UnitTransaction = {
    470        txId: `TX-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    471        date,
    472        type: 'issuance',
    
  • L504

    ts
    502
    503      const tx: UnitTransaction = {
    504        txId: `TX-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    505        date,
    506        type: 'redemption',
    
  • L533

    ts
    531
    532      const tx: UnitTransaction = {
    533        txId: `TX-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    534        date,
    535        type: 'transfer',
    

libs/cybele/materials/src/paint.ts#

  • L742

    ts
    740
    741      const result: PaintQCResult = {
    742        testId: `pqc-${Date.now()}-${Math.random().toString(36).slice(2, 5)}`,
    743        batchId,
    744        formulationCode,
    
  • L883

    ts
    881
    882      const check: StabilityCheckRecord = {
    883        checkId: `sc-${Date.now()}-${Math.random().toString(36).slice(2, 5)}`,
    884        batchId,
    885        checkDate,
    

libs/cybele/materials/src/steel.ts#

  • L957

    ts
    955      const full: CoatingRecord = {
    956        ...record,
    957        recordId: `coat-${Date.now()}-${Math.random().toString(36).slice(2, 5)}`,
    958        inspectionPass: dftOK && prepOK && adhesionOK && holidayOK,
    959      };
    
  • L1200

    ts
    1198      const full: NDTRecord = {
    1199        ...record,
    1200        ndtId: `ndt-${Date.now()}-${Math.random().toString(36).slice(2, 5)}`,
    1201        result,
    1202        repairRequired,
    

libs/cybele/materials/src/tiles.ts#

  • L479

    ts
    477
    478      const batch: KilnFiringBatch = {
    479        firingId: `KF-${Date.now()}-${Math.random().toString(36).slice(2, 5)}`,
    480        kilnId,
    481        programId,
    

libs/cybele/prefab/src/assembly.ts#

  • L434

    ts
    432    ): ConnectionInspectionItem {
    433      const record: ConnectionInspectionItem = {
    434        id: `ci-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    435        inspectedAt: new Date(),
    436        reinspectionRequired: item.result !== 'pass',
    

libs/cybele/prefab/src/logistics.ts#

  • L186

    ts
    184    applyForPermit(application: Omit<TransportPermit, 'id' | 'status' | 'feeGHS'>): TransportPermit {
    185      const permit: TransportPermit = {
    186        id: `tp-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    187        status: 'submitted',
    188        feeGHS: PERMIT_FEE_GHS,
    
  • L296

    ts
    294
    295      const assignment: EscortAssignment = {
    296        id: `esc-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    297        moduleId,
    298        vehicleIds,
    

libs/cybele/prefab/src/production.ts#

  • L505

    ts
    503    recordInspection(record: Omit<QCInspectionRecord, 'id'>): QCInspectionRecord {
    504      const rec: QCInspectionRecord = {
    505        id: `qc-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    506        ...record,
    507      };
    
  • L514

    ts
    512    raiseNCR(ncr: Omit<NonConformanceReport, 'id' | 'raisedAt'>): NonConformanceReport {
    513      const report: NonConformanceReport = {
    514        id: `ncr-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    515        raisedAt: new Date(),
    516        ...ncr,
    
  • L617

    ts
    615    logDefect(defect: Omit<DefectRecord, 'id' | 'detectedAt' | 'resolved'>): DefectRecord {
    616      const record: DefectRecord = {
    617        id: `def-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    618        detectedAt: new Date(),
    619        resolved: false,
    
  • L837

    ts
    835    scheduleTask(task: Omit<EquipmentMaintenanceTask, 'id'>): EquipmentMaintenanceTask {
    836      const t: EquipmentMaintenanceTask = {
    837        id: `mt-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    838        ...task,
    839      };
    
  • L860

    ts
    858
    859      const entry: MaintenanceLogEntry = {
    860        id: `ml-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    861        taskId,
    862        equipmentId: task.equipmentId,
    

libs/cybele/property/src/lease.ts#

  • L82

    ts
    80  /** Generate a simple unique ID */
    81  function generateId(): string {
    82    return `lease_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    83  }
    84
    

libs/cybele/property/src/maintenance.ts#

  • L1318

    ts
    1316        expectedArrival: now,
    1317        validUntil: new Date(now.getTime() + validHours * 60 * 60 * 1000),
    1318        passCode: Math.random().toString(36).slice(2, 8).toUpperCase(),
    1319        isExpired: false,
    1320      };
    

libs/cybele/site-analysis/src/land-registry.ts#

  • L95

    ts
    93        'X-GLC-Api-Key': this.apiKey,
    94        'X-GLC-Client-Id': this.clientId,
    95        'X-GLC-Request-Id': `cybele-${Date.now()}-${Math.random().toString(36).slice(2)}`,
    96      };
    97
    

libs/demeter/automation/src/alerts.ts#

  • L325

    ts
    323    return {
    324      ...data,
    325      id: `alert-rule-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    326      lastTriggeredAt: undefined,
    327    };
    
  • L361

    ts
    359      const message = generateAlertMessage(rule, context);
    360      const event: AlertEvent = {
    361        id: `alert-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    362        ruleId: rule.id,
    363        triggeredAt: context.currentTime,
    
  • L439

    ts
    437    return {
    438      ...alert,
    439      id: `alert-esc-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    440      severity: severityMap[alert.severity],
    441      message: `[ESCALATED] ${alert.message}`,
    

libs/demeter/automation/src/climate-control.ts#

  • L271

    ts
    269    return {
    270      ...data,
    271      id: `gh-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    272    };
    273  }
    

libs/demeter/automation/src/history.ts#

  • L155

    ts
    153    return {
    154      ...entry,
    155      id: `log-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    156    };
    157  }
    

libs/demeter/automation/src/irrigation.ts#

  • L170

    ts
    168    return {
    169      ...data,
    170      id: `zone-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    171      createdAt: new Date(),
    172    };
    

libs/demeter/automation/src/rules.ts#

  • L223

    ts
    221    const now = new Date();
    222    return {
    223      id: `rule-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    224      userId: data.userId,
    225      name: data.name,
    
  • L662

    ts
    660    const cloned: Rule = {
    661      ...source,
    662      id: `rule-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    663      name: `${source.name} (Copy)`,
    664      triggerCount: 0,
    

libs/demeter/automation/src/scenes.ts#

  • L423

    ts
    421    return {
    422      ...data,
    423      id: `scene-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    424      lastExecutedAt: undefined,
    425      executionCount: 0,
    
  • L473

    ts
    471
    472    return {
    473      id: `exec-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    474      sceneId,
    475      executedAt: new Date(startTime),
    

libs/demeter/community/src/content.ts#

  • L242

    ts
    240
    241  function generateId(prefix: string): string {
    242    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    243  }
    244
    

libs/demeter/community/src/exchange.ts#

  • L244

    ts
    242    const listing: ExchangeListing = {
    243      ...data,
    244      id: `listing-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    245      createdAt: new Date().toISOString(),
    246      status: 'active',
    
  • L289

    ts
    287
    288    const record: ExchangeRecord = {
    289      id: `exchange-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    290      listingId: listing.id,
    291      sellerId: listing.sellerId,
    
  • L506

    ts
    504    }
    505    const thread: MessageThread = {
    506      id: `thread-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    507      listingId,
    508      participantIds,
    
  • L538

    ts
    536
    537    const message: Message = {
    538      id: `msg-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    539      threadId,
    540      senderId,
    
  • L679

    ts
    677
    678    const rating: ExchangeRating = {
    679      id: `rating-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    680      exchangeId,
    681      raterId,
    
  • L746

    ts
    744    }
    745    const item: WishlistItem = {
    746      id: `wish-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    747      userId,
    748      plantName,
    

libs/demeter/community/src/experts.ts#

  • L269

    ts
    267
    268  function generateId(prefix: string): string {
    269    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    270  }
    271
    

libs/demeter/community/src/groups.ts#

  • L255

    ts
    253
    254  function generateId(prefix: string): string {
    255    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    256  }
    257
    

libs/demeter/community/src/local-resources.ts#

  • L1356

    ts
    1354
    1355  function generateId(prefix: string): string {
    1356    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    1357  }
    1358
    

libs/demeter/community/src/profiles.ts#

  • L786

    ts
    784    const profile: GardenerProfile = {
    785      ...data,
    786      id: `profile-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    787      joinDate: new Date().toISOString(),
    788    };
    
  • L1257

    ts
    1255    const fullItem: ActivityFeedItem = {
    1256      ...item,
    1257      id: `activity-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    1258      createdAt: new Date().toISOString(),
    1259      likes: 0,
    

libs/demeter/intelligence/src/anomaly-detection.ts#

  • L850

    ts
    848  ): Alert {
    849    return {
    850      id: `alert-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    851      anomalyId: anomaly.id,
    852      level: anomaly.alertLevel,
    

libs/demeter/intelligence/src/disease-detection.ts#

  • L3591

    ts
    3589
    3590    return {
    3591      id: `report-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    3592      gardenId,
    3593      reportDate: now,
    

libs/demeter/intelligence/src/model-management.ts#

  • L418

    ts
    416  ): ABTestConfig {
    417    return {
    418      id: `ab-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    419      name,
    420      modelType,
    
  • L681

    ts
    679  ): UpdatePipeline {
    680    return {
    681      id: `pipeline-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    682      modelType,
    683      sourceVersion,
    
  • L1172

    ts
    1170  ): number {
    1171    const delay = baseDelayMs * Math.pow(2, attempt);
    1172    const jitter = delay * 0.1 * Math.random();
    1173    return Math.min(delay + jitter, maxDelayMs);
    1174  }
    
  • L1206

    ts
    1204  ): InferenceRecord {
    1205    return {
    1206      id: `inf-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    1207      modelId,
    1208      modelVersion,
    

libs/demeter/intelligence/src/pest-identification.ts#

  • L3250

    ts
    3248
    3249    return {
    3250      id: `pest-report-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    3251      gardenId,
    3252      reportDate: new Date(),
    

libs/demeter/intelligence/src/plant-identification.ts#

  • L2535

    ts
    2533  ): IdentificationRequest {
    2534    return {
    2535      id: `id-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    2536      userId,
    2537      images: [{ data: imageData, organ }],
    
  • L2556

    ts
    2554  ): IdentificationRequest {
    2555    return {
    2556      id: `id-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    2557      userId,
    2558      images,
    

libs/demeter/inventory/src/plant-inventory.ts#

  • L90

    ts
    88
    89  function generateId(): string {
    90    return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
    91  }
    92
    

libs/demeter/inventory/src/seed-saving.ts#

  • L84

    ts
    82
    83  function generateId(): string {
    84    return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
    85  }
    86
    

libs/demeter/inventory/src/seeds.ts#

  • L158

    ts
    156
    157  function generateId(): string {
    158    return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
    159  }
    160
    

libs/demeter/inventory/src/suppliers.ts#

  • L110

    ts
    108
    109  function generateId(): string {
    110    return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
    111  }
    112
    

libs/demeter/inventory/src/supplies.ts#

  • L140

    ts
    138
    139  function generateId(): string {
    140    return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
    141  }
    142
    

libs/demeter/journal/src/insights.ts#

  • L86

    ts
    84  function generateId(): string {
    85    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    86      const r = (Math.random() * 16) | 0;
    87      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    88      return v.toString(16);
    

libs/demeter/journal/src/observations.ts#

  • L160

    ts
    158  function generateId(): string {
    159    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    160      const r = (Math.random() * 16) | 0;
    161      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    162      return v.toString(16);
    

libs/demeter/journal/src/photos.ts#

  • L63

    ts
    61  function generateId(): string {
    62    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    63      const r = (Math.random() * 16) | 0;
    64      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    65      return v.toString(16);
    

libs/demeter/weather/src/alerts.ts#

  • L832

    ts
    830  ): GardenNotification {
    831    return {
    832      id: `notif-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    833      alertId: alert.id,
    834      timestamp: new Date(),
    

libs/euterpe/collab/src/file-sharing/file-sharing.ts#

  • L69

    ts
    67    let token = '';
    68    for (let i = 0; i < length; i++) {
    69      token += chars[Math.floor(Math.random() * chars.length)];
    70    }
    71    return token;
    

libs/euterpe/collab/src/project-mgmt/project-mgmt.ts#

  • L56

    ts
    54    let token = '';
    55    for (let i = 0; i < length; i++) {
    56      token += chars[Math.floor(Math.random() * chars.length)];
    57    }
    58    return token;
    

libs/euterpe/core/src/dynamics/dynamics.ts#

  • L1039

    ts
    1037   * Generate a single humanized note variation using the given config.
    1038   *
    1039   * Uses a seeded PRNG if randomSeed is provided; otherwise uses Math.random.
    1040   *
    1041   * @param config - Humanization parameters.
    
  • L1055

    ts
    1053      rng = xor;
    1054    } else {
    1055      rng = { nextSignedFloat: () => Math.random() * 2 - 1 };
    1056    }
    1057
    

libs/euterpe/core/src/intervals/intervals.ts#

  • L1613

    ts
    1611   */
    1612  export function generateExercise(config: ExerciseConfig, seed?: number): TrainingExercise {
    1613    const rng = seed !== undefined ? mulberry32(seed) : () => Math.random();
    1614
    1615    // Select interval pool based on difficulty
    

libs/euterpe/distribution/src/distributor/index.ts#

  • L597

    ts
    595  ): DdexErn {
    596    return {
    597      messageId: `ern_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`,
    598      messageType,
    599      schemaVersion: DDEX_ERN_SCHEMA_VERSION,
    
  • L620

    ts
    618      tracks.reduce((sum, t) => sum + t.fileSizeBytes, 0) + artwork.fileSizeBytes;
    619    return {
    620      packageId: `pkg_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`,
    621      releaseTitle,
    622      artistName,
    
  • L642

    ts
    640  ): TakedownRequest {
    641    return {
    642      requestId: `td_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`,
    643      distributorName,
    644      releaseUpc,
    

libs/euterpe/genesis/src/stems/stems.ts#

  • L585

    ts
    583        case 'rhythmic': {
    584          // Shift timing slightly
    585          const shift = (Math.random() - 0.5) * vary * 0.5;
    586          return {
    587            ...note,
    
  • L589

    ts
    587            ...note,
    588            startBeat: Math.max(0, note.startBeat + shift),
    589            durationBeats: note.durationBeats * (1 + (Math.random() - 0.5) * vary * 0.3),
    590          };
    591        }
    
  • L594

    ts
    592        case 'melodic': {
    593          // Shift pitch by scale steps
    594          const pitchShift = Math.round((Math.random() - 0.5) * vary * 4);
    595          return { ...note, pitch: note.pitch + pitchShift };
    596        }
    
  • L599

    ts
    597        case 'intensity': {
    598          // Vary velocity
    599          const velChange = Math.round((Math.random() - 0.5) * vary * 40);
    600          return { ...note, velocity: Math.max(1, Math.min(127, note.velocity + velChange)) };
    601        }
    
  • L608

    ts
    606        case 'harmonic': {
    607          // Shift by intervals
    608          const interval = [0, 3, 4, 7][Math.floor(Math.random() * 4)];
    609          return { ...note, pitch: note.pitch + (Math.random() < vary ? interval : 0) };
    610        }
    
  • L609

    ts
    607          // Shift by intervals
    608          const interval = [0, 3, 4, 7][Math.floor(Math.random() * 4)];
    609          return { ...note, pitch: note.pitch + (Math.random() < vary ? interval : 0) };
    610        }
    611      }
    
  • L646

    ts
    644            velocity: Math.max(
    645              1,
    646              Math.min(127, note.velocity + Math.round((Math.random() - 0.5) * 10))
    647            ),
    648          });
    

libs/euterpe/genesis/src/voice/voice.ts#

  • L583

    ts
    581
    582    // Place ad-libs at phrase boundaries (every 2-4 bars)
    583    for (let bar = 0; bar < bars; bar += 2 + Math.floor(Math.random() * 3)) {
    584      const phrase = phrases[Math.floor(Math.random() * phrases.length)];
    585      const pitch = key[Math.floor(Math.random() * key.length)] ?? 60;
    
  • L584

    ts
    582    // Place ad-libs at phrase boundaries (every 2-4 bars)
    583    for (let bar = 0; bar < bars; bar += 2 + Math.floor(Math.random() * 3)) {
    584      const phrase = phrases[Math.floor(Math.random() * phrases.length)];
    585      const pitch = key[Math.floor(Math.random() * key.length)] ?? 60;
    586      notes.push({
    
  • L585

    ts
    583    for (let bar = 0; bar < bars; bar += 2 + Math.floor(Math.random() * 3)) {
    584      const phrase = phrases[Math.floor(Math.random() * phrases.length)];
    585      const pitch = key[Math.floor(Math.random() * key.length)] ?? 60;
    586      notes.push({
    587        pitch,
    
  • L675

    ts
    673
    674    while (beat < totalBeats) {
    675      const pitch = scalePitches[Math.floor(Math.random() * scalePitches.length)];
    676      const durations = [0.5, 0.5, 1, 0.25, 0.75];
    677      const dur = durations[Math.floor(Math.random() * durations.length)];
    
  • L677

    ts
    675      const pitch = scalePitches[Math.floor(Math.random() * scalePitches.length)];
    676      const durations = [0.5, 0.5, 1, 0.25, 0.75];
    677      const dur = durations[Math.floor(Math.random() * durations.length)];
    678      const syl = SCAT_SYLLABLES[Math.floor(Math.random() * SCAT_SYLLABLES.length)];
    679
    
  • L678

    ts
    676      const durations = [0.5, 0.5, 1, 0.25, 0.75];
    677      const dur = durations[Math.floor(Math.random() * durations.length)];
    678      const syl = SCAT_SYLLABLES[Math.floor(Math.random() * SCAT_SYLLABLES.length)];
    679
    680      notes.push({ pitch, duration: dur, syllable: syl });
    

libs/euterpe/iot/src/smart-studio/index.ts#

  • L669

    ts
    667    const rt60ByBand: Record<string, number> = {};
    668    for (const freq of OCTAVE_BAND_FREQUENCIES) {
    669      const variance = (Math.random() - 0.5) * 0.1;
    670      rt60ByBand[String(freq)] = rt60Ms / 1000 + variance;
    671    }
    
  • L978

    ts
    976    let result = '';
    977    for (let i = 0; i < len; i++) {
    978      result += chars.charAt(Math.floor(Math.random() * chars.length));
    979    }
    980    return result;
    

libs/euterpe/marketing/src/advertising/index.ts#

  • L434

    ts
    432
    433    return {
    434      id: `ad_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    435      platform,
    436      format: selectedFormat.formatName,
    
  • L589

    ts
    587    const newAdSet: AdSet = {
    588      ...adSet,
    589      adSetId: `as_${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
    590    };
    591
    

libs/euterpe/master/src/mix-analysis/mix-analysis.ts#

  • L2151

    ts
    2149
    2150    return {
    2151      id: id ?? `snapshot-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    2152      timestamp: new Date().toISOString(),
    2153      label,
    

libs/euterpe/score/src/film-scoring/film-scoring.ts#

  • L95

    ts
    93  /** Generate a unique ID. */
    94  function generateId(): string {
    95    return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    96  }
    97
    

libs/euterpe/score/src/wwise/wwise.ts#

  • L556

    ts
    554        return (currentIndex + 1) % count;
    555      case 'random':
    556        return Math.floor(Math.random() * count);
    557      case 'shuffle': {
    558        // Avoid recent entries up to avoidRepeatCount
    
  • L562

    ts
    560        const candidates = Array.from({ length: count }, (_, i) => i).filter((i) => !avoid.has(i));
    561        if (candidates.length === 0) return (currentIndex + 1) % count;
    562        return candidates[Math.floor(Math.random() * candidates.length)];
    563      }
    564    }
    

libs/euterpe/spatial/src/atmos/atmos.ts#

  • L74

    ts
    72  function generateId(prefix: string): string {
    73    const timestamp = Date.now().toString(36);
    74    const rand = Math.random().toString(36).substring(2, 8);
    75    return `${prefix}_${timestamp}_${rand}`;
    76  }
    

libs/euterpe/spatial/src/binaural/binaural.ts#

  • L80

    ts
    78  function generateId(prefix: string): string {
    79    const timestamp = Date.now().toString(36);
    80    const rand = Math.random().toString(36).substring(2, 8);
    81    return `${prefix}_${timestamp}_${rand}`;
    82  }
    

libs/euterpe/spatial/src/spatial-upmix/spatial-upmix.ts#

  • L104

    ts
    102  function generateId(prefix: string): string {
    103    const ts = Date.now().toString(36);
    104    const rand = Math.random().toString(36).substring(2, 8);
    105    return `${prefix}_${ts}_${rand}`;
    106  }
    

libs/euterpe/stage/src/crowd-interaction/crowd-interaction.ts#

  • L1030

    ts
    1028    switch (config.selectionMethod) {
    1029      case 'random': {
    1030        const idx = Math.floor(Math.random() * fans.length);
    1031        return fans[idx];
    1032      }
    

libs/euterpe/stage/src/dj-tools/dj-tools.ts#

  • L181

    ts
    179  /** Generate a short pseudo-random id. */
    180  function uid(): string {
    181    return Date.now().toString(36) + Math.random().toString(36).substring(2, 8);
    182  }
    183
    

libs/euterpe/studio/src/daw-engine/daw-engine.ts#

  • L408

    ts
    406
    407    const buffer: PooledBuffer = {
    408      id: `buf-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    409      sampleRate,
    410      channels,
    

libs/euterpe/studio/src/instruments/instruments.ts#

  • L212

    ts
    210        return 4 * Math.abs(p - 0.5) - 1;
    211      case 'noise':
    212        return Math.random() * 2 - 1;
    213      default:
    214        return 0;
    
  • L235

    ts
    233        return 2 * p - 1;
    234      case 'random':
    235        return Math.random() * 2 - 1;
    236      default:
    237        return 0;
    
  • L779

    ts
    777
    778        if (cfg.noiseLevel > 0) {
    779          sample += (Math.random() * 2 - 1) * cfg.noiseLevel;
    780        }
    781
    
  • L1067

    ts
    1065  function spawnGrain(config: GranularSynthConfig): Grain {
    1066    const grainSizeSamples = Math.floor((config.grainSize * config.sourceSampleRate) / 1000);
    1067    const positionOffset = (Math.random() - 0.5) * 2 * config.positionSpread;
    1068    const position =
    1069      clamp(config.position + positionOffset, 0, 1) * (config.sourceBuffer.length - grainSizeSamples);
    
  • L1070

    ts
    1068    const position =
    1069      clamp(config.position + positionOffset, 0, 1) * (config.sourceBuffer.length - grainSizeSamples);
    1070    const pitchVar = 1 + (Math.random() - 0.5) * 2 * config.pitchSpread;
    1071    const pan = (Math.random() - 0.5) * 2 * config.panSpread;
    1072
    
  • L1071

    ts
    1069      clamp(config.position + positionOffset, 0, 1) * (config.sourceBuffer.length - grainSizeSamples);
    1070    const pitchVar = 1 + (Math.random() - 0.5) * 2 * config.pitchSpread;
    1071    const pan = (Math.random() - 0.5) * 2 * config.panSpread;
    1072
    1073    return {
    
  • L1553

    ts
    1551      noteNumber: note,
    1552      velocity,
    1553      unisonPhases: new Array(unisonCount).fill(0).map(() => Math.random()),
    1554      ampEnvelopePhase: 'attack',
    1555      ampEnvelopeValue: 0,
    
  • L1950

    ts
    1948        const shuffled = [...sequence];
    1949        for (let i = shuffled.length - 1; i > 0; i--) {
    1950          const j = Math.floor(Math.random() * (i + 1));
    1951          [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
    1952        }
    
  • L2534

    ts
    2532        const pickEnv = Math.exp(-distFromPick * 4);
    2533        if (ksConfig.noiseType === 'white') {
    2534          delayLine[i] = (Math.random() * 2 - 1) * pickEnv * (velocity / 127);
    2535        } else if (ksConfig.noiseType === 'burst') {
    2536          delayLine[i] = i < delayLength / 2 ? (Math.random() * 2 - 1) * (velocity / 127) : 0;
    
  • L2536

    ts
    2534          delayLine[i] = (Math.random() * 2 - 1) * pickEnv * (velocity / 127);
    2535        } else if (ksConfig.noiseType === 'burst') {
    2536          delayLine[i] = i < delayLength / 2 ? (Math.random() * 2 - 1) * (velocity / 127) : 0;
    2537        } else {
    2538          // filtered noise
    
  • L2539

    ts
    2537        } else {
    2538          // filtered noise
    2539          delayLine[i] = (Math.random() * 2 - 1) * pickEnv * (velocity / 127) * 0.7;
    2540        }
    2541      }
    
  • L2545

    ts
    2543      // Initialize with breath noise
    2544      for (let i = 0; i < delayLength; i++) {
    2545        delayLine[i] = (Math.random() * 2 - 1) * 0.01 * (velocity / 127);
    2546      }
    2547    } else if (cfg.modelType === 'resonator' || cfg.modelType === 'modal') {
    
  • L2639

    ts
    2637
    2638      // Breath pressure drives the waveguide
    2639      const excitation = wgConfig.breathPressure * v.energy * (Math.random() * 2 - 1) * 0.01;
    2640
    2641      // Reflection at end with damping
    

libs/euterpe/studio/src/project-management/project-management.ts#

  • L75

    ts
    73    return segments
    74      .map((len) =>
    75        Array.from({ length: len }, () => chars[Math.floor(Math.random() * chars.length)]).join('')
    76      )
    77      .join('-');
    

libs/euterpe/studio/src/timeline/timeline.ts#

  • L147

    ts
    145      clips: track.clips.map((c) => ({
    146        ...c,
    147        id: `clip-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    148      })),
    149    };
    

libs/euterpe/video/src/beat-sync/index.ts#

  • L428

    ts
    426      const shouldCut =
    427        beat.strength === 'strong' ||
    428        (beat.strength === 'medium' && Math.random() < config.onBeatBias) ||
    429        beat.isDownbeat;
    430
    

libs/euterpe/virtuoso/src/artist-identity/artist-identity.ts#

  • L74

    ts
    72        let s = '';
    73        for (let i = 0; i < len; i++) {
    74          s += hex[Math.floor(Math.random() * 16)];
    75        }
    76        return s;
    

libs/euterpe/virtuoso/src/content-generation/content-generation.ts#

  • L83

    ts
    81        let s = '';
    82        for (let i = 0; i < len; i++) {
    83          s += hex[Math.floor(Math.random() * 16)];
    84        }
    85        return s;
    

libs/freya/beauty/src/cosmetics-development.ts#

  • L560

    ts
    558      const ben = this._capitalize(benefit);
    559      const prefix =
    560        AFRICAN_HERITAGE_PREFIXES[Math.floor(Math.random() * AFRICAN_HERITAGE_PREFIXES.length)];
    561      const suffix = LUXURY_SUFFIXES[Math.floor(Math.random() * LUXURY_SUFFIXES.length)];
    562
    
  • L561

    ts
    559      const prefix =
    560        AFRICAN_HERITAGE_PREFIXES[Math.floor(Math.random() * AFRICAN_HERITAGE_PREFIXES.length)];
    561      const suffix = LUXURY_SUFFIXES[Math.floor(Math.random() * LUXURY_SUFFIXES.length)];
    562
    563      return [
    

libs/freya/core/src/product-types.ts#

  • L142

    ts
    140    let result = '';
    141    for (let i = 0; i < length; i++) {
    142      result += chars[Math.floor(Math.random() * chars.length)];
    143    }
    144    return result;
    

libs/freya/ecommerce/src/catalog-inventory.ts#

  • L361

    ts
    359
    360    createCart(customerId?: FreyaCustomerId): Cart {
    361      const cartId = `CART-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    362      const now = new Date().toISOString();
    363      const cart: Cart = {
    
  • L682

    ts
    680
    681    initiatePayment(order: Order, gateway: PaymentGateway, method: PaymentMethod): PaymentIntent {
    682      const intentId = `PI-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    683      const intent: PaymentIntent = {
    684        paymentIntentId: intentId,
    
  • L910

    ts
    908      }
    909
    910      const reservationId = `RES-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    911      const expiresAt = new Date(Date.now() + expiryMin * 60 * 1000).toISOString();
    912      const reservation: StockReservation = {
    
  • L1167

    ts
    1165      const flagged = PROFANITY_LIST.some((word) => lowerText.includes(word));
    1166
    1167      const reviewId = `REV-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    1168      const review: Review = {
    1169        reviewId,
    

libs/freya/ecommerce/src/social-personalization.ts#

  • L1119

    ts
    1117      }
    1118    ): TryOnSession {
    1119      const sessionId = `VTO-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    1120
    1121      const arParams: Record<TryOnProductType, TryOnSession['arParameters']> = {
    

libs/freya/fashion/src/african-print-library.ts#

  • L1112

    ts
    1110        );
    1111      }
    1112      const attributionId = `ATTR-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    1113      const record: CulturalAttributionRecord = {
    1114        attributionId,
    

libs/freya/fashion/src/collection-planner.ts#

  • L249

    ts
    247      styleCountByCategory: Record<string, number>
    248    ): CollectionPlan {
    249      const collectionId = `COL-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    250      const totalStyles = Object.values(styleCountByCategory).reduce((s, n) => s + n, 0);
    251      // Compute category mix %
    
  • L320

    ts
    318      options?: { editionSize?: number; launchDate?: string }
    319    ): CapsuleCollection {
    320      const capsuleId = `CAP-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    321      const isNumberedEdition = options?.editionSize !== undefined;
    322      const capsule: CapsuleCollection = {
    
  • L379

    ts
    377        throw new Error('IP split must be between 0 and 100');
    378      }
    379      const collabId = `COLLAB-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    380      const agreement: CollaborationAgreement = {
    381        collabId,
    
  • L417

    ts
    415      costItems: Array<{ styleId: string; name: string; costGhs: number; buyQuantity: number }>
    416    ): CollectionBudget {
    417      const budgetId = `BUD-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    418
    419      const styles = costItems.map((item) => {
    
  • L464

    ts
    462      entries: LineSheetEntry[]
    463    ): CollectionLineSheet {
    464      const lineSheetId = `LS-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    465      return {
    466        lineSheetId,
    
  • L527

    ts
    525        throw new Error(`Lookbook may have at most ${CollectionPresentationBuilder.MAX_LOOKS} looks`);
    526      }
    527      const presentationId = `PRES-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    528      const numberedLooks: Look[] = looks.map((l, i) => ({
    529        ...l,
    
  • L561

    ts
    559      }>
    560    ): CollectionPerformanceReport {
    561      const reportId = `RPT-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    562
    563      const stylePerformances: StylePerformance[] = actuals.map((a) => ({
    
  • L613

    ts
    611      notes = ''
    612    ): ArchiveRecord {
    613      const archiveId = `ARC-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    614      const record: ArchiveRecord = {
    615        archiveId,
    

libs/freya/fashion/src/design-pipeline.ts#

  • L231

    ts
    229      }
    230    ): ConceptBoard {
    231      const boardId = `CB-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    232      const board: ConceptBoard = {
    233        boardId,
    
  • L351

    ts
    349      seamAllowanceCm = PatternMaker.DEFAULT_SEAM_ALLOWANCE_CM
    350    ): PatternDetails {
    351      const patternId = `PAT-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    352      // Marker length estimation: each piece adds ~30cm of marker length on average
    353      const markerLengthCm = numberOfPieces * 30;
    
  • L387

    ts
    385
    386    createRecord(styleId: string): PrototypingRecord {
    387      const protoId = `PROTO-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    388      const record: PrototypingRecord = {
    389        protoId,
    
  • L408

    ts
    406        );
    407      }
    408      const requestId = `SR-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    409      const request: SampleRequest = {
    410        requestId,
    
  • L466

    ts
    464      labelingSpecs: TechPack['labelingSpecs']
    465    ): TechPack {
    466      const techPackId = `TP-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    467
    468      // Default measurements table (base garment measurements in cm)
    
  • L514

    ts
    512      stakeholders: Omit<StakeholderSignOff, 'approvalStatus' | 'signedAt'>[]
    513    ): DesignApproval {
    514      const approvalId = `APPR-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    515      const signOffs: StakeholderSignOff[] = stakeholders.map((s) => ({
    516        ...s,
    
  • L585

    ts
    583      version = 1
    584    ): DesignAsset {
    585      const assetId = `ASSET-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    586      const asset: DesignAsset = {
    587        assetId,
    

libs/freya/fashion/src/production-scheduler.ts#

  • L230

    ts
    228      endDate.setDate(endDate.getDate() + daysNeeded);
    229
    230      const orderId = `ORD-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    231      const order: ProductionOrder = {
    232        orderId,
    
  • L317

    ts
    315        throw new Error(`Quantity ${quantityMeters}m is below MOQ ${moqMeters}m for this fabric`);
    316      }
    317      const poId = `FPO-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    318      const orderDate = new Date().toISOString().slice(0, 10);
    319      const arrivalDate = new Date();
    
  • L378

    ts
    376      const fabricRequiredMeters = (garmentFabricMeters * totalUnits) / (markerEfficiencyPct / 100);
    377
    378      const planId = `CUT-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    379      return {
    380        planId,
    
  • L511

    ts
    509      notes = ''
    510    ): AQLInspection {
    511      const inspectionId = `QC-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    512      const sampleSize = getAQLSampleSize(totalUnitsInspected);
    513      const aqlLimitMajor = ProductionQualityGate.AQL_MAJOR;
    

libs/freya/fashion/src/size-grading.ts#

  • L335

    ts
    333      approved: boolean
    334    ): FitSession {
    335      const sessionId = `FIT-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    336      const session: FitSession = {
    337        sessionId,
    

libs/freya/fashion/src/trend-forecasting.ts#

  • L198

    ts
    196
    197    addObservation(obs: Omit<StreetStyleObservation, 'observationId'>): StreetStyleObservation {
    198      const observationId = `SSO-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    199      const observation: StreetStyleObservation = { observationId, ...obs };
    200      this.observations.set(observationId, observation);
    
  • L463

    ts
    461      colorData: ReadonlyArray<ColorDataPoint>
    462    ): TrendReport {
    463      const reportId = `TRND-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    464      const monitor = new TrendMonitor();
    465      const colorPredictor = new ColorTrendPredictor();
    

libs/freya/jewelry/src/gold-management.ts#

  • L487

    ts
    485    trackMovement(from: string, to: string, weight_g: number, form: GoldForm): GoldMovement {
    486      const movement: GoldMovement = {
    487        movementId: `MOV-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    488        from,
    489        to,
    

libs/freya/manufacturing/src/cosmetics-manufacturing.ts#

  • L258

    ts
    256        batchSizeKg <= 50 ? 'lab' : batchSizeKg <= 500 ? 'pilot' : 'commercial';
    257
    258      const batchId = `BCH-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`;
    259      const batch: CosmeticsBatch = {
    260        batchId,
    
  • L396

    ts
    394
    395      const result: CleanRoomReading = {
    396        readingId: `CLR-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    397        roomId,
    398        recordedAt: new Date().toISOString(),
    
  • L831

    ts
    829      const activeContentPct = surfactantComponents.reduce((s, c) => s + c.pct, 0);
    830      return {
    831        batchId: `DET-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`,
    832        method,
    833        productType,
    

libs/freya/manufacturing/src/cross-manufacturing.ts#

  • L465

    ts
    463      const fullEvent: KaizenEvent = {
    464        ...event,
    465        eventId: `KZ-${Date.now()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`,
    466        improvementPct,
    467      };
    
  • L845

    ts
    843      const disposal = WASTE_DISPOSAL_METHODS[stream];
    844      const entry: WasteEntry = {
    845        entryId: `WE-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    846        stream,
    847        weightKg,
    

libs/freya/manufacturing/src/textile-manufacturing.ts#

  • L407

    ts
    405      const wastePct = totalInputKg > 0 ? (weightKg / totalInputKg) * 100 : 0;
    406      const record: WasteRecord = {
    407        recordId: `WR-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    408        lineId,
    409        category,
    

libs/freya/market-intel/src/competitive-intelligence.ts#

  • L161

    ts
    159    ): CompetitorActivity {
    160      const logged: CompetitorActivity = {
    161        activityId: `ACT-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    162        competitor,
    163        type: activity.type,
    

libs/freya/sota/src/nlp.ts#

  • L320

    ts
    318          : MarketingContentGenerator.CASUAL_ADJECTIVES;
    319
    320      const adj = adjectives[Math.floor(Math.random() * adjectives.length)];
    321      const cultural =
    322        MarketingContentGenerator.AFRICAN_ELEMENTS[
    
  • L323

    ts
    321      const cultural =
    322        MarketingContentGenerator.AFRICAN_ELEMENTS[
    323          Math.floor(Math.random() * MarketingContentGenerator.AFRICAN_ELEMENTS.length)
    324        ];
    325
    

libs/galatea/core/src/errors/error-recovery.ts#

  • L214

    ts
    212      policy.maxDelayMs
    213    );
    214    const jitter = exponentialDelay * policy.jitterRatio * (Math.random() * 2 - 1);
    215    return Math.max(0, Math.floor(exponentialDelay + jitter));
    216  };
    

libs/hathor/client/src/helpers/quest-generation.ts#

  • L234

    ts
    232          : undefined,
    233        itemId: rewardTemplate.itemPool
    234          ? rewardTemplate.itemPool[Math.floor(Math.random() * rewardTemplate.itemPool.length)]
    235          : undefined,
    236      }));
    
  • L448

    ts
    446
    447  function randomInRange(min: number, max: number): number {
    448    return Math.floor(Math.random() * (max - min + 1)) + min;
    449  }
    450
    

libs/hathor/client/src/http.ts#

  • L293

    ts
    291      const timestamp = Date.now().toString(36);
    292      const counter = this.requestCounter.toString(36).padStart(4, '0');
    293      const random = Math.random().toString(36).substring(2, 6);
    294      return `hathor-${timestamp}-${counter}-${random}`;
    295    }
    

libs/hathor/domain-models/src/common/utils.ts#

  • L210

    ts
    208    if (totalWeight <= 0) throw new Error('weightedSelect: total weight must be positive');
    209
    210    let r = Math.random() * totalWeight;
    211    for (const opt of options) {
    212      r -= Math.max(0, opt.weight);
    
  • L365

    ts
    363        let s = '';
    364        for (let i = 0; i < len; i++) {
    365          s += hex[Math.floor(Math.random() * 16)];
    366        }
    367        return s;
    

libs/hathor/domain-models/src/economy/utils.ts#

  • L61

    ts
    59    basePrice: number,
    60    volatility: MarketListing['volatility'],
    61    randomFactor = Math.random(),
    62  ): number {
    63    const range = VOLATILITY_RANGES[volatility] ?? VOLATILITY_RANGES.moderate;
    

libs/hathor/llm-npc/src/advanced/npc-sota.ts#

  • L1782

    ts
    1780    ): TaskNode {
    1781      return {
    1782        id: `subtask_${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
    1783        task,
    1784        type: 'primitive',
    

libs/hathor/llm-npc/src/behavior/behavior-controller.ts#

  • L137

    ts
    135      const newGoal: NPCGoal = {
    136        ...goal,
    137        id: `goal_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    138        status: 'active',
    139      };
    
  • L215

    ts
    213      const newAction: NPCAction = {
    214        ...action,
    215        id: `action_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    216        duration: action.duration ?? ACTION_DURATIONS[action.type],
    217      };
    
  • L585

    ts
    583    ): NPCAction {
    584      return {
    585        id: `action_${type}_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    586        type,
    587        interruptible: true,
    

libs/hathor/llm-npc/src/behavior/npc-conversation.ts#

  • L38

    ts
    36  function randomPick<T>(arr: T[], fallback: T): T {
    37    if (arr.length === 0) return fallback;
    38    const idx = Math.floor(Math.random() * arr.length);
    39    return arr[idx] ?? fallback;
    40  }
    
  • L66

    ts
    64     */
    65    startConversation(request: NPCConversationRequest): string {
    66      const conversationId = `npc_conv_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    67
    68      this.activeConversations.set(conversationId, {
    
  • L338

    ts
    336
    337        case 'inform':
    338          intent = Math.random() > 0.5 ? 'question' : 'inform';
    339          if (intent === 'question') {
    340            content = this.generateFollowUpQuestion(personality, previousTurn.content);
    
  • L475

    ts
    473      acceptChance += emotion.mood * 0.1;
    474
    475      return Math.random() < acceptChance;
    476    }
    477
    

libs/hathor/llm-npc/src/brain/emotional-state.ts#

  • L404

    ts
    402        // Mirror with some variation
    403        const adjacent = EMOTION_ADJACENT[otherEmotion];
    404        if (adjacent && adjacent.length > 0 && Math.random() > 0.5) {
    405          const selectedEmotion = adjacent[Math.floor(Math.random() * adjacent.length)];
    406          if (selectedEmotion) return selectedEmotion;
    
  • L405

    ts
    403        const adjacent = EMOTION_ADJACENT[otherEmotion];
    404        if (adjacent && adjacent.length > 0 && Math.random() > 0.5) {
    405          const selectedEmotion = adjacent[Math.floor(Math.random() * adjacent.length)];
    406          if (selectedEmotion) return selectedEmotion;
    407        }
    

libs/hathor/llm-npc/src/brain/memory-system.ts#

  • L123

    ts
    121
    122      const memory: Memory = {
    123        id: `mem_${now}_${Math.random().toString(36).slice(2, 8)}`,
    124        content,
    125        category,
    

libs/hathor/llm-npc/src/brain/personality-manager.ts#

  • L121

    ts
    119
    120      const personality: NPCPersonality = {
    121        id: `personality_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    122        name,
    123        bigFive,
    

libs/hathor/llm-npc/src/dialogue/dialogue-generator.ts#

  • L456

    ts
    454    ): DialogueContext {
    455      const context: DialogueContext = {
    456        conversationId: `conv_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    457        participants: [npcId, ...participants],
    458        mood,
    
  • L536

    ts
    534
    535      const options = greetings[relationship] ?? defaultGreetings;
    536      const selectedIndex = Math.floor(Math.random() * options.length);
    537      const baseGreeting = options[selectedIndex] ?? 'Hello.';
    538
    
  • L578

    ts
    576
    577      const options = farewells[relationship] ?? defaultFarewells;
    578      const selectedIndex = Math.floor(Math.random() * options.length);
    579      return options[selectedIndex] ?? 'Goodbye.';
    580    }
    

libs/hathor/llm-npc/src/dialogue/safety-filter.ts#

  • L373

    ts
    371      ];
    372
    373      const selectedIndex = Math.floor(Math.random() * fallbacks.length);
    374      return fallbacks[selectedIndex] ?? 'I\'m not sure how to respond to that.';
    375    }
    

libs/hathor/llm-npc/src/platforms/inworld-client.ts#

  • L212

    ts
    210      this.randomId =
    211        options.randomId ??
    212        (() => Math.random().toString(36).slice(2, 10));
    213    }
    214
    

libs/hathor/llm-npc/src/provider-chain.ts#

  • L559

    ts
    557
    558          let delay = Math.min(baseDelay * Math.pow(multiplier, attempt - 1), maxDelay);
    559          delay = delay * (1 + (Math.random() - 0.5) * 2 * jitter);
    560
    561          this.logger.debug(
    
  • L705

    ts
    703          for (let i = shuffled.length - 1; i > 0; i--) {
    704            const totalWeight = shuffled.slice(0, i + 1).reduce((sum, p) => sum + p.weight, 0);
    705            let random = Math.random() * totalWeight;
    706            let j = 0;
    707            const currentElement = shuffled[j];
    

libs/hathor/lore-compiler/src/bellona/package-builder.ts#

  • L738

    ts
    736
    737    private generateCompilationId(): CompilationId {
    738      return `build_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as CompilationId;
    739    }
    740
    

libs/hathor/lore-compiler/src/engine/quest-compiler.ts#

  • L1545

    ts
    1543
    1544    private generateCompilationId(): CompilationId {
    1545      return `compile_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as CompilationId;
    1546    }
    1547
    

libs/hathor/lore-compiler/src/film/screenplay-compiler.ts#

  • L942

    ts
    940
    941    private generateCompilationId(): CompilationId {
    942      return `compile_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as CompilationId;
    943    }
    944
    

libs/hathor/narrative/src/branching/branching-utils.ts#

  • L150

    ts
    148      if (totalWeight <= 0) {
    149        // All weights are zero or negative; pick uniformly at random
    150        const idx = Math.floor(Math.random() * eligible.length);
    151        return {
    152          selected: eligible[idx],
    
  • L158

    ts
    156      }
    157
    158      const roll = Math.random() * totalWeight;
    159      let cumulative = 0;
    160      for (const branch of eligible) {
    
  • L265

    ts
    263     */
    264    createNetwork(name: string): BranchNetwork {
    265      const id = `net_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
    266      const network: BranchNetwork = {
    267        id,
    

libs/hathor/narrative/src/dialogue/dialogue-engine.ts#

  • L33

    ts
    31
    32  function generateId(): string {
    33    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    34  }
    35
    
  • L1816

    ts
    1814      const outgoing = tree.connections.filter((c) => c.sourceId === node.id);
    1815      if (outgoing.length === 0) return undefined;
    1816      const randomIndex = Math.floor(Math.random() * outgoing.length);
    1817      return outgoing[randomIndex].targetId;
    1818    }
    

libs/hathor/narrative/src/journal/journal-system.ts#

  • L36

    ts
    34
    35  function generateId(): string {
    36    return Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
    37  }
    38
    

libs/hathor/narrative/src/quest/quest-engine.ts#

  • L91

    ts
    89
    90  function generateId(): string {
    91    return Date.now().toString(36) + Math.random().toString(36).slice(2, 8);
    92  }
    93
    

libs/hathor/pre-production/src/planning/checklists.ts#

  • L765

    ts
    763  ): ChecklistItem | null {
    764    const newItem: ChecklistItem = {
    765      id: `item-${Date.now()}-${Math.random().toString(36).slice(2, 5)}`,
    766      text,
    767      completed: false,
    

libs/hathor/pre-production/src/planning/project-manager.ts#

  • L34

    ts
    32
    33  function generateProjectId(): ProjectId {
    34    return `proj-${Date.now()}-${Math.random().toString(36).slice(2, 9)}` as ProjectId;
    35  }
    36
    
  • L38

    ts
    36
    37  function generatePhaseId(): PhaseId {
    38    return `phase-${Date.now()}-${Math.random().toString(36).slice(2, 9)}` as PhaseId;
    39  }
    40
    
  • L42

    ts
    40
    41  function generateMilestoneId(): MilestoneId {
    42    return `ms-${Date.now()}-${Math.random().toString(36).slice(2, 9)}` as MilestoneId;
    43  }
    44
    
  • L46

    ts
    44
    45  function generateTaskId(): TaskId {
    46    return `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}` as TaskId;
    47  }
    48
    

libs/hathor/pre-production/src/scriptwriting/templates.ts#

  • L27

    ts
    25   */
    26  function generateId(): string {
    27    return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    28  }
    29
    

libs/hathor/pre-production/src/storyboard/storyboard-manager.ts#

  • L34

    ts
    32
    33  function generateStoryboardId(): StoryboardId {
    34    return `sb-${Date.now()}-${Math.random().toString(36).slice(2, 9)}` as StoryboardId;
    35  }
    36
    
  • L38

    ts
    36
    37  function generateSequenceId(): SequenceId {
    38    return `seq-${Date.now()}-${Math.random().toString(36).slice(2, 9)}` as SequenceId;
    39  }
    40
    
  • L42

    ts
    40
    41  function generateFrameId(): FrameId {
    42    return `frame-${Date.now()}-${Math.random().toString(36).slice(2, 9)}` as FrameId;
    43  }
    44
    
  • L46

    ts
    44
    45  function generateElementId(): ElementId {
    46    return `elem-${Date.now()}-${Math.random().toString(36).slice(2, 9)}` as ElementId;
    47  }
    48
    

libs/hathor/simulation/src/culture/manager.ts#

  • L71

    ts
    69    }
    70
    71    /** Returns a float in [0, 1) — drop-in replacement for Math.random(). */
    72    next(): number {
    73      this.state ^= this.state << 13;
    
  • L100

    ts
    98
    99  function generateId(): string {
    100    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    101  }
    102
    

libs/hathor/simulation/src/culture/providers.ts#

  • L11

    ts
    9   *
    10   * All simulation logic is deterministic given the same cultural state.
    11   * No Math.random() calls -- randomness derives from seeded or state-based hashing.
    12   */
    13
    
  • L51

    ts
    49   * FNV-1a 32-bit hash producing a deterministic float in [0, 1).
    50   * Used wherever the simulation needs a "random-looking" but reproducible
    51   * value derived from cultural state rather than Math.random().
    52   */
    53  function hashToFloat(...parts: (string | number)[]): number {
    

libs/hathor/simulation/src/economy/manager.ts#

  • L66

    ts
    64    }
    65
    66    /** Returns a float in [0, 1) — drop-in replacement for Math.random(). */
    67    next(): number {
    68      this.state ^= this.state << 13;
    
  • L95

    ts
    93
    94  function generateId(): string {
    95    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    96  }
    97
    

libs/hathor/simulation/src/economy/providers.ts#

  • L10

    ts
    8   * trade network analysis, and condition-weighted event generation.
    9   *
    10   * NO Math.random() is used anywhere in these providers. All stochastic
    11   * behavior is deterministic, driven by hashing of simulation state.
    12   */
    
  • L237

    ts
    235   * 3. Deterministic volatility noise via seeded sine composition:
    236   *    noise = sum_k( A_k * sin(w_k * stateHash + phi_k) )
    237   *    No Math.random() used.
    238   *
    239   * 4. Sinusoidal seasonal cycles keyed to resource category.
    

libs/hathor/simulation/src/npc/behavior-tree.ts#

  • L650

    ts
    648      // Select random child if not already running
    649      if (this.selectedIndex < 0 || this.runningChildIndex < 0) {
    650        this.selectedIndex = Math.floor(Math.random() * this.children.length);
    651      }
    652
    
  • L1294

    ts
    1292
    1293  function generateNodeId(prefix: string): string {
    1294    return `${prefix}_${++nodeIdCounter}_${Math.random().toString(36).slice(2, 8)}`;
    1295  }
    1296
    
  • L1501

    ts
    1499    return BT.action('Idle', (ctx) => {
    1500      // Select random action based on weight
    1501      let random = Math.random() * totalWeight;
    1502      for (const item of idleActions) {
    1503        random -= item.weight;
    

libs/hathor/simulation/src/physics/engine.ts#

  • L44

    ts
    42
    43  function generateId(prefix: string): string {
    44    return `${prefix}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    45  }
    46
    

libs/hathor/simulation/src/politics/manager.ts#

  • L70

    ts
    68    }
    69
    70    /** Returns a float in [0, 1) — drop-in replacement for Math.random(). */
    71    next(): number {
    72      this.state ^= this.state << 13;
    
  • L99

    ts
    97
    98  function generateId(): string {
    99    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    100  }
    101
    

libs/hathor/simulation/src/politics/providers.ts#

  • L12

    ts
    10   *
    11   * Design principles:
    12   * - NO Math.random() in core logic -- all outcomes are deterministic functions
    13   *   of faction state, enabling reproducible simulations.
    14   * - Algorithms are grounded in established political science and game theory.
    

libs/hathor/simulation/src/scenario/manager.ts#

  • L47

    ts
    45
    46  function generateId(): string {
    47    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    48  }
    49
    

libs/hathor/simulation/src/state/postgres-storage.ts#

  • L69

    ts
    67
    68  function generateId(): string {
    69    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    70  }
    71
    

libs/hathor/simulation/src/state/state-store.ts#

  • L34

    ts
    32
    33  function generateId(): string {
    34    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    35  }
    36
    

libs/hathor/sophia-integration/src/research-grounding.ts#

  • L324

    ts
    322
    323        const citation: WorldCitation = {
    324          id: `grounding-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    325          worldFactId: '',
    326          worldElementType: request.contentType,
    

libs/hathor/theory/src/cinematography/manager.ts#

  • L114

    ts
    112    async create(input: CreateShotInput): Promise<Shot> {
    113      const id = (input.id ||
    114        `shot_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`) as ShotId;
    115      const now = Date.now();
    116      const shot: Shot = {
    

libs/hathor/theory/src/mda/manager.ts#

  • L145

    ts
    143    async create(input: CreateMechanicInput): Promise<GameMechanic> {
    144      const id = (input.id ||
    145        `mech_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`) as MechanicId;
    146      const now = Date.now();
    147      const mechanic: GameMechanic = {
    
  • L227

    ts
    225    async create(input: CreateDynamicInput): Promise<GameDynamic> {
    226      const id = (input.id ||
    227        `dyn_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`) as DynamicId;
    228      const now = Date.now();
    229      const dynamic: GameDynamic = {
    
  • L326

    ts
    324    async create(input: CreateAestheticInput): Promise<GameAesthetic> {
    325      const id = (input.id ||
    326        `aes_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`) as AestheticId;
    327      const now = Date.now();
    328      const aesthetic: GameAesthetic = {
    
  • L414

    ts
    412    async create(input: CreateFeedbackLoopInput): Promise<FeedbackLoop> {
    413      const id = (input.id ||
    414        `loop_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`) as FeedbackLoopId;
    415      const now = Date.now();
    416      const loop: FeedbackLoop = {
    

libs/hathor/theory/src/narrative/manager.ts#

  • L149

    ts
    147    async create(input: CreateNarrativeElementInput): Promise<NarrativeElement> {
    148      const id = (input.id ||
    149        `elem_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`) as NarrativeElementId;
    150      const now = Date.now();
    151      const element: NarrativeElement = {
    
  • L257

    ts
    255    async create(input: CreatePlotPointInput): Promise<PlotPoint> {
    256      const id = (input.id ||
    257        `plot_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`) as PlotPointId;
    258      const plotPoint: PlotPoint = { ...input, id };
    259      this.plotPoints.set(id, plotPoint);
    
  • L350

    ts
    348    async create(input: CreateCharacterArcInput): Promise<CharacterArc> {
    349      const id = (input.id ||
    350        `arc_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`) as CharacterArcId;
    351      const arc: CharacterArc = { ...input, id };
    352      this.arcs.set(id, arc);
    

libs/hathor/validation/src/causality/causality-validator.ts#

  • L37

    ts
    35   */
    36  function generateIssueId(): string {
    37    return `issue-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    38  }
    39
    

libs/hathor/validation/src/contradiction/contradiction-detector.ts#

  • L41

    ts
    39   */
    40  function generateId(): string {
    41    return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    42  }
    43
    

libs/hathor/validation/src/taxonomy/taxonomy-validator.ts#

  • L162

    ts
    160   */
    161  function generateIssueId(): string {
    162    return `issue-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    163  }
    164
    

libs/hathor/validation/src/timeline/timeline-validator.ts#

  • L40

    ts
    38   */
    39  function generateIssueId(): string {
    40    return `issue-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    41  }
    42
    

libs/hestia/ai-ml/src/flavor-pairing.ts#

  • L980

    ts
    978        const categoryDiff = profA.category !== profB.category ? 1 : 0;
    979        const novelty = clamp(
    980          (1 - score.overlapScore / 100) * 50 + categoryDiff * 30 + Math.random() * 20,
    981          0,
    982          100
    

libs/hestia/ai-ml/src/recipe-generation.ts#

  • L708

    ts
    706
    707  function pickRandom<T>(arr: readonly T[], count: number): T[] {
    708    const shuffled = [...arr].sort(() => Math.random() - 0.5);
    709    return shuffled.slice(0, Math.min(count, arr.length));
    710  }
    
  • L771

    ts
    769    return names.map((name) => ({
    770      name,
    771      amount: Math.round((1 + Math.random() * 2) * servings * 10) / 10,
    772      unit: guessUnit(name),
    773      estimatedCostUsd: Math.round(lookupCost(name) * servings * 100) / 100,
    
  • L813

    ts
    811      stepNumber: i + 1,
    812      instruction: desc,
    813      durationMinutes: 3 + Math.floor(Math.random() * 8),
    814      technique: techniques[i % techniques.length],
    815    }));
    
  • L1594

    ts
    1592          stepNumber: existingSteps.length + 1,
    1593          instruction: ds,
    1594          durationMinutes: 5 + Math.floor(Math.random() * 5),
    1595          technique: profile.commonTechniques[existingSteps.length % profile.commonTechniques.length],
    1596        });
    

libs/hestia/education/src/certifications.ts#

  • L2974

    ts
    2972    if (!cert) return [];
    2973    const allQuestions = cert.sections.flatMap((s) => s.sampleQuestions);
    2974    const shuffled = [...allQuestions].sort(() => Math.random() - 0.5);
    2975    return shuffled.slice(0, questionCount);
    2976  }
    

libs/hestia/education/src/food-science.ts#

  • L3107

    ts
    3105
    3106    // Shuffle and take the requested count
    3107    const shuffled = [...allQuestions].sort(() => Math.random() - 0.5);
    3108    return shuffled.slice(0, count);
    3109  }
    

libs/hestia/education/src/interactive.ts#

  • L4986

    ts
    4984      : allQuestions;
    4985
    4986    const shuffled = [...filtered].sort(() => Math.random() - 0.5);
    4987    const selected = shuffled.slice(0, Math.min(numQuestions, shuffled.length));
    4988
    

libs/hestia/meal-planning/src/batch-cooking.ts#

  • L106

    ts
    104
    105  function generateId(): string {
    106    return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    107  }
    108
    

libs/hestia/meal-planning/src/budget.ts#

  • L99

    ts
    97
    98  function generateId(): string {
    99    return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    100  }
    101
    

libs/hestia/meal-planning/src/calendar.ts#

  • L47

    ts
    45
    46  function generateId(): string {
    47    return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    48  }
    49
    

libs/hestia/meal-planning/src/events.ts#

  • L104

    ts
    102
    103  function generateId(): string {
    104    return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    105  }
    106
    

libs/hestia/meal-planning/src/household.ts#

  • L75

    ts
    73
    74  function generateId(): string {
    75    return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    76  }
    77
    

libs/hestia/social/src/community-challenges.ts#

  • L2369

    ts
    2367        if (sub.userId === voterId) continue;
    2368        const base = subId === 'sub_b1' ? 8.5 : subId === 'sub_b2' ? 7.5 : 6;
    2369        const noise = () => Math.round((Math.random() * 2 - 1) * 10) / 10;
    2370        const vid = nextId('vote');
    2371        voteStore.set(vid, {
    

libs/hestia/social/src/family-cookbook.ts#

  • L30

    ts
    28    const chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
    29    let code = '';
    30    for (let i = 0; i < len; i++) code += chars[Math.floor(Math.random() * chars.length)];
    31    return code;
    32  }
    

libs/hestia/social/src/recipe-sharing.ts#

  • L820

    ts
    818
    819      const stats: RecipeStats = {
    820        views: Math.floor(Math.random() * 5000) + 100,
    821        saves: Math.floor(Math.random() * 500) + 10,
    822        ratings: Math.floor(Math.random() * 200) + 5,
    
  • L821

    ts
    819      const stats: RecipeStats = {
    820        views: Math.floor(Math.random() * 5000) + 100,
    821        saves: Math.floor(Math.random() * 500) + 10,
    822        ratings: Math.floor(Math.random() * 200) + 5,
    823        averageRating: parseFloat((3.5 + Math.random() * 1.5).toFixed(1)),
    
  • L822

    ts
    820        views: Math.floor(Math.random() * 5000) + 100,
    821        saves: Math.floor(Math.random() * 500) + 10,
    822        ratings: Math.floor(Math.random() * 200) + 5,
    823        averageRating: parseFloat((3.5 + Math.random() * 1.5).toFixed(1)),
    824        cooksCount: Math.floor(Math.random() * 300) + 5,
    
  • L823

    ts
    821        saves: Math.floor(Math.random() * 500) + 10,
    822        ratings: Math.floor(Math.random() * 200) + 5,
    823        averageRating: parseFloat((3.5 + Math.random() * 1.5).toFixed(1)),
    824        cooksCount: Math.floor(Math.random() * 300) + 5,
    825      };
    
  • L824

    ts
    822        ratings: Math.floor(Math.random() * 200) + 5,
    823        averageRating: parseFloat((3.5 + Math.random() * 1.5).toFixed(1)),
    824        cooksCount: Math.floor(Math.random() * 300) + 5,
    825      };
    826
    

libs/hestia/sustainability/src/carbon-footprint.ts#

  • L2469

    ts
    2467
    2468    return {
    2469      purchaseId: `offset_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    2470      providerId,
    2471      tonnesCO2e,
    

libs/iris/accessibility/adaptive/src/utils.ts#

  • L13

    ts
    11
    12  export function stableId(prefix: string): string {
    13    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    14  }
    15
    

libs/iris/accessibility/braille/src/utils.ts#

  • L57

    ts
    55
    56  export function stableId(prefix: string): string {
    57    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    58  }
    59
    

libs/iris/accessibility/cognitive/src/memory-aids.ts#

  • L61

    ts
    59   */
    60  function generateId(): string {
    61    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    62  }
    63
    

libs/iris/accessibility/cognitive/src/reading/content-summarization.ts#

  • L923

    ts
    921     */
    922    private generateId(): string {
    923      return `summary-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    924    }
    925
    

libs/iris/accessibility/motor/src/dictation.ts#

  • L155

    ts
    153
    154  function generateSessionId(): string {
    155    return `dictation_${Math.random().toString(36).substring(2, 15)}_${Date.now()}`;
    156  }
    157
    
  • L159

    ts
    157
    158  function generateHistoryId(): string {
    159    return `history_${Math.random().toString(36).substring(2, 15)}`;
    160  }
    161
    

libs/iris/accessibility/motor/src/switch-access.ts#

  • L603

    ts
    601      for (const landmark of landmarks) {
    602        const role = landmark.getAttribute('role') ?? landmark.tagName.toLowerCase();
    603        const groupId = `group-${role}-${Math.random().toString(36).substring(2, 8)}`;
    604
    605        const groupElements = this.flattenedElements.filter((el) => landmark.contains(el));
    

libs/iris/accessibility/testing/src/utils.ts#

  • L14

    ts
    12
    13  export function stableId(prefix: string): string {
    14    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    15  }
    16
    

libs/iris/accessibility/voice-ui/src/utils.ts#

  • L13

    ts
    11
    12  export function stableId(prefix: string): string {
    13    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    14  }
    15
    

libs/iris/agents/archetypes/src/creative-agent.ts#

  • L518

    ts
    516
    517      const typeTemplates = templates[type] ?? templates['article'];
    518      const template = typeTemplates[Math.floor(Math.random() * typeTemplates.length)];
    519
    520      return template.replace('{{topic}}', this.capitalizeFirst(topic));
    
  • L580

    ts
    578
    579      const intros = tone === 'formal' ? formalIntros : casualIntros;
    580      return intros[Math.floor(Math.random() * intros.length)];
    581    }
    582
    

libs/iris/agents/archetypes/src/operations-agent.ts#

  • L784

    ts
    782        pid: identifier,
    783        status: 'running',
    784        cpuPercent: Math.random() * 100,
    785        memoryMb: Math.floor(Math.random() * 1000),
    786        threads: Math.floor(Math.random() * 50) + 1,
    
  • L785

    ts
    783        status: 'running',
    784        cpuPercent: Math.random() * 100,
    785        memoryMb: Math.floor(Math.random() * 1000),
    786        threads: Math.floor(Math.random() * 50) + 1,
    787      };
    
  • L786

    ts
    784        cpuPercent: Math.random() * 100,
    785        memoryMb: Math.floor(Math.random() * 1000),
    786        threads: Math.floor(Math.random() * 50) + 1,
    787      };
    788    }
    
  • L809

    ts
    807        case 'cpu':
    808          return {
    809            usage: Math.random() * 100,
    810            cores: 8,
    811            loadAvg: [1.5, 1.2, 0.9].join(', '),
    
  • L817

    ts
    815          return {
    816            totalMb: 16384,
    817            usedMb: Math.floor(Math.random() * 16384),
    818            freeMb: Math.floor(Math.random() * 16384),
    819            usagePercent: Math.random() * 100,
    
  • L818

    ts
    816            totalMb: 16384,
    817            usedMb: Math.floor(Math.random() * 16384),
    818            freeMb: Math.floor(Math.random() * 16384),
    819            usagePercent: Math.random() * 100,
    820          };
    
  • L819

    ts
    817            usedMb: Math.floor(Math.random() * 16384),
    818            freeMb: Math.floor(Math.random() * 16384),
    819            usagePercent: Math.random() * 100,
    820          };
    821
    
  • L825

    ts
    823          return {
    824            totalGb: 500,
    825            usedGb: Math.floor(Math.random() * 500),
    826            freeGb: Math.floor(Math.random() * 500),
    827            usagePercent: Math.random() * 100,
    
  • L826

    ts
    824            totalGb: 500,
    825            usedGb: Math.floor(Math.random() * 500),
    826            freeGb: Math.floor(Math.random() * 500),
    827            usagePercent: Math.random() * 100,
    828          };
    
  • L827

    ts
    825            usedGb: Math.floor(Math.random() * 500),
    826            freeGb: Math.floor(Math.random() * 500),
    827            usagePercent: Math.random() * 100,
    828          };
    829
    
  • L842

    ts
    840        logFile: identifier,
    841        lastModified: new Date().toISOString(),
    842        sizeKb: Math.floor(Math.random() * 10000),
    843        errorCount: Math.floor(Math.random() * 10),
    844        warningCount: Math.floor(Math.random() * 50),
    
  • L843

    ts
    841        lastModified: new Date().toISOString(),
    842        sizeKb: Math.floor(Math.random() * 10000),
    843        errorCount: Math.floor(Math.random() * 10),
    844        warningCount: Math.floor(Math.random() * 50),
    845      };
    
  • L844

    ts
    842        sizeKb: Math.floor(Math.random() * 10000),
    843        errorCount: Math.floor(Math.random() * 10),
    844        warningCount: Math.floor(Math.random() * 50),
    845      };
    846    }
    
  • L1019

    ts
    1017        source,
    1018        destination: backupPath,
    1019        size: Math.floor(Math.random() * 10000000),
    1020        createdAt: new Date(),
    1021      };
    

libs/iris/agents/computer-use/accessibility/src/a11y-tree-inspector.ts#

  • L27

    ts
    25
    26  function createId(prefix: string): string {
    27    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    28  }
    29
    

libs/iris/agents/computer-use/browser/src/types.ts#

  • L31

    ts
    29  export function createBrowserSessionId(id?: string): BrowserSessionId {
    30    return (id ??
    31      `browser_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as BrowserSessionId;
    32  }
    33
    
  • L38

    ts
    36   */
    37  export function createPageId(id?: string): PageId {
    38    return (id ?? `page_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as PageId;
    39  }
    40
    
  • L45

    ts
    43   */
    44  export function createFrameId(id?: string): FrameId {
    45    return (id ?? `frame_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as FrameId;
    46  }
    47
    
  • L52

    ts
    50   */
    51  export function createNavigationId(id?: string): NavigationId {
    52    return (id ?? `nav_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as NavigationId;
    53  }
    54
    

libs/iris/agents/computer-use/desktop/src/index.ts#

  • L511

    ts
    509      // Simulate launching application
    510      const appId = createApplicationId();
    511      const processId = createProcessId(Math.floor(Math.random() * 100000));
    512      const name =
    513        path
    

libs/iris/agents/computer-use/desktop/src/types.ts#

  • L36

    ts
    34  export function createDesktopSessionId(id?: string): DesktopSessionId {
    35    return (id ??
    36      `desktop_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as DesktopSessionId;
    37  }
    38
    
  • L43

    ts
    41   */
    42  export function createWindowId(id?: string): WindowId {
    43    return (id ?? `win_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as WindowId;
    44  }
    45
    
  • L50

    ts
    48   */
    49  export function createApplicationId(id?: string): ApplicationId {
    50    return (id ?? `app_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as ApplicationId;
    51  }
    52
    
  • L64

    ts
    62   */
    63  export function createMenuItemId(id?: string): MenuItemId {
    64    return (id ?? `menu_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as MenuItemId;
    65  }
    66
    
  • L71

    ts
    69   */
    70  export function createDialogId(id?: string): DialogId {
    71    return (id ?? `dlg_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as DialogId;
    72  }
    73
    

libs/iris/agents/computer-use/desktop/src/window-manager.ts#

  • L736

    ts
    734        id: windowId,
    735        title: window.title,
    736        processId: window.processId ?? createProcessId(Math.floor(Math.random() * 10000)),
    737        applicationId: window.applicationId,
    738        applicationName: window.applicationName ?? 'Unknown',
    

libs/iris/agents/computer-use/recording/src/screen-recorder.ts#

  • L15

    ts
    13
    14  function createId(prefix: string): string {
    15    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    16  }
    17
    

libs/iris/agents/computer-use/recovery/src/alternative-path-finder.ts#

  • L13

    ts
    11
    12  function createId(prefix: string): string {
    13    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    14  }
    15
    

libs/iris/agents/computer-use/recovery/src/error-detector.ts#

  • L14

    ts
    12
    13  function createId(prefix: string): string {
    14    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    15  }
    16
    

libs/iris/agents/computer-use/recovery/src/recovery-strategy-selector.ts#

  • L15

    ts
    13
    14  function createId(prefix: string): string {
    15    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    16  }
    17
    

libs/iris/agents/computer-use/recovery/src/rollback-manager.ts#

  • L15

    ts
    13
    14  function createId(prefix: string): string {
    15    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    16  }
    17
    

libs/iris/agents/computer-use/src/screen-capture.ts#

  • L857

    ts
    855     * same mouse-control surface that V1-P2-0731 wires; in the test
    856     * fallback we return the screen centre as a deterministic stand-in
    857     * (Math.random was previously used here but produced non-deterministic
    858     * test output).
    859     */
    

libs/iris/agents/computer-use/src/types.ts#

  • L31

    ts
    29  export function createCaptureSessionId(id?: string): CaptureSessionId {
    30    return (id ??
    31      `capture_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as CaptureSessionId;
    32  }
    33
    
  • L38

    ts
    36   */
    37  export function createActionId(id?: string): ActionId {
    38    return (id ?? `action_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as ActionId;
    39  }
    40
    
  • L45

    ts
    43   */
    44  export function createElementId(id?: string): ElementId {
    45    return (id ?? `element_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as ElementId;
    46  }
    47
    
  • L53

    ts
    51  export function createComputerSessionId(id?: string): ComputerSessionId {
    52    return (id ??
    53      `session_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as ComputerSessionId;
    54  }
    55
    

libs/iris/agents/computer-use/templates/src/task-template-builder.ts#

  • L35

    ts
    33
    34  function createId(prefix: string): string {
    35    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    36  }
    37
    

libs/iris/agents/computer-use/templates/src/template-library.ts#

  • L26

    ts
    24
    25  function createId(prefix: string): string {
    26    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    27  }
    28
    

libs/iris/agents/computer-use/templates/src/template-parameterization.ts#

  • L37

    ts
    35
    36  function createId(prefix: string): string {
    37    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    38  }
    39
    

libs/iris/agents/computer-use/templates/src/template-sharing.ts#

  • L16

    ts
    14
    15  function createId(prefix: string): string {
    16    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 12)}`;
    17  }
    18
    

libs/iris/agents/computer-use/vision/src/change-detector.ts#

  • L60

    ts
    58
    59      // Simulate pixel-level comparison
    60      const similarity = dimensionsMatch ? 0.85 + Math.random() * 0.1 : 0.5;
    61
    62      // Detect changes (simulated)
    
  • L281

    ts
    279
    280      // Simulate a few random changes
    281      if (Math.random() > 0.3) {
    282        changes.push({
    283          id: 'change_1',
    
  • L295

    ts
    293      }
    294
    295      if (Math.random() > 0.5) {
    296        changes.push({
    297          id: 'change_2',
    
  • L309

    ts
    307      }
    308
    309      if (Math.random() > 0.7) {
    310        changes.push({
    311          id: 'change_3',
    

libs/iris/agents/computer-use/vision/src/types.ts#

  • L30

    ts
    28  export function createScreenshotId(id?: string): ScreenshotId {
    29    return (id ??
    30      `screenshot_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as ScreenshotId;
    31  }
    32
    
  • L37

    ts
    35   */
    36  export function createUIElementId(id?: string): UIElementId {
    37    return (id ?? `element_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as UIElementId;
    38  }
    39
    
  • L45

    ts
    43  export function createAnalysisSessionId(id?: string): AnalysisSessionId {
    44    return (id ??
    45      `analysis_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as AnalysisSessionId;
    46  }
    47
    
  • L52

    ts
    50   */
    51  export function createRegionId(id?: string): RegionId {
    52    return (id ?? `region_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as RegionId;
    53  }
    54
    

libs/iris/agents/core/src/agent-execution-replay.ts#

  • L597

    ts
    595
    596      return {
    597        id: options.id ?? `replay_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    598        name: options.name ?? 'Execution Replay',
    599        source: 'debug-export',
    
  • L619

    ts
    617
    618      return {
    619        id: options.id ?? `replay_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    620        name: options.name ?? 'Execution Replay',
    621        source: 'debug-records',
    

libs/iris/agents/marketplace/src/agent-publisher.ts#

  • L14

    ts
    12
    13  function createId(prefix: string): string {
    14    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    15  }
    16
    

libs/iris/agents/multi-agent/memory/src/memory-broadcast.ts#

  • L19

    ts
    17
    18  function createId(prefix: string): string {
    19    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    20  }
    21
    

libs/iris/agents/multi-agent/memory/src/memory-conflict-resolution.ts#

  • L17

    ts
    15
    16  function createId(prefix: string): string {
    17    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    18  }
    19
    

libs/iris/agents/multi-agent/memory/src/selective-memory-sharing.ts#

  • L17

    ts
    15
    16  function createId(prefix: string): string {
    17    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    18  }
    19
    

libs/iris/agents/multi-agent/memory/src/shared-agent-memory.ts#

  • L16

    ts
    14
    15  function createId(prefix: string): string {
    16    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    17  }
    18
    

libs/iris/agents/multi-agent/src/collaboration-protocol.ts#

  • L704

    ts
    702    ): void {
    703      const event: CollaborationEvent = {
    704        id: `event_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    705        type,
    706        agentId,
    

libs/iris/agents/multi-agent/src/collaboration-types.ts#

  • L46

    ts
    44  export function createCollaborationId(id?: string): CollaborationId {
    45    return (id ??
    46      `collab_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`) as CollaborationId;
    47  }
    48
    
  • L54

    ts
    52  export function createHandoffId(id?: string): HandoffId {
    53    return (id ??
    54      `handoff_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`) as HandoffId;
    55  }
    56
    
  • L62

    ts
    60  export function createSharedContextId(id?: string): SharedContextId {
    61    return (id ??
    62      `ctx_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`) as SharedContextId;
    63  }
    64
    
  • L70

    ts
    68  export function createConflictId(id?: string): ConflictId {
    69    return (id ??
    70      `conflict_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`) as ConflictId;
    71  }
    72
    
  • L78

    ts
    76  export function createConsensusRoundId(id?: string): ConsensusRoundId {
    77    return (id ??
    78      `consensus_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`) as ConsensusRoundId;
    79  }
    80
    

libs/iris/agents/multi-agent/src/conflict-resolver.ts#

  • L236

    ts
    234      }
    235
    236      const solutionId = `sol_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    237
    238      const fullSolution: ProposedSolution = {
    

libs/iris/agents/multi-agent/src/consensus-builder.ts#

  • L112

    ts
    110      }
    111
    112      const proposalId = `prop_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    113      const roundId = createConsensusRoundId();
    114      const now = new Date();
    

libs/iris/agents/multi-agent/src/negotiation-protocol.ts#

  • L21

    ts
    19
    20  export function createNegotiationId(): NegotiationId {
    21    return `neg_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as NegotiationId;
    22  }
    23
    
  • L25

    ts
    23
    24  export function createProposalId(): ProposalId {
    25    return `prop_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as ProposalId;
    26  }
    27
    

libs/iris/agents/multi-agent/src/orchestrator.ts#

  • L502

    ts
    500      // Simulate execution time
    501      const executionTime = Math.min(
    502        50 + Math.random() * 100,
    503        task.timeout ?? this.session.config.defaultTaskTimeout ?? 5000
    504      );
    
  • L512

    ts
    510        id: createResultId(),
    511        taskId: task.id,
    512        success: Math.random() > 0.1, // 90% success rate
    513        output: {
    514          taskName: task.name,
    
  • L519

    ts
    517        },
    518        duration: executionTime,
    519        tokensUsed: Math.floor(Math.random() * 1000) + 100,
    520        createdAt: new Date(),
    521        agentId: assignment.agentId,
    
  • L522

    ts
    520        createdAt: new Date(),
    521        agentId: assignment.agentId,
    522        confidence: 0.7 + Math.random() * 0.3,
    523        quality: 0.6 + Math.random() * 0.4,
    524      };
    
  • L523

    ts
    521        agentId: assignment.agentId,
    522        confidence: 0.7 + Math.random() * 0.3,
    523        quality: 0.6 + Math.random() * 0.4,
    524      };
    525
    

libs/iris/agents/multi-agent/src/task-distributor.ts#

  • L559

    ts
    557      }
    558
    559      return agents[Math.floor(Math.random() * agents.length)];
    560    }
    561
    

libs/iris/agents/multi-agent/src/types.ts#

  • L47

    ts
    45   */
    46  export function createOrchestrationId(): OrchestrationId {
    47    return `orch_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as OrchestrationId;
    48  }
    49
    
  • L54

    ts
    52   */
    53  export function createAgentInstanceId(): AgentInstanceId {
    54    return `agent_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as AgentInstanceId;
    55  }
    56
    
  • L61

    ts
    59   */
    60  export function createMessageId(): MessageId {
    61    return `msg_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as MessageId;
    62  }
    63
    
  • L68

    ts
    66   */
    67  export function createTaskId(): TaskId {
    68    return `task_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as TaskId;
    69  }
    70
    
  • L75

    ts
    73   */
    74  export function createSubtaskId(): SubtaskId {
    75    return `subtask_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as SubtaskId;
    76  }
    77
    
  • L82

    ts
    80   */
    81  export function createResultId(): ResultId {
    82    return `result_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as ResultId;
    83  }
    84
    

libs/iris/agents/personalities/src/agent-personality.ts#

  • L20

    ts
    18
    19  function createId(prefix: string): string {
    20    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    21  }
    22
    

libs/iris/agents/personalities/src/personality-evolution.ts#

  • L19

    ts
    17
    18  function createId(prefix: string): string {
    19    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    20  }
    21
    

libs/iris/agents/proactive/anticipation/src/opportunity-scanner.ts#

  • L109

    ts
    107          const impact = Number(signal.impact ?? 0.5);
    108          candidates.push({
    109            id: `opp_${source.id}_${String(signal.id ?? Math.random().toString(36).slice(2, 7))}`,
    110            userId: input.userId,
    111            category,
    

libs/iris/agents/proactive/reminders/src/delivery-providers.ts#

  • L5

    ts
    3   *
    4   * V1-P2-0777 introduced the `DeliveryProvider` abstraction so the engine
    5   * stopped fabricating success via `Math.random() < 0.95`. The default
    6   * `DeterministicSuccessDeliveryProvider` is fine for tests and dev, but
    7   * production deployments need real adapters that *actually deliver*. This
    

libs/iris/agents/proactive/reminders/src/reminder-engine.ts#

  • L507

    ts
    505     * defaults to `DeterministicSuccessDeliveryProvider`, which
    506     * unconditionally returns `true` — replacing the prior
    507     * `Math.random() < 0.95` fabrication that produced flaky and
    508     * untestable delivery outcomes.
    509     */
    

libs/iris/agents/proactive/reminders/src/reminder-types.ts#

  • L1116

    ts
    1114   * Deterministic, no-network default provider — every call resolves to
    1115   * `true`. The previous engine behaviour fabricated a 95% success rate
    1116   * via `Math.random() < 0.95`, which made delivery outcomes flaky and
    1117   * untestable. Production deployments override this via
    1118   * `ReminderEngineConfig.deliveryProvider`.
    

libs/iris/agents/specialization/src/specialization-metrics.ts#

  • L21

    ts
    19
    20  function createId(prefix: string): string {
    21    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    22  }
    23
    

libs/iris/agents/tools/calling/src/error-handler.ts#

  • L251

    ts
    249      if (this.retryPolicy.jitter) {
    250        const jitterRange = cappedDelay * this.retryPolicy.jitterFactor;
    251        const jitter = Math.random() * jitterRange * 2 - jitterRange;
    252        return Math.max(0, Math.min(this.retryPolicy.maxDelayMs, Math.round(cappedDelay + jitter)));
    253      }
    

libs/iris/agents/tools/code/src/python-runner.ts#

  • L492

    ts
    490      const dir = path.join(
    491        this.tempDir,
    492        `exec_${Date.now()}_${Math.random().toString(36).slice(2)}`
    493      );
    494      await fs.mkdir(dir, { recursive: true });
    

libs/iris/agents/tools/code/src/shell-runner.ts#

  • L593

    ts
    591      const dir = path.join(
    592        this.tempDir,
    593        `exec_${Date.now()}_${Math.random().toString(36).slice(2)}`
    594      );
    595      await fs.mkdir(dir, { recursive: true });
    

libs/iris/agents/tools/code/src/typescript-runner.ts#

  • L667

    ts
    665      const dir = path.join(
    666        this.tempDir,
    667        `exec_${Date.now()}_${Math.random().toString(36).slice(2)}`
    668      );
    669      await fs.mkdir(dir, { recursive: true });
    

libs/iris/agents/tools/composition/src/tool-pipeline.ts#

  • L25

    ts
    23
    24  function createRunId(pipelineId: string): string {
    25    return `${pipelineId}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
    26  }
    27
    

libs/iris/agents/tools/learning/src/index.ts#

  • L242

    ts
    240     */
    241    startSession(task?: string): SessionId {
    242      const id = `session_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as SessionId;
    243      const session: LearningSession = {
    244        id,
    

libs/iris/agents/tools/learning/src/tool-registration.ts#

  • L1023

    ts
    1021
    1022      for (const param of parameters) {
    1023        if (param.required || Math.random() > 0.5) {
    1024          input[param.name] = this.generateValueForType(param);
    1025        }
    

libs/iris/agents/tools/monitoring/src/types.ts#

  • L335

    ts
    333
    334  export function createRunId(toolId: string): string {
    335    return `${toolId}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
    336  }
    

libs/iris/agents/workflows/src/error-recovery.ts#

  • L656

    ts
    654
    655      return {
    656        id: `err_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    657        executionId,
    658        taskId,
    

libs/iris/agents/workflows/src/workflow-types.ts#

  • L48

    ts
    46   */
    47  export function createWorkflowId(id?: string): WorkflowId {
    48    return (id ?? `wf_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`) as WorkflowId;
    49  }
    50
    
  • L55

    ts
    53   */
    54  export function createTaskId(id?: string): TaskId {
    55    return (id ?? `task_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`) as TaskId;
    56  }
    57
    
  • L62

    ts
    60   */
    61  export function createStepId(id?: string): StepId {
    62    return (id ?? `step_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`) as StepId;
    63  }
    64
    
  • L69

    ts
    67   */
    68  export function createExecutionId(id?: string): ExecutionId {
    69    return (id ?? `exec_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`) as ExecutionId;
    70  }
    71
    
  • L77

    ts
    75  export function createCheckpointId(id?: string): CheckpointId {
    76    return (id ??
    77      `ckpt_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`) as CheckpointId;
    78  }
    79
    

libs/iris/analytics/realtime/src/alerting-triggers.ts#

  • L71

    ts
    69
    70        const alert: TriggeredAlert = {
    71          id: `alert_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,
    72          ruleId: rule.id,
    73          metric: rule.metric,
    

libs/iris/analytics/src/analytics-engine.ts#

  • L244

    ts
    242
    243      // Check sampling
    244      if (this.config.enableSampling && Math.random() > this.config.samplingRate) {
    245        this.sampledOutEvents++;
    246        return null;
    

libs/iris/analytics/src/privacy.ts#

  • L558

    ts
    556
    557    private laplacianNoise(scale: number): number {
    558      const u = Math.random() - 0.5;
    559      return -scale * Math.sign(u) * Math.log(1 - 2 * Math.abs(u));
    560    }
    

libs/iris/code/explanation/src/diagrams/diagram-generator.ts#

  • L1883

    ts
    1881
    1882    private generateId(): string {
    1883      return `diagram_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    1884    }
    1885  }
    

libs/iris/code/ide/actions/src/utils.ts#

  • L8

    ts
    6
    7  export function stableId(prefix: string): string {
    8    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    9  }
    10
    

libs/iris/code/ide/completions/src/utils.ts#

  • L8

    ts
    6
    7  export function stableId(prefix: string): string {
    8    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    9  }
    10
    

libs/iris/code/ide/inline/src/utils.ts#

  • L8

    ts
    6
    7  export function stableId(prefix: string): string {
    8    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    9  }
    10
    

libs/iris/code/ide/src/features/chat.ts#

  • L72

    ts
    70   */
    71  function generateMessageId(): string {
    72    return `msg-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    73  }
    74
    
  • L79

    ts
    77   */
    78  function generateSessionId(): string {
    79    return `session-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    80  }
    81
    
  • L154

    ts
    152    ): Promise<ChatResponse> {
    153      const startTime = Date.now();
    154      const requestId = `chat-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
    155
    156      // Create user message
    

libs/iris/code/ide/src/features/inline-suggestions.ts#

  • L329

    ts
    327  ): InlineSuggestion {
    328    return {
    329      id: `suggestion-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    330      insertText: text,
    331      label: options.label ?? text.slice(0, 50),
    
  • L362

    ts
    360
    361    return {
    362      id: `snippet-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    363      insertText,
    364      label: options.label ?? template.split('\n')[0].slice(0, 50),
    
  • L392

    ts
    390
    391    return {
    392      id: `fn-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    393      insertText,
    394      label: signature,
    
  • L416

    ts
    414
    415    return {
    416      id: `multiline-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    417      insertText: text,
    418      label: options.label ?? lines[0].slice(0, 50),
    

libs/iris/code/ide/src/protocol/jsonrpc.ts#

  • L93

    ts
    91    maxConcurrentRequests: 100,
    92    debug: false,
    93    idGenerator: () => `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    94  };
    95
    

libs/iris/code/languages/src/base-analyzer.ts#

  • L240

    ts
    238    ): LanguageInsight {
    239      return {
    240        id: `${this.language}-${type}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    241        type,
    242        severity,
    

libs/iris/code/quality/src/security-detector.ts#

  • L459

    ts
    457      name: 'Weak Random Number Generator',
    458      pattern: /Math\.random\s*\(\s*\)/g,
    459      message: 'Math.random() is not cryptographically secure',
    460      severity: 'low',
    461      cweId: 'CWE-330',
    

libs/iris/code/semantic/src/semantic-analyzer.ts#

  • L471

    ts
    469    ): SemanticInsight {
    470      return {
    471        id: `semantic-${type}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    472        type,
    473        severity,
    

libs/iris/conversation-citations/src/citation-tracker.ts#

  • L618

    ts
    616    for (const item of data) {
    617      const source: Source = {
    618        id: createSourceId(item.id ?? `source-${Date.now()}-${Math.random().toString(36).slice(2)}`),
    619        type: (item.type ?? 'other') as SourceType,
    620        title: item.title,
    

libs/iris/conversation-context/src/context-summary.ts#

  • L40

    ts
    38  function createSummaryId(): string {
    39    const timestamp = Date.now().toString(36);
    40    const random = Math.random().toString(36).substring(2, 8);
    41    return `sum_${timestamp}-${random}`;
    42  }
    

libs/iris/conversation-context/src/context-tracker.ts#

  • L49

    ts
    47  function createContextItemId(): string {
    48    const timestamp = Date.now().toString(36);
    49    const random = Math.random().toString(36).substring(2, 8);
    50    return `ctx_${timestamp}-${random}`;
    51  }
    

libs/iris/conversation-context/src/types.ts#

  • L26

    ts
    24  export function createTopicId(): TopicId {
    25    const timestamp = Date.now().toString(36);
    26    const random = Math.random().toString(36).substring(2, 8);
    27    return `topic_${timestamp}-${random}` as TopicId;
    28  }
    
  • L130

    ts
    128  export function createEntityId(): EntityId {
    129    const timestamp = Date.now().toString(36);
    130    const random = Math.random().toString(36).substring(2, 8);
    131    return `entity_${timestamp}-${random}` as EntityId;
    132  }
    

libs/iris/conversation-core/src/conversation-history.ts#

  • L43

    ts
    41  function createSnapshotId(): string {
    42    const timestamp = Date.now().toString(36);
    43    const random = Math.random().toString(36).substring(2, 8);
    44    return `snap_${timestamp}-${random}`;
    45  }
    

libs/iris/conversation-format/src/structured-data-formatter.ts#

  • L671

    ts
    669        return [
    670          {
    671            id: `node_${Math.random().toString(36).slice(2)}`,
    672            label: String(data),
    673            value: data,
    
  • L680

    ts
    678      if (Array.isArray(data)) {
    679        return data.map((item, i) => ({
    680          id: `node_${Math.random().toString(36).slice(2)}`,
    681          label: `[${i}]`,
    682          value: item,
    
  • L688

    ts
    686
    687      return Object.entries(data).map(([key, value]) => ({
    688        id: `node_${Math.random().toString(36).slice(2)}`,
    689        label: key,
    690        value,
    

libs/iris/conversation-format/src/types.ts#

  • L23

    ts
    21   */
    22  export function createFormatId(): FormatId {
    23    return `fmt_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as FormatId;
    24  }
    25
    
  • L35

    ts
    33   */
    34  export function createMediaId(): MediaId {
    35    return `media_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as MediaId;
    36  }
    37
    

libs/iris/conversation-intent/src/types.ts#

  • L98

    ts
    96  export function createIntentId(): IntentId {
    97    const timestamp = Date.now().toString(36);
    98    const random = Math.random().toString(36).substring(2, 8);
    99    return `intent_${timestamp}-${random}` as IntentId;
    100  }
    

libs/iris/conversation-orchestration/src/load-balancer.ts#

  • L322

    ts
    320      }
    321
    322      let random = Math.random() * totalWeight;
    323
    324      for (const provider of providers) {
    
  • L379

    ts
    377     */
    378    private selectRandom(providers: ModelProvider[]): ModelProvider {
    379      const index = Math.floor(Math.random() * providers.length);
    380      return providers[index];
    381    }
    

libs/iris/conversation-orchestration/src/model-orchestrator.ts#

  • L1101

    ts
    1099      if (config.jitter ?? this.retryConfig.jitter) {
    1100        const jitterFactor = config.jitterFactor ?? this.retryConfig.jitterFactor;
    1101        const jitter = delay * jitterFactor * (Math.random() * 2 - 1);
    1102        delay = delay + jitter;
    1103      }
    

libs/iris/conversation-rag/src/types.ts#

  • L44

    ts
    42   */
    43  export function createRAGPipelineId(): RAGPipelineId {
    44    return `rag_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as RAGPipelineId;
    45  }
    46
    
  • L56

    ts
    54   */
    55  export function createInjectionId(): InjectionId {
    56    return `inj_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as InjectionId;
    57  }
    58
    
  • L68

    ts
    66   */
    67  export function createSourceTrackingId(): SourceTrackingId {
    68    return `src_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as SourceTrackingId;
    69  }
    70
    

libs/iris/conversation-response/src/types.ts#

  • L23

    ts
    21   */
    22  export function createResponseId(): ResponseId {
    23    return `resp_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as ResponseId;
    24  }
    25
    
  • L35

    ts
    33   */
    34  export function createChunkId(): ChunkId {
    35    return `chunk_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as ChunkId;
    36  }
    37
    

libs/iris/conversation-state/src/types.ts#

  • L23

    ts
    21   */
    22  export function createCheckpointId(): CheckpointId {
    23    return `checkpoint_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as CheckpointId;
    24  }
    25
    
  • L35

    ts
    33   */
    34  export function createBranchId(): BranchId {
    35    return `branch_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as BranchId;
    36  }
    37
    

libs/iris/conversation-style/src/types.ts#

  • L28

    ts
    26   */
    27  export function createStyleProfileId(): StyleProfileId {
    28    return `style_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as StyleProfileId;
    29  }
    30
    
  • L35

    ts
    33   */
    34  export function createStyleSessionId(): StyleSessionId {
    35    return `session_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as StyleSessionId;
    36  }
    37
    

libs/iris/conversation/benchmarking/src/benchmark-suite.ts#

  • L59

    ts
    57    }> {
    58      // Simulate failure
    59      if (Math.random() < this.failureRate) {
    60        throw new Error('Mock API failure');
    61      }
    
  • L65

    ts
    63      // Simulate latency
    64      const latencyMs =
    65        this.latencyRange.min + Math.random() * (this.latencyRange.max - this.latencyRange.min);
    66
    67      await new Promise((resolve) => setTimeout(resolve, Math.min(latencyMs, 100)));
    
  • L71

    ts
    69      const inputTokens = Math.ceil(prompt.length / 4);
    70      const maxTokens = options?.maxTokens ?? 100;
    71      const outputTokens = Math.floor(Math.random() * maxTokens) + 10;
    72
    73      const output = `Mock response for: "${prompt.slice(0, 50)}..." with ${outputTokens} tokens.`;
    

libs/iris/conversation/finetuning/src/model-version-manager.ts#

  • L78

    ts
    76      return {
    77        response: `Mock response to: ${testPrompt.slice(0, 50)}...`,
    78        latencyMs: Math.floor(Math.random() * 500) + 100,
    79      };
    80    }
    

libs/iris/conversation/prompts/src/prompt-testing.ts#

  • L117

    ts
    115  function allocateRandom(variants: readonly PromptVariant[]): PromptVariant {
    116    const totalAllocation = variants.reduce((sum, v) => sum + v.allocation, 0);
    117    let random = Math.random() * totalAllocation;
    118
    119    for (const variant of variants) {
    
  • L191

    ts
    189  function gammaSample(shape: number): number {
    190    if (shape < 1) {
    191      return gammaSample(shape + 1) * Math.pow(Math.random(), 1 / shape);
    192    }
    193
    
  • L205

    ts
    203
    204      v = v * v * v;
    205      const u = Math.random();
    206
    207      if (u < 1 - 0.0331 * x * x * x * x) {
    
  • L223

    ts
    221    let u, v;
    222    do {
    223      u = Math.random();
    224      v = Math.random();
    225    } while (u === 0);
    
  • L224

    ts
    222    do {
    223      u = Math.random();
    224      v = Math.random();
    225    } while (u === 0);
    226
    

libs/iris/core/src/tracing/correlation.ts#

  • L302

    ts
    300   */
    301  export function generateTraceId(): string {
    302    const bytes = Array.from({ length: 16 }, () => Math.floor(Math.random() * 256));
    303    return bytes.map((b) => b.toString(16).padStart(2, '0')).join('');
    304  }
    
  • L310

    ts
    308   */
    309  export function generateSpanId(): string {
    310    const bytes = Array.from({ length: 8 }, () => Math.floor(Math.random() * 256));
    311    return bytes.map((b) => b.toString(16).padStart(2, '0')).join('');
    312  }
    

libs/iris/core/src/types.ts#

  • L242

    ts
    240  export function generateId(prefix?: string): string {
    241    const timestamp = Date.now().toString(36);
    242    const random = Math.random().toString(36).substring(2, 10);
    243    const id = `${timestamp}-${random}`;
    244    return prefix ? `${prefix}_${id}` : id;
    

libs/iris/embeddings/src/client.ts#

  • L480

    ts
    478      const exp = this.initialBackoffMs * Math.pow(2, attempt);
    479      const capped = Math.min(exp, this.maxBackoffMs);
    480      return Math.floor(Math.random() * capped);
    481    }
    482  }
    

libs/iris/emotional/ethics/src/ethical-boundaries.ts#

  • L582

    ts
    580     */
    581    private generateContextId(): EthicsContextId {
    582      return `ethics-${Date.now()}-${Math.random().toString(36).substring(2, 9)}` as EthicsContextId;
    583    }
    584
    
  • L589

    ts
    587     */
    588    private generateViolationId(): ViolationId {
    589      return `violation-${Date.now()}-${Math.random().toString(36).substring(2, 9)}` as ViolationId;
    590    }
    591
    

libs/iris/emotional/ethics/src/human-relationship-respect.ts#

  • L374

    ts
    372    getEncouragementMessage(action: RelationshipAction): string {
    373      const templates = ENCOURAGEMENT_TEMPLATES[action];
    374      const index = Math.floor(Math.random() * templates.length);
    375      return templates[index];
    376    }
    

libs/iris/emotional/rapport/src/rapport-builder.ts#

  • L971

    ts
    969     */
    970    private generateInteractionId(): string {
    971      return `int_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    972    }
    973
    

libs/iris/emotional/rapport/src/relationship-progress.ts#

  • L866

    ts
    864     */
    865    private generateRelationshipId(): string {
    866      return `rel_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    867    }
    868
    

libs/iris/emotional/recognition/src/utils.ts#

  • L33

    ts
    31   */
    32  export function createEmotionAnalysisId(): EmotionAnalysisId {
    33    return `emo_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as EmotionAnalysisId;
    34  }
    35
    
  • L40

    ts
    38   */
    39  export function createEmotionalStateId(): EmotionalStateId {
    40    return `state_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as EmotionalStateId;
    41  }
    42
    
  • L47

    ts
    45   */
    46  export function createEmotionSessionId(): EmotionSessionId {
    47    return `session_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as EmotionSessionId;
    48  }
    49
    

libs/iris/emotional/response/src/celebrator.ts#

  • L372

    ts
    370     */
    371    private selectRandom<T>(array: T[]): T {
    372      return array[Math.floor(Math.random() * array.length)];
    373    }
    374
    

libs/iris/emotional/response/src/emotional-adapter.ts#

  • L936

    ts
    934
    935    private generateAdaptationId(): AdaptationId {
    936      return `adapt_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as AdaptationId;
    937    }
    938
    
  • L940

    ts
    938
    939    private generateContextId(): ResponseContextId {
    940      return `ctx_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as ResponseContextId;
    941    }
    942
    

libs/iris/emotional/response/src/gratitude-journal.ts#

  • L404

    ts
    402
    403    private createEntryId(): GratitudeEntryId {
    404      return `grat_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}` as GratitudeEntryId;
    405    }
    406  }
    

libs/iris/emotional/response/src/pattern-insights.ts#

  • L265

    ts
    263
    264    private createInsightId(seed: string): string {
    265      return `insight_${seed}_${Math.random().toString(36).slice(2, 8)}`;
    266    }
    267  }
    

libs/iris/emotional/response/src/supporter.ts#

  • L465

    ts
    463     */
    464    private selectRandom<T>(array: T[]): T {
    465      return array[Math.floor(Math.random() * array.length)];
    466    }
    467
    

libs/iris/emotional/social/src/cultural-awareness.ts#

  • L575

    ts
    573     */
    574    private generateProfileId(): CulturalProfileId {
    575      return `cp_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as CulturalProfileId;
    576    }
    577
    

libs/iris/emotional/social/src/social-intelligence.ts#

  • L496

    ts
    494     */
    495    private generateContextId(): SocialContextId {
    496      return `sc_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as SocialContextId;
    497    }
    498
    

libs/iris/emotional/tracking/src/mood-tracker.ts#

  • L632

    ts
    630
    631    private generateProfileId(): TrackingProfileId {
    632      return `profile_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as TrackingProfileId;
    633    }
    634
    
  • L636

    ts
    634
    635    private generateEntryId(): MoodEntryId {
    636      return `entry_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as MoodEntryId;
    637    }
    638
    

libs/iris/emotional/tracking/src/pattern-analyzer.ts#

  • L612

    ts
    610
    611    private generatePatternId(): PatternId {
    612      return `pattern_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as PatternId;
    613    }
    614
    

libs/iris/emotional/tracking/src/trend-analyzer.ts#

  • L313

    ts
    311
    312    private generateTrendId(): TrendId {
    313      return `trend_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as TrendId;
    314    }
    315
    

libs/iris/emotional/wellbeing/src/gentle-checkin.ts#

  • L481

    ts
    479     */
    480    private generateCheckInId(): string {
    481      return `chk_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    482    }
    483
    

libs/iris/emotional/wellbeing/src/wellbeing-monitor.ts#

  • L602

    ts
    600     */
    601    private generateContextId(): string {
    602      return `wb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    603    }
    604
    

libs/iris/ensemble/src/ensemble-orchestrator.ts#

  • L121

    ts
    119    async execute(request: unknown): Promise<EnsembleResult<T>> {
    120      const ensembleId = createEnsembleId(
    121        `ensemble-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
    122      );
    123      const startTime = Date.now();
    

libs/iris/ensemble/src/voting-strategy.ts#

  • L103

    ts
    101      // Random tie break if allowed
    102      if (config.breakTiesRandomly) {
    103        return choices[Math.floor(Math.random() * choices.length)];
    104      }
    105
    

libs/iris/failover/src/failover-manager.ts#

  • L103

    ts
    101    ): Promise<FailoverExecutionResult> {
    102      const failoverId = createFailoverId(
    103        `failover-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
    104      );
    105      const startTime = Date.now();
    

libs/iris/failover/src/retry-policy.ts#

  • L256

    ts
    254
    255      const jitterRange = delay * jitterFactor;
    256      const jitter = Math.random() * jitterRange * 2 - jitterRange;
    257      return Math.max(0, delay + jitter);
    258    }
    

libs/iris/integrations/hathor/src/agents/base-agent.ts#

  • L277

    ts
    275     */
    276    protected generateTaskId(): string {
    277      return `${this.config.agentId}-task-${Date.now()}-${Math.random().toString(36).substring(2, 7)}`;
    278    }
    279
    

libs/iris/integrations/hathor/src/agents/lore-keeper-agent.ts#

  • L734

    ts
    732
    733    private generateGapId(): string {
    734      return `gap-${Date.now()}-${Math.random().toString(36).substring(2, 7)}`;
    735    }
    736
    

libs/iris/integrations/hathor/src/context/lore-context-manager.ts#

  • L523

    ts
    521
    522    private generateId(prefix: string): string {
    523      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`;
    524    }
    525  }
    

libs/iris/integrations/maya/src/agents/asset-creator-agent.ts#

  • L1028

    ts
    1026
    1027    private generateAssetId(): string {
    1028      return `asset_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1029    }
    1030
    
  • L1032

    ts
    1030
    1031    private generateRequestId(): string {
    1032      return `req_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1033    }
    1034
    

libs/iris/integrations/maya/src/agents/base-agent.ts#

  • L221

    ts
    219     */
    220    private generateTaskId(): string {
    221      return `${this.config.agentId}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    222    }
    223
    

libs/iris/integrations/maya/src/agents/npc-control-agent.ts#

  • L750

    ts
    748      // Random movement within a radius
    749      const wanderRadius = (npc.definition.aiParams?.wanderRadius as number) ?? 10;
    750      const angle = Math.random() * Math.PI * 2;
    751      const distance = Math.random() * wanderRadius;
    752
    
  • L751

    ts
    749      const wanderRadius = (npc.definition.aiParams?.wanderRadius as number) ?? 10;
    750      const angle = Math.random() * Math.PI * 2;
    751      const distance = Math.random() * wanderRadius;
    752
    753      npc.currentPosition.x += Math.cos(angle) * distance * 0.01;
    
  • L787

    ts
    785      const dialogue = npc.definition.dialogue;
    786      if (dialogue && dialogue.length > 0) {
    787        const randomLine = dialogue[Math.floor(Math.random() * dialogue.length)];
    788        npc.conversationHistory.push({
    789          speaker: npc.definition.name,
    
  • L901

    ts
    899
    900    private generateNPCId(templateId: string): string {
    901      return `npc_${templateId}_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`;
    902    }
    903
    

libs/iris/integrations/maya/src/agents/scripting-assistant.ts#

  • L656

    ts
    654      this.updateProgress(0.3);
    655
    656      const templateId = `template_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`;
    657
    658      const template: ScriptTemplate = {
    

libs/iris/integrations/maya/src/agents/world-builder-agent.ts#

  • L570

    ts
    568
    569    private generateObjectId(): string {
    570      return `obj_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    571    }
    572
    
  • L669

    ts
    667        type: poi.type as 'landmark' | 'shop' | 'quest' | 'portal' | 'resource' | 'danger',
    668        position: {
    669          x: center.x + (Math.random() - 0.5) * params.size.x * 0.8,
    670          y: center.y,
    671          z: center.z + (Math.random() - 0.5) * params.size.z * 0.8,
    
  • L671

    ts
    669          x: center.x + (Math.random() - 0.5) * params.size.x * 0.8,
    670          y: center.y,
    671          z: center.z + (Math.random() - 0.5) * params.size.z * 0.8,
    672        },
    673        description: `${poi.name} in ${params.name}`,
    

libs/iris/integrations/maya/src/commands/world-commands.ts#

  • L720

    ts
    718
    719    private generateCommandId(): string {
    720      return `cmd-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    721    }
    722
    

libs/iris/integrations/maya/src/companion/maya-companion.ts#

  • L736

    ts
    734
    735      // Check for things to comment on
    736      if (context.threats.length > 0 && Math.random() < 0.5) {
    737        this.speak(`Be careful! ${context.threats[0]}`);
    738        return;
    
  • L741

    ts
    739      }
    740
    741      if (context.nearbyPOIs.length > 0 && Math.random() < 0.3) {
    742        const poi = context.nearbyPOIs[0];
    743        this.speak(`There's ${poi.name} to the ${poi.direction}. Want to check it out?`);
    
  • L747

    ts
    745      }
    746
    747      if (context.relevantQuests.length > 0 && Math.random() < 0.3) {
    748        this.speak(`Don't forget: ${context.relevantQuests[0]}`);
    749      }
    
  • L787

    ts
    785
    786    private generateId(): string {
    787      return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    788    }
    789
    

libs/iris/integrations/nyx/src/agents/base-agent.ts#

  • L272

    ts
    270     */
    271    protected generateTaskId(): string {
    272      return `${this.config.agentId}-task-${Date.now()}-${Math.random().toString(36).substring(2, 7)}`;
    273    }
    274
    

libs/iris/integrations/nyx/src/agents/observation-planner-agent.ts#

  • L787

    ts
    785
    786    private generateSessionId(): SessionId {
    787      return `session-${Date.now()}-${Math.random().toString(36).substring(2, 7)}` as SessionId;
    788    }
    789
    

libs/iris/integrations/nyx/src/observations/observation-planning-service.ts#

  • L598

    ts
    596    ): Date | undefined {
    597      // Simplified - return date + random offset for demo
    598      return new Date(date.getTime() + Math.random() * 8 * 3600000);
    599    }
    600
    

libs/iris/integrations/psyche/src/agents/avatar-presenter-agent.ts#

  • L606

    ts
    604
    605        // Random idle behavior
    606        const random = Math.random();
    607
    608        if (random < 0.3) {
    
  • L648

    ts
    646      if (!this.currentState) return;
    647
    648      const smallAngle = (Math.random() - 0.5) * 0.05;
    649      this.currentState.parameters.pose.head[0] += smallAngle;
    650      this.currentState.parameters.pose.head[1] += (Math.random() - 0.5) * 0.03;
    
  • L650

    ts
    648      const smallAngle = (Math.random() - 0.5) * 0.05;
    649      this.currentState.parameters.pose.head[0] += smallAngle;
    650      this.currentState.parameters.pose.head[1] += (Math.random() - 0.5) * 0.03;
    651      this.currentState.timestamp = Date.now();
    652    }
    
  • L658

    ts
    656
    657      // Small intensity variation
    658      const variation = (Math.random() - 0.5) * 0.1;
    659      this.currentState.expression.intensity = Math.max(
    660        0,
    

libs/iris/integrations/psyche/src/agents/conference-participant-agent.ts#

  • L62

    ts
    60  /** Generate session ID */
    61  function generateSessionId(): SessionId {
    62    return `session_${Math.random().toString(36).substring(2, 15)}_${Date.now()}` as SessionId;
    63  }
    64
    
  • L67

    ts
    65  /** Generate conference ID */
    66  function generateConferenceId(): ConferenceId {
    67    return `conf_${Math.random().toString(36).substring(2, 15)}` as ConferenceId;
    68  }
    69
    

libs/iris/integrations/psyche/src/agents/persona-manager-agent.ts#

  • L47

    ts
    45  /** Generate persona ID */
    46  function generatePersonaId(): PersonaId {
    47    return `persona_${Math.random().toString(36).substring(2, 15)}_${Date.now()}` as PersonaId;
    48  }
    49
    
  • L52

    ts
    50  /** Generate memory ID */
    51  function generateMemoryId(): string {
    52    return `memory_${Math.random().toString(36).substring(2, 15)}_${Date.now()}`;
    53  }
    54
    

libs/iris/integrations/psyche/src/avatar/avatar-service.ts#

  • L96

    ts
    94  /** Generate avatar ID */
    95  function generateAvatarId(): AvatarId {
    96    return `avatar_${Math.random().toString(36).substring(2, 15)}_${Date.now()}` as AvatarId;
    97  }
    98
    
  • L622

    ts
    620   * here so existing tests and consumers behave unchanged). All
    621   * outputs are reproducible: same input → identical bytes; no
    622   * Math.random.
    623   */
    624  export const DeterministicLocalAvatarProvider: AvatarProvider = {
    

libs/iris/integrations/psyche/src/conferencing/conferencing-service.ts#

  • L83

    ts
    81  /** Generate session ID */
    82  function generateSessionId(): SessionId {
    83    return `session_${Math.random().toString(36).substring(2, 15)}_${Date.now()}` as SessionId;
    84  }
    85
    
  • L88

    ts
    86  /** Generate conference ID */
    87  function generateConferenceId(): ConferenceId {
    88    return `conf_${Math.random().toString(36).substring(2, 15)}` as ConferenceId;
    89  }
    90
    

libs/iris/integrations/psyche/src/emotion/emotion-service.ts#

  • L202

    ts
    200  /** Generate emotion state ID */
    201  function generateEmotionStateId(): EmotionStateId {
    202    return `emotion_${Math.random().toString(36).substring(2, 15)}_${Date.now()}` as EmotionStateId;
    203  }
    204
    
  • L636

    ts
    634      // Trigger subtle micro-expressions periodically
    635      this.microExpressionTimer = setInterval(() => {
    636        if (Math.random() < 0.1) {
    637          // 10% chance per interval
    638          this.triggerMicroExpression();
    
  • L646

    ts
    644      // Brief, subtle expression variations
    645      const microEmotions: ExtendedEmotion[] = ['curious', 'serious', 'friendly'];
    646      const randomEmotion = microEmotions[Math.floor(Math.random() * microEmotions.length)];
    647      const intensity = 0.2 + Math.random() * 0.3; // Low intensity
    648
    
  • L647

    ts
    645      const microEmotions: ExtendedEmotion[] = ['curious', 'serious', 'friendly'];
    646      const randomEmotion = microEmotions[Math.floor(Math.random() * microEmotions.length)];
    647      const intensity = 0.2 + Math.random() * 0.3; // Low intensity
    648
    649      this.emit('microexpression:triggered', randomEmotion, intensity);
    

libs/iris/integrations/sophia/src/agents/citation-manager-agent.ts#

  • L43

    ts
    41  /** Generate citation ID */
    42  function generateCitationId(): CitationId {
    43    return `cit_${Math.random().toString(36).substring(2, 15)}` as CitationId;
    44  }
    45
    
  • L48

    ts
    46  /** Generate document ID */
    47  function generateDocumentId(): DocumentId {
    48    return `doc_${Math.random().toString(36).substring(2, 15)}` as DocumentId;
    49  }
    50
    

libs/iris/integrations/sophia/src/agents/knowledge-synthesizer-agent.ts#

  • L50

    ts
    48  /** Generate entity ID */
    49  function generateEntityId(): EntityId {
    50    return `ent_${Math.random().toString(36).substring(2, 15)}` as EntityId;
    51  }
    52
    
  • L55

    ts
    53  /** Generate knowledge pack ID */
    54  function generateKnowledgePackId(): KnowledgePackId {
    55    return `kp_${Math.random().toString(36).substring(2, 15)}` as KnowledgePackId;
    56  }
    57
    

libs/iris/integrations/sophia/src/agents/literature-reviewer-agent.ts#

  • L46

    ts
    44  /** Generate mock document ID */
    45  function generateDocumentId(): DocumentId {
    46    return `doc_${Math.random().toString(36).substring(2, 15)}` as DocumentId;
    47  }
    48
    
  • L275

    ts
    273      const result: LiteratureSearchResult = {
    274        query,
    275        totalFound: papers.length + Math.floor(Math.random() * 100),
    276        papers,
    277        facets,
    
  • L448

    ts
    446          documentType: DOCUMENT_TYPES[i % DOCUMENT_TYPES.length],
    447          abstract: `This study investigates ${query} using advanced methodologies and presents significant findings.`,
    448          citationCount: Math.floor(Math.random() * 200),
    449          relevanceScore: 0.95 - i * 0.03,
    450        });
    
  • L510

    ts
    508          name: themeNames[i % themeNames.length],
    509          description: `This theme explores ${themeNames[i % themeNames.length].toLowerCase()} in the context of ${topic}.`,
    510          paperCount: 5 + Math.floor(Math.random() * 15),
    511          keyPapers,
    512        });
    
  • L600

    ts
    598        id: `cluster_${index}`,
    599        name,
    600        nodeCount: 10 + Math.floor(Math.random() * 30),
    601        centralPaper: seedDocuments[index % seedDocuments.length] ?? generateDocumentId(),
    602      }));
    
  • L613

    ts
    611          documentId: generateDocumentId(),
    612          title: `Influential Study on Research Methodology (${i + 1})`,
    613          citationCount: 100 + Math.floor(Math.random() * 500),
    614          influence: 0.95 - i * 0.05,
    615        });
    
  • L639

    ts
    637      for (let year = yearRange.start; year <= yearRange.end; year++) {
    638        const baseCount = 50 + (year - yearRange.start) * 15;
    639        const publicationCount = baseCount + Math.floor(Math.random() * 30);
    640        const citationCount = publicationCount * (5 + Math.floor(Math.random() * 10));
    641
    
  • L640

    ts
    638        const baseCount = 50 + (year - yearRange.start) * 15;
    639        const publicationCount = baseCount + Math.floor(Math.random() * 30);
    640        const citationCount = publicationCount * (5 + Math.floor(Math.random() * 10));
    641
    642        dataPoints.push({
    

libs/iris/integrations/sophia/src/agents/research-assistant-agent.ts#

  • L42

    ts
    40  /** Generate mock document ID */
    41  function generateDocumentId(): DocumentId {
    42    return `doc_${Math.random().toString(36).substring(2, 15)}` as DocumentId;
    43  }
    44
    
  • L326

    ts
    324
    325      for (const source of sources) {
    326        const supports = Math.random() > 0.3;
    327        const evidence = {
    328          source: {
    
  • L338

    ts
    336        if (supports) {
    337          supportingEvidence.push(evidence);
    338        } else if (Math.random() > 0.5) {
    339          contradictingEvidence.push(evidence);
    340        }
    
  • L536

    ts
    534            text: sentence,
    535            sourceIndex,
    536            confidence: 0.7 + Math.random() * 0.3,
    537          });
    538        }
    

libs/iris/integrations/sophia/src/citations/citation-manager-service.ts#

  • L84

    ts
    82  /** Generate citation ID */
    83  function generateCitationId(): CitationId {
    84    return `cit_${Math.random().toString(36).substring(2, 15)}` as CitationId;
    85  }
    86
    

libs/iris/integrations/sophia/src/knowledge/knowledge-base-service.ts#

  • L116

    ts
    114  /** Generate entity ID */
    115  function generateEntityId(): EntityId {
    116    return `ent_${Math.random().toString(36).substring(2, 15)}` as EntityId;
    117  }
    118
    
  • L121

    ts
    119  /** Generate knowledge pack ID */
    120  function generateKnowledgePackId(): KnowledgePackId {
    121    return `kp_${Math.random().toString(36).substring(2, 15)}` as KnowledgePackId;
    122  }
    123
    
  • L139

    ts
    137      properties,
    138      sourceDocuments: [],
    139      mentionCount: Math.floor(Math.random() * 50) + 1,
    140      createdAt: now - Math.floor(Math.random() * 86400000),
    141      updatedAt: now,
    
  • L140

    ts
    138      sourceDocuments: [],
    139      mentionCount: Math.floor(Math.random() * 50) + 1,
    140      createdAt: now - Math.floor(Math.random() * 86400000),
    141      updatedAt: now,
    142    };
    
  • L152

    ts
    150  ): EntityRelation {
    151    return {
    152      id: `rel_${Math.random().toString(36).substring(2, 15)}`,
    153      sourceId,
    154      targetId,
    
  • L156

    ts
    154      targetId,
    155      type,
    156      weight: Math.random() * 0.5 + 0.5,
    157      evidence: ['Found in research literature'],
    158      sourceDocuments: [],
    
  • L449

    ts
    447
    448      const relation: EntityRelation = {
    449        id: `rel_${Math.random().toString(36).substring(2, 15)}`,
    450        sourceId,
    451        targetId,
    

libs/iris/integrations/sophia/src/research/research-assistant-service.ts#

  • L195

    ts
    193  /** Generate mock document ID */
    194  function generateDocumentId(): DocumentId {
    195    return `doc_${Math.random().toString(36).substring(2, 15)}` as DocumentId;
    196  }
    197
    
  • L204

    ts
    202      affiliation,
    203      orcid:
    204        Math.random() > 0.5
    205          ? `0000-000${Math.floor(Math.random() * 10)}-${Math.floor(Math.random() * 10000)
    206              .toString()
    
  • L205

    ts
    203      orcid:
    204        Math.random() > 0.5
    205          ? `0000-000${Math.floor(Math.random() * 10)}-${Math.floor(Math.random() * 10000)
    206              .toString()
    207              .padStart(4, '0')}-${Math.floor(Math.random() * 10000)
    
  • L207

    ts
    205          ? `0000-000${Math.floor(Math.random() * 10)}-${Math.floor(Math.random() * 10000)
    206              .toString()
    207              .padStart(4, '0')}-${Math.floor(Math.random() * 10000)
    208              .toString()
    209              .padStart(4, '0')}`
    
  • L241

    ts
    239      title: titles[index % titles.length],
    240      authors: selectedAuthors.map((name) => generateMockAuthor(name, 'University Research Center')),
    241      year: 2020 + Math.floor(Math.random() * 5),
    242      relevance,
    243      excerpt: `This research demonstrates significant findings related to ${topic}. Our analysis shows that the underlying mechanisms involve complex interactions between multiple factors, leading to observable outcomes that align with theoretical predictions.`,
    
  • L255

    ts
    253    let position = 0;
    254    sentences.forEach((sentence, index) => {
    255      if (index > 0 && Math.random() > 0.4 && sources.length > 0) {
    256        const sourceIndex = Math.floor(Math.random() * Math.min(sources.length, 3));
    257        citations.push({
    
  • L256

    ts
    254    sentences.forEach((sentence, index) => {
    255      if (index > 0 && Math.random() > 0.4 && sources.length > 0) {
    256        const sourceIndex = Math.floor(Math.random() * Math.min(sources.length, 3));
    257        citations.push({
    258          text: sentence,
    
  • L264

    ts
    262          },
    263          sourceIndex,
    264          confidence: 0.7 + Math.random() * 0.3,
    265        });
    266      }
    
  • L849

    ts
    847; // canonical production path), and a deterministic token-overlap
    848; // (Jaccard) fallback otherwise. Either branch is reproducible —
    849; // the previous `Math.random() * 0.3 + 0.7` value reshuffled every
    850; // call.
    851; //
    
  • L983

    ts
    981   * degenerate on completely orthogonal pairs. This is the
    982   * deterministic local fallback used when no embedding client is
    983   * configured. Same input → same output, no Math.random involved.
    984   *
    985   * Exported for unit tests at `__tests__/research-claim-relevance.test.ts`.
    

libs/iris/integrations/sophia/src/search/literature-search-service.ts#

  • L172

    ts
    170  /** Generate query ID */
    171  function generateQueryId(): QueryId {
    172    return `qry_${Math.random().toString(36).substring(2, 15)}` as QueryId;
    173  }
    174
    
  • L177

    ts
    175  /** Generate document ID */
    176  function generateDocumentId(): DocumentId {
    177    return `doc_${Math.random().toString(36).substring(2, 15)}` as DocumentId;
    178  }
    179
    
  • L203

    ts
    201      affiliation,
    202      orcid:
    203        Math.random() > 0.5
    204          ? `0000-000${seed % 10}-${(seed * 1234) % 10000}-${(seed * 5678) % 10000}`
    205          : undefined,
    
  • L268

    ts
    266      status: 'indexed',
    267      abstract: abstracts[index % abstracts.length],
    268      citationCount: Math.floor(Math.random() * 500),
    269      relevanceScore: relevance,
    270    };
    
  • L663

    ts
    661        // Simulate growing trend with some variation
    662        const baseCount = 50 + (year - yearRange.start) * 20;
    663        const publicationCount = baseCount + Math.floor(Math.random() * 30);
    664        const citationCount = publicationCount * (5 + Math.floor(Math.random() * 10));
    665
    
  • L664

    ts
    662        const baseCount = 50 + (year - yearRange.start) * 20;
    663        const publicationCount = baseCount + Math.floor(Math.random() * 30);
    664        const citationCount = publicationCount * (5 + Math.floor(Math.random() * 10));
    665
    666        if (publicationCount > peakCount) {
    
  • L732

    ts
    730      for (let i = 0; i < limit; i++) {
    731        const author = generateMockAuthor(i);
    732        const documentCount = 10 + Math.floor(Math.random() * 90);
    733        const citationCount = documentCount * (20 + Math.floor(Math.random() * 100));
    734        const hIndex = Math.floor(Math.sqrt(citationCount / 10));
    
  • L733

    ts
    731        const author = generateMockAuthor(i);
    732        const documentCount = 10 + Math.floor(Math.random() * 90);
    733        const citationCount = documentCount * (20 + Math.floor(Math.random() * 100));
    734        const hIndex = Math.floor(Math.sqrt(citationCount / 10));
    735
    

libs/iris/integrations/yemaya/src/agents/asset-organizer-agent.ts#

  • L866

    ts
    864        if (assets.length > 1) {
    865          // Simulate visual similarity
    866          const similarity = 0.85 + Math.random() * 0.1;
    867          if (similarity >= threshold) {
    868            const group: DuplicateGroup = {
    
  • L1022

    ts
    1020            case 'usage': {
    1021              // Simulate usage frequency
    1022              const usageScore = Math.random();
    1023              let usageCategory: string;
    1024              if (usageScore > 0.7) {
    
  • L1200

    ts
    1198          metadata.colorSpace = 'sRGB';
    1199          metadata.dpi = 72;
    1200          metadata.hasAlpha = Math.random() > 0.5;
    1201        } else if (assetCategory === 'video') {
    1202          metadata.width = 1920;
    
  • L1204

    ts
    1202          metadata.width = 1920;
    1203          metadata.height = 1080;
    1204          metadata.duration = 30 + Math.random() * 300;
    1205          metadata.frameRate = 24;
    1206          metadata.codec = 'H.264';
    
  • L1209

    ts
    1207          metadata.hasAudio = true;
    1208        } else if (assetCategory === 'audio') {
    1209          metadata.duration = 60 + Math.random() * 240;
    1210          metadata.sampleRate = 44100;
    1211          metadata.channels = 2;
    
  • L1214

    ts
    1212          metadata.bitRate = 320000;
    1213        } else if (assetCategory === 'document') {
    1214          metadata.pageCount = Math.floor(1 + Math.random() * 20);
    1215          metadata.wordCount = Math.floor(100 + Math.random() * 5000);
    1216        }
    
  • L1215

    ts
    1213        } else if (assetCategory === 'document') {
    1214          metadata.pageCount = Math.floor(1 + Math.random() * 20);
    1215          metadata.wordCount = Math.floor(100 + Math.random() * 5000);
    1216        }
    1217
    

libs/iris/integrations/yemaya/src/agents/audio-mixer-agent.ts#

  • L919

    ts
    917
    918      // Check for potential issues
    919      const simulatedPeak = -3 + Math.random() * 6;
    920      const simulatedRms = -18 + Math.random() * 12;
    921      const simulatedLoudness = -16 + Math.random() * 8;
    
  • L920

    ts
    918      // Check for potential issues
    919      const simulatedPeak = -3 + Math.random() * 6;
    920      const simulatedRms = -18 + Math.random() * 12;
    921      const simulatedLoudness = -16 + Math.random() * 8;
    922
    
  • L921

    ts
    919      const simulatedPeak = -3 + Math.random() * 6;
    920      const simulatedRms = -18 + Math.random() * 12;
    921      const simulatedLoudness = -16 + Math.random() * 8;
    922
    923      if (simulatedPeak > -1) {
    
  • L953

    ts
    951      const spectrum: number[] = [];
    952      for (let i = 0; i < 32; i++) {
    953        spectrum.push(-60 + Math.random() * 50);
    954      }
    955
    
  • L975

    ts
    973        loudness: {
    974          integrated: simulatedLoudness,
    975          range: 8 + Math.random() * 6,
    976          peak: simulatedPeak,
    977          truePeak: simulatedPeak + 0.5,
    
  • L981

    ts
    979        spectrum,
    980        dynamics: {
    981          crest: 12 + Math.random() * 8,
    982          rms: simulatedRms,
    983          peakToAverage: Math.abs(simulatedPeak - simulatedRms),
    

libs/iris/integrations/yemaya/src/agents/base-agent.ts#

  • L324

    ts
    322     */
    323    protected generateTaskId(): string {
    324      return `task_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`;
    325    }
    326
    
  • L331

    ts
    329     */
    330    protected generateId(prefix: string = 'id'): string {
    331      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`;
    332    }
    333
    

libs/iris/integrations/yemaya/src/agents/design-analyzer.ts#

  • L147

    ts
    145
    146  /**
    147   * Real analyzer with no Math.random. Runs deterministic algorithms
    148   * over the supplied source data; abstains rather than fabricates
    149   * when data is missing.
    
  • L522

    ts
    520   * and override `analyzeComposition` to call into a real vision
    521   * model (CLIP, SAM, etc.). The default implementation never returns
    522   * `Math.random` — it deterministically reflects the input bytes.
    523   */
    524  function computeGridEnergy(bytes: Uint8Array, rows: number, cols: number): number[][] {
    

libs/iris/integrations/yemaya/src/agents/design-assistant.ts#

  • L797

    ts
    795     *
    796     * All outputs are deterministic for a given image — no
    797     * `Math.random` anywhere in the pipeline.
    798     */
    799    private async executeAnalyzeComposition(
    

libs/iris/integrations/yemaya/src/agents/video-editor-agent.ts#

  • L820

    ts
    818; // resolvable filesystem path. Both the metadata path and the
    819; // signal path are deterministic — given the same clips, ranks are
    820; // stable across runs (the prior `Math.random()` value reshuffled
    821; // every call). The metadata score uses post-mix volume (audio
    822; // energy proxy), effect / transition counts and speed-ramp
    
  • L901

    ts
    899
    900      // Calculate sync offset (simulated)
    901      const offset = (Math.random() - 0.5) * 0.5; // -0.25 to 0.25 seconds
    902
    903      // Apply offset
    

libs/iris/integrations/yemaya/src/context/project-context-manager.ts#

  • L630

    ts
    628
    629      const activity: ActivityEntry = {
    630        id: `activity_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`,
    631        type: this.mapEventToActivityType(event.type),
    632        userId: event.userId,
    

libs/iris/integrations/yemaya/src/suggestions/creative-suggestions.ts#

  • L613

    ts
    611          confidence: 0.6,
    612          createdAt: Date.now(),
    613          shotType: suggestedShots[Math.floor(Math.random() * suggestedShots.length)],
    614          cameraAngle: suggestedAngles[Math.floor(Math.random() * suggestedAngles.length)],
    615          cameraMovement: suggestedMovements[Math.floor(Math.random() * suggestedMovements.length)],
    
  • L614

    ts
    612          createdAt: Date.now(),
    613          shotType: suggestedShots[Math.floor(Math.random() * suggestedShots.length)],
    614          cameraAngle: suggestedAngles[Math.floor(Math.random() * suggestedAngles.length)],
    615          cameraMovement: suggestedMovements[Math.floor(Math.random() * suggestedMovements.length)],
    616        });
    
  • L615

    ts
    613          shotType: suggestedShots[Math.floor(Math.random() * suggestedShots.length)],
    614          cameraAngle: suggestedAngles[Math.floor(Math.random() * suggestedAngles.length)],
    615          cameraMovement: suggestedMovements[Math.floor(Math.random() * suggestedMovements.length)],
    616        });
    617      }
    
  • L1091

    ts
    1089
    1090    private generateSuggestionId(category: string): string {
    1091      return `${category}_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`;
    1092    }
    1093
    

libs/iris/integrations/yemaya/src/workflow/workflow-automation.ts#

  • L677

    ts
    675    ): WorkflowExecution {
    676      return {
    677        id: `exec_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`,
    678        workflowId: workflow.id,
    679        status: 'running',
    

libs/iris/knowledge/chunking/src/chunking-pipeline.ts#

  • L452

    ts
    450
    451      return {
    452        id: `chunk_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as any,
    453        documentId: document.id,
    454        content,
    

libs/iris/knowledge/chunking/src/types.ts#

  • L24

    ts
    22  /** Create a chunk ID */
    23  export function createChunkId(id?: string): ChunkId {
    24    return (id ?? `chunk_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as ChunkId;
    25  }
    26
    
  • L29

    ts
    27  /** Create a document ID */
    28  export function createDocumentId(id?: string): DocumentId {
    29    return (id ?? `doc_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as DocumentId;
    30  }
    31
    

libs/iris/knowledge/core/src/knowledge-conflict-detector.ts#

  • L139

    ts
    137
    138  function createConflictId(): string {
    139    return `conflict_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 9)}`;
    140  }
    141
    

libs/iris/knowledge/core/src/knowledge-curation-interface.ts#

  • L225

    ts
    223
    224  function createTaskId(seed?: string): KnowledgeCurationTaskId {
    225    const base = seed ?? `cur_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 9)}`;
    226    return base as KnowledgeCurationTaskId;
    227  }
    
  • L230

    ts
    228
    229  function createHistoryId(): string {
    230    return `evt_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    231  }
    232
    

libs/iris/knowledge/core/src/knowledge-federation-manager.ts#

  • L143

    ts
    141
    142  function createId(prefix: string): string {
    143    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 9)}`;
    144  }
    145
    

libs/iris/knowledge/core/src/knowledge-marketplace.ts#

  • L177

    ts
    175
    176  function createId(prefix: string): string {
    177    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 9)}`;
    178  }
    179
    

libs/iris/knowledge/core/src/knowledge-monetization.ts#

  • L197

    ts
    195
    196  function createId(prefix: string): string {
    197    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    198  }
    199
    

libs/iris/knowledge/core/src/knowledge-sharing-permissions.ts#

  • L204

    ts
    202
    203  function createId(prefix: string): string {
    204    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    205  }
    206
    

libs/iris/knowledge/core/src/knowledge-types.ts#

  • L54

    ts
    52   */
    53  export function createKnowledgeId(seed?: string): KnowledgeId {
    54    const base = seed ?? `know_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    55    return base as KnowledgeId;
    56  }
    
  • L62

    ts
    60   */
    61  export function createSourceId(seed?: string): SourceId {
    62    const base = seed ?? `src_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    63    return base as SourceId;
    64  }
    
  • L70

    ts
    68   */
    69  export function createChunkId(seed?: string): ChunkId {
    70    const base = seed ?? `chunk_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    71    return base as ChunkId;
    72  }
    
  • L78

    ts
    76   */
    77  export function createIndexEntryId(seed?: string): IndexEntryId {
    78    const base = seed ?? `idx_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    79    return base as IndexEntryId;
    80  }
    
  • L86

    ts
    84   */
    85  export function createQueryId(seed?: string): QueryId {
    86    const base = seed ?? `qry_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    87    return base as QueryId;
    88  }
    
  • L94

    ts
    92   */
    93  export function createCollectionId(seed?: string): CollectionId {
    94    const base = seed ?? `col_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    95    return base as CollectionId;
    96  }
    

libs/iris/knowledge/curation/src/utils.ts#

  • L96

    ts
    94
    95  export function createItemId(seed = 'curated'): CurationItemId {
    96    return `${seed}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as CurationItemId;
    97  }
    

libs/iris/knowledge/embeddings/src/types.ts#

  • L39

    ts
    37    const timestamp = Date.now();
    38    const counter = ++embeddingCounter;
    39    const random = Math.random().toString(36).substring(2, 8);
    40    return `emb_${timestamp}_${counter}_${random}` as EmbeddingId;
    41  }
    

libs/iris/knowledge/enterprise/src/base-connector.ts#

  • L394

    ts
    392
    393      // Add jitter
    394      const jitter = cappedDelay * this.policy.jitterFactor * Math.random();
    395
    396      return cappedDelay + jitter;
    

libs/iris/knowledge/factcheck/src/utils.ts#

  • L8

    ts
    6
    7  export function createClaimId(seed = 'claim'): ClaimId {
    8    return `${seed}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as ClaimId;
    9  }
    10
    
  • L12

    ts
    10
    11  export function createSourceId(seed = 'source'): SourceId {
    12    return `${seed}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as SourceId;
    13  }
    14
    

libs/iris/knowledge/freshness/src/types.ts#

  • L50

    ts
    48  /** Create a unique document ID */
    49  export function createDocumentId(): DocumentId {
    50    return `doc_${Date.now()}_${++documentIdCounter}_${Math.random().toString(36).slice(2, 8)}` as DocumentId;
    51  }
    52
    
  • L55

    ts
    53  /** Create a unique version ID */
    54  export function createVersionId(): VersionId {
    55    return `ver_${Date.now()}_${++versionIdCounter}_${Math.random().toString(36).slice(2, 8)}` as VersionId;
    56  }
    57
    
  • L60

    ts
    58  /** Create a unique freshness record ID */
    59  export function createFreshnessRecordId(): FreshnessRecordId {
    60    return `fr_${Date.now()}_${++freshnessRecordIdCounter}_${Math.random().toString(36).slice(2, 8)}` as FreshnessRecordId;
    61  }
    62
    
  • L65

    ts
    63  /** Create a unique change event ID */
    64  export function createChangeEventId(): ChangeEventId {
    65    return `ce_${Date.now()}_${++changeEventIdCounter}_${Math.random().toString(36).slice(2, 8)}` as ChangeEventId;
    66  }
    67
    
  • L70

    ts
    68  /** Create a unique subscriber ID */
    69  export function createSubscriberId(): SubscriberId {
    70    return `sub_${Date.now()}_${++subscriberIdCounter}_${Math.random().toString(36).slice(2, 8)}` as SubscriberId;
    71  }
    72
    
  • L75

    ts
    73  /** Create a unique index ID */
    74  export function createIndexId(): IndexId {
    75    return `idx_${Date.now()}_${++indexIdCounter}_${Math.random().toString(36).slice(2, 8)}` as IndexId;
    76  }
    77
    

libs/iris/knowledge/graph/src/utils.ts#

  • L13

    ts
    11
    12  export function createEntityId(seed: string): string {
    13    return `kge_${seed}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    14  }
    15
    
  • L17

    ts
    15
    16  export function createRelationId(seed: string): string {
    17    return `kgr_${seed}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    18  }
    19
    

libs/iris/knowledge/personal/src/document-types.ts#

  • L47

    ts
    45   */
    46  export function createDocumentId(seed?: string): DocumentId {
    47    const base = seed ?? `doc_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    48    return base as DocumentId;
    49  }
    
  • L55

    ts
    53   */
    54  export function createWatchId(seed?: string): WatchId {
    55    const base = seed ?? `watch_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    56    return base as WatchId;
    57  }
    
  • L63

    ts
    61   */
    62  export function createIndexJobId(seed?: string): IndexJobId {
    63    const base = seed ?? `job_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    64    return base as IndexJobId;
    65  }
    

libs/iris/knowledge/retrieval/src/dense-retriever.ts#

  • L412

    ts
    410    private getRandomLevel(): number {
    411      let level = 0;
    412      while (Math.random() < 0.5 && level < this.maxLevel) {
    413        level++;
    414      }
    

libs/iris/knowledge/retrieval/src/evaluation.ts#

  • L618

    ts
    616      const sample: number[] = [];
    617      for (let j = 0; j < scores.length; j++) {
    618        const idx = Math.floor(Math.random() * scores.length);
    619        sample.push(scores[idx]);
    620      }
    

libs/iris/knowledge/retrieval/src/multi-vector-retriever.ts#

  • L332

    ts
    330        let norm = 0;
    331        for (let j = 0; j < this.dimension; j++) {
    332          centroid[j] = Math.random() * 2 - 1;
    333          norm += centroid[j] * centroid[j];
    334        }
    
  • L387

    ts
    385
    386      // Choose first centroid randomly
    387      const firstIdx = Math.floor(Math.random() * embeddings.length);
    388      centroids.push([...embeddings[firstIdx]]);
    389
    
  • L409

    ts
    407
    408        // Sample proportional to squared distance
    409        let sample = Math.random() * totalDist;
    410        let selectedIdx = 0;
    411        for (let j = 0; j < distances.length; j++) {
    

libs/iris/knowledge/retrieval/src/types.ts#

  • L24

    ts
    22  /** Create a document ID */
    23  export function createDocumentId(id?: string): DocumentId {
    24    return (id ?? `doc_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as DocumentId;
    25  }
    26
    
  • L29

    ts
    27  /** Create an index ID */
    28  export function createIndexId(id?: string): IndexId {
    29    return (id ?? `idx_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`) as IndexId;
    30  }
    31
    

libs/iris/knowledge/versioning/src/utils.ts#

  • L32

    ts
    30
    31  export function createKnowledgeEntityId(seed = 'entity'): KnowledgeEntityId {
    32    return `${seed}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as KnowledgeEntityId;
    33  }
    34
    
  • L36

    ts
    34
    35  export function createKnowledgeVersionId(seed = 'version'): KnowledgeVersionId {
    36    return `${seed}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}` as KnowledgeVersionId;
    37  }
    38
    

libs/iris/memory/analytics/src/memory-analytics-dashboard.ts#

  • L28

    ts
    26
    27  function createDashboardSnapshotId(): SnapshotId {
    28    return createSnapshotId(`dash_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`);
    29  }
    30
    

libs/iris/memory/consolidation/src/memory-clusterer.ts#

  • L500

    ts
    498
    499      // Initialize centroids randomly
    500      const shuffled = [...memories].sort(() => Math.random() - 0.5);
    501      let centroids = shuffled.slice(0, k);
    502
    
  • L537

    ts
    535          if (clusterMemories.length === 0) {
    536            // Empty cluster - pick random memory
    537            centroids.push(shuffled[Math.floor(Math.random() * shuffled.length)]);
    538          } else {
    539            // Find medoid (memory with highest average similarity to others)
    

libs/iris/memory/consolidation/src/types.ts#

  • L1077

    ts
    1075  export function generateJobId(): string {
    1076    const timestamp = Date.now().toString(36);
    1077    const random = Math.random().toString(36).slice(2, 8);
    1078    return `cj_${timestamp}_${random}`;
    1079  }
    
  • L1086

    ts
    1084  export function generateClusterId(): string {
    1085    const timestamp = Date.now().toString(36);
    1086    const random = Math.random().toString(36).slice(2, 8);
    1087    return `cl_${timestamp}_${random}`;
    1088  }
    

libs/iris/memory/core/src/types.ts#

  • L1566

    ts
    1564  export function generateMemoryId(): MemoryId {
    1565    const timestamp = Date.now().toString(36);
    1566    const random = Math.random().toString(36).slice(2, 10);
    1567    return createMemoryId(`mem_${timestamp}_${random}`);
    1568  }
    
  • L1575

    ts
    1573  export function generateEpisodeId(): EpisodeId {
    1574    const timestamp = Date.now().toString(36);
    1575    const random = Math.random().toString(36).slice(2, 10);
    1576    return createEpisodeId(`ep_${timestamp}_${random}`);
    1577  }
    
  • L1584

    ts
    1582  export function generateConceptId(): ConceptId {
    1583    const timestamp = Date.now().toString(36);
    1584    const random = Math.random().toString(36).slice(2, 10);
    1585    return createConceptId(`con_${timestamp}_${random}`);
    1586  }
    
  • L1593

    ts
    1591  export function generateIndexId(): IndexId {
    1592    const timestamp = Date.now().toString(36);
    1593    const random = Math.random().toString(36).slice(2, 10);
    1594    return createIndexId(`idx_${timestamp}_${random}`);
    1595  }
    

libs/iris/memory/debugging/src/timeline-tracker.ts#

  • L219

    ts
    217     */
    218    subscribe(callback: EventSubscriber, filter?: Partial<TimelineFilter>): () => void {
    219      const subscriptionId = `sub_${Date.now()}_${Math.random().toString(36).slice(2)}`;
    220
    221      this.subscriptions.set(subscriptionId, {
    

libs/iris/memory/episodic/src/milestone-tracker.ts#

  • L514

    ts
    512
    513    const categoryTemplates = templates[milestone.category];
    514    const index = Math.floor(Math.random() * categoryTemplates.length);
    515    return categoryTemplates[index];
    516  }
    

libs/iris/memory/episodic/src/types.ts#

  • L35

    ts
    33  export function generateInteractionId(): InteractionId {
    34    const timestamp = Date.now().toString(36);
    35    const random = Math.random().toString(36).substring(2, 8);
    36    return createInteractionId(`int_${timestamp}_${random}`);
    37  }
    
  • L55

    ts
    53  export function generateTaskRecordId(): TaskRecordId {
    54    const timestamp = Date.now().toString(36);
    55    const random = Math.random().toString(36).substring(2, 8);
    56    return createTaskRecordId(`task_${timestamp}_${random}`);
    57  }
    
  • L75

    ts
    73  export function generateFeedbackId(): FeedbackId {
    74    const timestamp = Date.now().toString(36);
    75    const random = Math.random().toString(36).substring(2, 8);
    76    return createFeedbackId(`fb_${timestamp}_${random}`);
    77  }
    
  • L95

    ts
    93  export function generateMilestoneId(): MilestoneId {
    94    const timestamp = Date.now().toString(36);
    95    const random = Math.random().toString(36).substring(2, 8);
    96    return createMilestoneId(`ms_${timestamp}_${random}`);
    97  }
    

libs/iris/memory/persistence/src/backup-automation.ts#

  • L489

    ts
    487
    488    private random(): number {
    489      return this.options.random ? this.options.random() : Math.random();
    490    }
    491  }
    

libs/iris/memory/persistence/src/redis-cache.ts#

  • L606

    ts
    604          // Fisher-Yates shuffle
    605          for (let i = entries.length - 1; i > 0; i--) {
    606            const j = Math.floor(Math.random() * (i + 1));
    607            [entries[i], entries[j]] = [entries[j], entries[i]];
    608          }
    

libs/iris/memory/personalization/inference/src/interest-detector.ts#

  • L738

    ts
    736
    737      const promotionTime = new Date();
    738      const id = createInterestId(`int-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`);
    739
    740      const entry: InterestEntry = {
    

libs/iris/memory/personalization/inference/src/preference-inferrer.ts#

  • L797

    ts
    795      const now = new Date();
    796      const preferenceId = createPreferenceId(
    797        `pref-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
    798      );
    799      const category = (inference.metadata['category'] as PreferenceCategory) ?? 'custom';
    

libs/iris/memory/personalization/testing/src/variant-assignment.ts#

  • L70

    ts
    68
    69    private weightedAssign(variants: readonly PersonalizationVariant[]): PersonalizationVariant {
    70      const randomValue = Math.random() * 100;
    71      return weightedPick(variants, randomValue);
    72    }
    
  • L122

    ts
    120      }
    121
    122      const randomIndex = Math.floor(Math.random() * closeCandidates.length);
    123      return closeCandidates[randomIndex] as PersonalizationVariant;
    124    }
    

libs/iris/memory/privacy/src/encryption/secure-recovery.ts#

  • L392

    ts
    390          }
    391          const randomQuestion =
    392            userData.securityQuestions[Math.floor(Math.random() * userData.securityQuestions.length)];
    393          challengeType = 'security_question';
    394          challengeData = randomQuestion.question;
    

libs/iris/memory/privacy/src/management/memory-importer.ts#

  • L874

    ts
    872    private generateEpisodeId(): EpisodeId {
    873      const timestamp = Date.now().toString(36);
    874      const random = Math.random().toString(36).slice(2, 10);
    875      return `ep_${timestamp}_${random}` as EpisodeId;
    876    }
    
  • L880

    ts
    878    private generateConceptId(): ConceptId {
    879      const timestamp = Date.now().toString(36);
    880      const random = Math.random().toString(36).slice(2, 10);
    881      return `con_${timestamp}_${random}` as ConceptId;
    882    }
    

libs/iris/memory/semantic/src/concept-understanding.ts#

  • L393

    ts
    391    private generateClusterId(): string {
    392      const timestamp = Date.now().toString(36);
    393      const random = Math.random().toString(36).substring(2, 8);
    394      return `clu_${timestamp}_${random}`;
    395    }
    

libs/iris/memory/semantic/src/types.ts#

  • L47

    ts
    45  export function generateEntityId(): EntityId {
    46    const timestamp = Date.now().toString(36);
    47    const random = Math.random().toString(36).substring(2, 8);
    48    return createEntityId(`ent_${timestamp}_${random}`);
    49  }
    
  • L67

    ts
    65  export function generateDomainId(): DomainId {
    66    const timestamp = Date.now().toString(36);
    67    const random = Math.random().toString(36).substring(2, 8);
    68    return createDomainId(`dom_${timestamp}_${random}`);
    69  }
    
  • L87

    ts
    85  export function generateInferenceId(): InferenceId {
    86    const timestamp = Date.now().toString(36);
    87    const random = Math.random().toString(36).substring(2, 8);
    88    return createInferenceId(`inf_${timestamp}_${random}`);
    89  }
    

libs/iris/memory/semantic/src/user-knowledge-graph.ts#

  • L457

    ts
    455    private generateNodeId(): string {
    456      const timestamp = Date.now().toString(36);
    457      const random = Math.random().toString(36).substring(2, 8);
    458      return `ukn_${timestamp}_${random}`;
    459    }
    

libs/iris/memory/short-term/src/types.ts#

  • L33

    ts
    31   */
    32  export function generateSlotId(): SlotId {
    33    return `slot_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as SlotId;
    34  }
    35
    
  • L47

    ts
    45   */
    46  export function generateReferenceId(): ReferenceId {
    47    return `ref_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as ReferenceId;
    48  }
    49
    
  • L61

    ts
    59   */
    60  export function generateTaskContextId(): TaskContextId {
    61    return `task_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as TaskContextId;
    62  }
    63
    

libs/iris/memory/tools/src/types.ts#

  • L996

    ts
    994  export function generateToolCallId(): string {
    995    const timestamp = Date.now().toString(36);
    996    const random = Math.random().toString(36).slice(2, 8);
    997    return `mtc_${timestamp}_${random}`;
    998  }
    

libs/iris/memory/transitions/src/consolidation-scheduler.ts#

  • L588

    ts
    586    private generateTaskId(): string {
    587      const timestamp = Date.now().toString(36);
    588      const random = Math.random().toString(36).slice(2, 8);
    589      return `task_${timestamp}_${random}`;
    590    }
    

libs/iris/memory/transitions/src/transition-metrics.ts#

  • L403

    ts
    401    private generateAlertId(): string {
    402      const timestamp = Date.now().toString(36);
    403      const random = Math.random().toString(36).slice(2, 6);
    404      return `alert_${timestamp}_${random}`;
    405    }
    

libs/iris/memory/transitions/src/types.ts#

  • L53

    ts
    51  export function generateTransitionId(): TransitionId {
    52    const timestamp = Date.now().toString(36);
    53    const random = Math.random().toString(36).slice(2, 10);
    54    return createTransitionId(`tr_${timestamp}_${random}`);
    55  }
    
  • L62

    ts
    60  export function generateBatchId(): BatchId {
    61    const timestamp = Date.now().toString(36);
    62    const random = Math.random().toString(36).slice(2, 10);
    63    return createBatchId(`batch_${timestamp}_${random}`);
    64  }
    

libs/iris/memory/visualization/src/memory-graph.ts#

  • L273

    ts
    271        if (!node.isPinned) {
    272          node.position = {
    273            x: Math.random() * 1000 - 500,
    274            y: Math.random() * 1000 - 500,
    275          };
    
  • L274

    ts
    272          node.position = {
    273            x: Math.random() * 1000 - 500,
    274            y: Math.random() * 1000 - 500,
    275          };
    276        }
    

libs/iris/memory/visualization/src/relationship-view.ts#

  • L384

    ts
    382      for (const node of nodeArray) {
    383        node.position = {
    384          x: (Math.random() - 0.5) * 500,
    385          y: (Math.random() - 0.5) * 500,
    386        };
    
  • L385

    ts
    383        node.position = {
    384          x: (Math.random() - 0.5) * 500,
    385          y: (Math.random() - 0.5) * 500,
    386        };
    387      }
    

libs/iris/memory/visualization/src/topic-cluster-view.ts#

  • L221

    ts
    219      const centroidIndices = new Set<number>();
    220      while (centroidIndices.size < k) {
    221        centroidIndices.add(Math.floor(Math.random() * n));
    222      }
    223      let centroids = Array.from(centroidIndices).map((i) => [...embeddings[i]]);
    
  • L773

    ts
    771      for (const cluster of clusterArray) {
    772        cluster.position = {
    773          x: (Math.random() - 0.5) * 500,
    774          y: (Math.random() - 0.5) * 500,
    775        };
    
  • L774

    ts
    772        cluster.position = {
    773          x: (Math.random() - 0.5) * 500,
    774          y: (Math.random() - 0.5) * 500,
    775        };
    776      }
    

libs/iris/model-routing/src/model-router.ts#

  • L145

    ts
    143
    144      return {
    145        routeId: createRouteId(`route-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`),
    146        selectedModel,
    147        fallbackModels,
    

libs/iris/multimodal/bci/src/bci-device.ts#

  • L597

    ts
    595      const channelQuality = new Map<string, number>();
    596      for (const label of this.channelLabels) {
    597        channelQuality.set(label, 0.8 + Math.random() * 0.15);
    598      }
    599
    
  • L684

    ts
    682
    683        // Add noise
    684        const noise = (Math.random() - 0.5) * 5;
    685
    686        // Combine components (in microvolts)
    

libs/iris/multimodal/spatial/src/spatial-impl.ts#

  • L403

    ts
    401
    402      // Check for intersections with planes
    403      const distance = 2 + Math.random() * 3;
    404      const point = vec3Add(ray.origin, vec3Scale(ray.direction, distance));
    405
    
  • L737

    ts
    735
    736      // Simulate hit test
    737      const distance = 1.5 + Math.random() * 2;
    738      const direction = this.currentGaze.direction;
    739
    
  • L768

    ts
    766      const baseDirection = { x: 0, y: 0, z: -1 };
    767      const jitter = {
    768        x: (Math.random() - 0.5) * 0.05,
    769        y: (Math.random() - 0.5) * 0.05,
    770        z: 0,
    
  • L769

    ts
    767      const jitter = {
    768        x: (Math.random() - 0.5) * 0.05,
    769        y: (Math.random() - 0.5) * 0.05,
    770        z: 0,
    771      };
    
  • L951

    ts
    949          joints[joint] = {
    950            position: {
    951              x: baseX + (Math.random() - 0.5) * 0.1,
    952              y: 1.0 + i * 0.01,
    953              z: -0.3 + (Math.random() - 0.5) * 0.1,
    
  • L953

    ts
    951              x: baseX + (Math.random() - 0.5) * 0.1,
    952              y: 1.0 + i * 0.01,
    953              z: -0.3 + (Math.random() - 0.5) * 0.1,
    954            },
    955            orientation: quaternionIdentity(),
    
  • L957

    ts
    955            orientation: quaternionIdentity(),
    956            radius: 0.01,
    957            confidence: 0.9 + Math.random() * 0.1,
    958          };
    959        }
    
  • L1380

    ts
    1378        this.lighting = {
    1379          ...this.lighting,
    1380          ambientIntensity: 0.5 + Math.random() * 0.1 - 0.05,
    1381          timestamp: Date.now(),
    1382        };
    

libs/iris/multimodal/vision/documents/src/document-parser.ts#

  • L65

    ts
    63   */
    64  export function createDocumentId(id?: string): DocumentId {
    65    return (id ?? `doc-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as DocumentId;
    66  }
    67
    
  • L72

    ts
    70   */
    71  export function createPageId(id?: string): PageId {
    72    return (id ?? `page-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as PageId;
    73  }
    74
    
  • L79

    ts
    77   */
    78  export function createElementId(id?: string): ElementId {
    79    return (id ?? `elem-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as ElementId;
    80  }
    81
    
  • L86

    ts
    84   */
    85  export function createTableId(id?: string): TableId {
    86    return (id ?? `table-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as TableId;
    87  }
    88
    
  • L93

    ts
    91   */
    92  export function createFormFieldId(id?: string): FormFieldId {
    93    return (id ?? `field-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as FormFieldId;
    94  }
    95
    
  • L100

    ts
    98   */
    99  export function createReceiptId(id?: string): ReceiptId {
    100    return (id ?? `receipt-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as ReceiptId;
    101  }
    102
    
  • L197

    ts
    195        title: 'Sample Document',
    196        author: 'Unknown Author',
    197        pageCount: 5 + Math.floor(Math.random() * 10),
    198        isEncrypted: !!input.password,
    199        hasForms: Math.random() > 0.7,
    
  • L199

    ts
    197        pageCount: 5 + Math.floor(Math.random() * 10),
    198        isEncrypted: !!input.password,
    199        hasForms: Math.random() > 0.7,
    200        hasTables: Math.random() > 0.5,
    201        hasImages: Math.random() > 0.6,
    
  • L200

    ts
    198        isEncrypted: !!input.password,
    199        hasForms: Math.random() > 0.7,
    200        hasTables: Math.random() > 0.5,
    201        hasImages: Math.random() > 0.6,
    202        pdfVersion: '1.7',
    
  • L201

    ts
    199        hasForms: Math.random() > 0.7,
    200        hasTables: Math.random() > 0.5,
    201        hasImages: Math.random() > 0.6,
    202        pdfVersion: '1.7',
    203        createdAt: new Date(),
    
  • L246

    ts
    244    private generateTextBlocks(): TextBlock[] {
    245      const blocks: TextBlock[] = [];
    246      const numBlocks = 3 + Math.floor(Math.random() * 5);
    247
    248      for (let i = 0; i < numBlocks; i++) {
    
  • L250

    ts
    248      for (let i = 0; i < numBlocks; i++) {
    249        const types: TextBlockType[] = ['paragraph', 'heading', 'title'];
    250        const type = types[Math.floor(Math.random() * types.length)];
    251        const isHeading = type === 'heading' || type === 'title';
    252
    
  • L260

    ts
    258          normalizedBox: this.generateNormalizedBox(i),
    259          style: this.generateTextStyle(isHeading),
    260          confidence: 0.85 + Math.random() * 0.15,
    261          readingOrder: i,
    262          headingLevel: isHeading ? Math.floor(Math.random() * 3) + 1 : undefined,
    
  • L262

    ts
    260          confidence: 0.85 + Math.random() * 0.15,
    261          readingOrder: i,
    262          headingLevel: isHeading ? Math.floor(Math.random() * 3) + 1 : undefined,
    263          isListItem: false,
    264          indentLevel: 0,
    
  • L313

    ts
    311
    312    private generateImages(): ImageElement[] {
    313      if (Math.random() > 0.5) return [];
    314
    315      return [
    
  • L329

    ts
    327
    328    private generateTables(): TableElement[] {
    329      if (Math.random() > 0.5) return [];
    330
    331      const rows = 4;
    
  • L380

    ts
    378
    379    private generateFormFields(): FormField[] {
    380      if (Math.random() > 0.7) return [];
    381
    382      const fields: FormField[] = [
    
  • L512

    ts
    510          missingRequired,
    511          validationErrors,
    512          confidence: 0.85 + Math.random() * 0.1,
    513        },
    514      ];
    
  • L683

    ts
    681        paymentMethod,
    682        rawText,
    683        confidence: 0.8 + Math.random() * 0.15,
    684        processingTimeMs: Date.now() - startTime,
    685      };
    
  • L690

    ts
    688    async extractTotal(_input: DocumentInput): Promise<{ amount: number; currency: CurrencyCode }> {
    689      // Simulated total extraction
    690      const amount = 10 + Math.random() * 200;
    691      const currency = this.config.expectedCurrency ?? 'USD';
    692
    
  • L702

    ts
    700      // Simulated line item extraction
    701      const items: LineItem[] = [];
    702      const numItems = 2 + Math.floor(Math.random() * 5);
    703
    704      const sampleItems = [
    
  • L715

    ts
    713
    714      for (let i = 0; i < numItems; i++) {
    715        const sample = sampleItems[Math.floor(Math.random() * sampleItems.length)];
    716        const quantity = Math.random() > 0.7 ? 2 : 1;
    717
    
  • L716

    ts
    714      for (let i = 0; i < numItems; i++) {
    715        const sample = sampleItems[Math.floor(Math.random() * sampleItems.length)];
    716        const quantity = Math.random() > 0.7 ? 2 : 1;
    717
    718        items.push({
    
  • L723

    ts
    721          unitPrice: sample.price,
    722          totalPrice: sample.price * quantity,
    723          confidence: 0.85 + Math.random() * 0.15,
    724        });
    725      }
    
  • L747

    ts
    745      ];
    746
    747      return merchants[Math.floor(Math.random() * merchants.length)];
    748    }
    749
    
  • L752

    ts
    750    private detectPaymentMethod(_input: DocumentInput): PaymentMethod {
    751      const methods: PaymentMethod[] = ['credit_card', 'debit_card', 'cash', 'digital_wallet'];
    752      return methods[Math.floor(Math.random() * methods.length)];
    753    }
    754
    
  • L813

    ts
    811    async detect(_input: DocumentInput): Promise<TableElement[]> {
    812      // Simulated table detection
    813      const numTables = Math.floor(Math.random() * 3);
    814      const tables: TableElement[] = [];
    815
    
  • L817

    ts
    815
    816      for (let t = 0; t < numTables; t++) {
    817        const rows = 3 + Math.floor(Math.random() * 5);
    818        const cols = 2 + Math.floor(Math.random() * 3);
    819        const cells: TableCell[] = [];
    
  • L818

    ts
    816      for (let t = 0; t < numTables; t++) {
    817        const rows = 3 + Math.floor(Math.random() * 5);
    818        const cols = 2 + Math.floor(Math.random() * 3);
    819        const cells: TableCell[] = [];
    820        const columns: TableColumn[] = [];
    
  • L828

    ts
    826            index: c,
    827            header: `Column ${c + 1}`,
    828            dataType: dataTypes[Math.floor(Math.random() * dataTypes.length)],
    829            width: 100,
    830            alignment: 'left',
    
  • L849

    ts
    847              alignment: 'left',
    848              boundingBox: { x: 50 + c * 100, y: 200 + t * 200 + r * 25, width: 100, height: 25 },
    849              confidence: 0.85 + Math.random() * 0.15,
    850            });
    851          }
    
  • L868

    ts
    866          columns,
    867          cells,
    868          confidence: 0.8 + Math.random() * 0.15,
    869        });
    870      }
    
  • L882

    ts
    880      switch (dataType) {
    881        case 'number':
    882          return String(Math.floor(Math.random() * 1000));
    883        case 'currency':
    884          return `$${(Math.random() * 1000).toFixed(2)}`;
    
  • L884

    ts
    882          return String(Math.floor(Math.random() * 1000));
    883        case 'currency':
    884          return `$${(Math.random() * 1000).toFixed(2)}`;
    885        default:
    886          return `Data ${Math.floor(Math.random() * 100)}`;
    
  • L886

    ts
    884          return `$${(Math.random() * 1000).toFixed(2)}`;
    885        default:
    886          return `Data ${Math.floor(Math.random() * 100)}`;
    887      }
    888    }
    
  • L1022

    ts
    1020      // Simulated reading order detection
    1021      const elements: ElementId[] = [];
    1022      const numElements = 5 + Math.floor(Math.random() * 5);
    1023
    1024      for (let i = 0; i < numElements; i++) {
    
  • L1036

    ts
    1034
    1035      // Header
    1036      if (Math.random() > 0.3) {
    1037        regions.push({
    1038          id: createElementId(),
    
  • L1048

    ts
    1046
    1047      // Body content
    1048      const numParagraphs = 2 + Math.floor(Math.random() * 3);
    1049      for (let i = 0; i < numParagraphs; i++) {
    1050        regions.push({
    
  • L1062

    ts
    1060          content: 'Sample paragraph content...',
    1061          readingOrder: i + 1,
    1062          confidence: 0.85 + Math.random() * 0.1,
    1063        });
    1064      }
    
  • L1067

    ts
    1065
    1066      // Footer
    1067      if (Math.random() > 0.3) {
    1068        regions.push({
    1069          id: createElementId(),
    

libs/iris/multimodal/vision/generation/src/generation-impl.ts#

  • L146

    ts
    144          quality: mergedConfig.quality,
    145          model: mergedConfig.model,
    146          seed: Math.floor(Math.random() * 2147483647),
    147          generationTime: Date.now() - startTime,
    148          createdAt: new Date(),
    

libs/iris/multimodal/vision/memory/src/image-memory-store.ts#

  • L23

    ts
    21
    22  function createId(prefix: string): string {
    23    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    24  }
    25
    

libs/iris/multimodal/vision/screenshare/src/action-suggestion.ts#

  • L15

    ts
    13
    14  function createId(prefix: string): string {
    15    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    16  }
    17
    

libs/iris/multimodal/vision/screenshare/src/screen-share-receiver.ts#

  • L17

    ts
    15
    16  function createId(prefix: string): string {
    17    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    18  }
    19
    

libs/iris/multimodal/vision/search/src/search-utils.ts#

  • L40

    ts
    38
    39  export function createId(prefix: string): string {
    40    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    41  }
    42
    

libs/iris/multimodal/vision/understanding/src/image-analyzer.ts#

  • L78

    ts
    76  export function createImageAnalysisId(id?: string): ImageAnalysisId {
    77    return (id ??
    78      `img-analysis-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as ImageAnalysisId;
    79  }
    80
    
  • L85

    ts
    83   */
    84  export function createDetectionId(id?: string): DetectionId {
    85    return (id ?? `det-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as DetectionId;
    86  }
    87
    
  • L93

    ts
    91  export function createSceneDescriptionId(id?: string): SceneDescriptionId {
    92    return (id ??
    93      `scene-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as SceneDescriptionId;
    94  }
    95
    
  • L100

    ts
    98   */
    99  export function createOCRResultId(id?: string): OCRResultId {
    100    return (id ?? `ocr-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as OCRResultId;
    101  }
    102
    
  • L107

    ts
    105   */
    106  export function createChartAnalysisId(id?: string): ChartAnalysisId {
    107    return (id ?? `chart-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as ChartAnalysisId;
    108  }
    109
    
  • L130

    ts
    128  /**
    129   * Honest abstain: returns no faces. Replaces the prior
    130   * `Math.random()`-driven face fabrication, which produced 0–2 faces
    131   * with random bounding boxes, ages, glasses/mask flags, and
    132   * emotion scores — none correlated with the actual image content.
    
  • L206

    ts
    204     *
    205     * The previous implementation produced 0–2 random bounding boxes
    206     * per call with `Math.random()`-derived confidence/age/glasses/
    207     * mask/quality fields — none of which had any correlation with
    208     * the actual pixels. That has been removed.
    
  • L225

    ts
    223    ): Promise<DetectedObject[]> {
    224      const objects: DetectedObject[] = [];
    225      const numObjects = Math.floor(Math.random() * config.maxObjects * 0.1) + 1;
    226
    227      const categories: ObjectCategory[] =
    
  • L233

    ts
    231
    232      for (let i = 0; i < numObjects; i++) {
    233        const category = categories[Math.floor(Math.random() * categories.length)];
    234        const bbox = this.generateRandomBoundingBox(imageSize);
    235        const confidence = config.minConfidence + Math.random() * (1 - config.minConfidence);
    
  • L235

    ts
    233        const category = categories[Math.floor(Math.random() * categories.length)];
    234        const bbox = this.generateRandomBoundingBox(imageSize);
    235        const confidence = config.minConfidence + Math.random() * (1 - config.minConfidence);
    236
    237        objects.push({
    
  • L257

    ts
    255
    256    private generateRandomBoundingBox(imageSize: { width: number; height: number }): BoundingBox {
    257      const x = Math.floor(Math.random() * imageSize.width * 0.7);
    258      const y = Math.floor(Math.random() * imageSize.height * 0.7);
    259      const width = Math.floor(Math.random() * (imageSize.width - x) * 0.5) + 50;
    
  • L258

    ts
    256    private generateRandomBoundingBox(imageSize: { width: number; height: number }): BoundingBox {
    257      const x = Math.floor(Math.random() * imageSize.width * 0.7);
    258      const y = Math.floor(Math.random() * imageSize.height * 0.7);
    259      const width = Math.floor(Math.random() * (imageSize.width - x) * 0.5) + 50;
    260      const height = Math.floor(Math.random() * (imageSize.height - y) * 0.5) + 50;
    
  • L259

    ts
    257      const x = Math.floor(Math.random() * imageSize.width * 0.7);
    258      const y = Math.floor(Math.random() * imageSize.height * 0.7);
    259      const width = Math.floor(Math.random() * (imageSize.width - x) * 0.5) + 50;
    260      const height = Math.floor(Math.random() * (imageSize.height - y) * 0.5) + 50;
    261      return { x, y, width, height };
    
  • L260

    ts
    258      const y = Math.floor(Math.random() * imageSize.height * 0.7);
    259      const width = Math.floor(Math.random() * (imageSize.width - x) * 0.5) + 50;
    260      const height = Math.floor(Math.random() * (imageSize.height - y) * 0.5) + 50;
    261      return { x, y, width, height };
    262    }
    
  • L341

    ts
    339      };
    340      const categoryLabels = labels[category] ?? ['object'];
    341      return categoryLabels[Math.floor(Math.random() * categoryLabels.length)];
    342    }
    343
    
  • L355

    ts
    353
    354      return {
    355        color: colors[Math.floor(Math.random() * colors.length)],
    356        size: sizes[Math.floor(Math.random() * sizes.length)],
    357        orientation: Math.random() > 0.7 ? 'upright' : 'unknown',
    
  • L356

    ts
    354      return {
    355        color: colors[Math.floor(Math.random() * colors.length)],
    356        size: sizes[Math.floor(Math.random() * sizes.length)],
    357        orientation: Math.random() > 0.7 ? 'upright' : 'unknown',
    358      };
    
  • L357

    ts
    355        color: colors[Math.floor(Math.random() * colors.length)],
    356        size: sizes[Math.floor(Math.random() * sizes.length)],
    357        orientation: Math.random() > 0.7 ? 'upright' : 'unknown',
    358      };
    359    }
    
  • L410

    ts
    408        sceneType,
    409        tags: this.generateTags(sceneType, lighting),
    410        confidence: 0.75 + Math.random() * 0.2,
    411        setting: this.inferSetting(sceneType),
    412        lighting,
    
  • L438

    ts
    436    private detectSceneType(_input: ImageInput): SceneType {
    437      const types: SceneType[] = ['indoor', 'outdoor', 'urban', 'rural', 'natural'];
    438      return types[Math.floor(Math.random() * types.length)];
    439    }
    440
    
  • L443

    ts
    441    private detectLighting(_input: ImageInput): LightingCondition {
    442      const conditions: LightingCondition[] = ['daylight', 'artificial', 'golden_hour', 'low_light'];
    443      return conditions[Math.floor(Math.random() * conditions.length)];
    444    }
    445
    
  • L448

    ts
    446    private detectWeather(_input: ImageInput): WeatherCondition {
    447      const conditions: WeatherCondition[] = ['clear', 'cloudy', 'rainy', 'foggy'];
    448      return conditions[Math.floor(Math.random() * conditions.length)];
    449    }
    450
    
  • L464

    ts
    462      for (let i = 0; i < Math.min(count, baseColors.length); i++) {
    463        const pct =
    464          i === count - 1 ? remainingPct : Math.floor(remainingPct * (0.3 + Math.random() * 0.4));
    465        remainingPct -= pct;
    466
    
  • L479

    ts
    477    private assessQuality(_input: ImageInput): ImageQuality {
    478      return {
    479        score: 0.7 + Math.random() * 0.3,
    480        sharpness: 0.6 + Math.random() * 0.4,
    481        exposure: 0.7 + Math.random() * 0.3,
    
  • L480

    ts
    478      return {
    479        score: 0.7 + Math.random() * 0.3,
    480        sharpness: 0.6 + Math.random() * 0.4,
    481        exposure: 0.7 + Math.random() * 0.3,
    482        colorAccuracy: 0.75 + Math.random() * 0.25,
    
  • L481

    ts
    479        score: 0.7 + Math.random() * 0.3,
    480        sharpness: 0.6 + Math.random() * 0.4,
    481        exposure: 0.7 + Math.random() * 0.3,
    482        colorAccuracy: 0.75 + Math.random() * 0.25,
    483        contrast: 0.65 + Math.random() * 0.35,
    
  • L482

    ts
    480        sharpness: 0.6 + Math.random() * 0.4,
    481        exposure: 0.7 + Math.random() * 0.3,
    482        colorAccuracy: 0.75 + Math.random() * 0.25,
    483        contrast: 0.65 + Math.random() * 0.35,
    484        saturation: 0.6 + Math.random() * 0.4,
    
  • L483

    ts
    481        exposure: 0.7 + Math.random() * 0.3,
    482        colorAccuracy: 0.75 + Math.random() * 0.25,
    483        contrast: 0.65 + Math.random() * 0.35,
    484        saturation: 0.6 + Math.random() * 0.4,
    485        noiseLevel: Math.random() * 0.3,
    
  • L484

    ts
    482        colorAccuracy: 0.75 + Math.random() * 0.25,
    483        contrast: 0.65 + Math.random() * 0.35,
    484        saturation: 0.6 + Math.random() * 0.4,
    485        noiseLevel: Math.random() * 0.3,
    486        issues: [],
    
  • L485

    ts
    483        contrast: 0.65 + Math.random() * 0.35,
    484        saturation: 0.6 + Math.random() * 0.4,
    485        noiseLevel: Math.random() * 0.3,
    486        issues: [],
    487        aestheticScore: 0.6 + Math.random() * 0.4,
    
  • L487

    ts
    485        noiseLevel: Math.random() * 0.3,
    486        issues: [],
    487        aestheticScore: 0.6 + Math.random() * 0.4,
    488      };
    489    }
    
  • L768

    ts
    766      // Simulated text extraction
    767      const blocks: TextBlock[] = [];
    768      const numBlocks = Math.floor(Math.random() * 5) + 1;
    769
    770      const blockTypes: TextBlockType[] = ['paragraph', 'heading', 'caption', 'label'];
    
  • L780

    ts
    778          id: `block-${i}`,
    779          text,
    780          type: blockTypes[Math.floor(Math.random() * blockTypes.length)],
    781          confidence: config.minConfidence + Math.random() * (1 - config.minConfidence),
    782          boundingBox: bbox,
    
  • L781

    ts
    779          text,
    780          type: blockTypes[Math.floor(Math.random() * blockTypes.length)],
    781          confidence: config.minConfidence + Math.random() * (1 - config.minConfidence),
    782          boundingBox: bbox,
    783          lines,
    
  • L786

    ts
    784          language: 'en',
    785          direction: 'ltr',
    786          fontSize: 12 + Math.floor(Math.random() * 12),
    787        });
    788      }
    
  • L795

    ts
    793    private generateLines(config: OCRConfig): TextLine[] {
    794      const lines: TextLine[] = [];
    795      const numLines = Math.floor(Math.random() * 3) + 1;
    796
    797      for (let i = 0; i < numLines; i++) {
    
  • L803

    ts
    801        lines.push({
    802          text,
    803          confidence: config.minConfidence + Math.random() * (1 - config.minConfidence),
    804          boundingBox: { x: 10, y: 10 + i * 20, width: 500, height: 18 },
    805          words,
    
  • L816

    ts
    814      const words: TextWord[] = [];
    815      const sampleWords = ['Sample', 'text', 'from', 'image', 'recognition', 'Lorem', 'ipsum'];
    816      const numWords = Math.floor(Math.random() * 5) + 2;
    817
    818      let x = 10;
    
  • L820

    ts
    818      let x = 10;
    819      for (let i = 0; i < numWords; i++) {
    820        const word = sampleWords[Math.floor(Math.random() * sampleWords.length)];
    821        const width = word.length * 8;
    822
    
  • L825

    ts
    823        words.push({
    824          text: word,
    825          confidence: config.minConfidence + Math.random() * (1 - config.minConfidence),
    826          boundingBox: { x, y: 10, width, height: 16 },
    827          isHandwritten: config.enableHandwriting && Math.random() > 0.8,
    
  • L827

    ts
    825          confidence: config.minConfidence + Math.random() * (1 - config.minConfidence),
    826          boundingBox: { x, y: 10, width, height: 16 },
    827          isHandwritten: config.enableHandwriting && Math.random() > 0.8,
    828          language: 'en',
    829        });
    
  • L839

    ts
    837    private generateBlockBoundingBox(): BoundingBox {
    838      return {
    839        x: 50 + Math.floor(Math.random() * 100),
    840        y: 50 + Math.floor(Math.random() * 200),
    841        width: 400 + Math.floor(Math.random() * 200),
    
  • L840

    ts
    838      return {
    839        x: 50 + Math.floor(Math.random() * 100),
    840        y: 50 + Math.floor(Math.random() * 200),
    841        width: 400 + Math.floor(Math.random() * 200),
    842        height: 50 + Math.floor(Math.random() * 100),
    
  • L841

    ts
    839        x: 50 + Math.floor(Math.random() * 100),
    840        y: 50 + Math.floor(Math.random() * 200),
    841        width: 400 + Math.floor(Math.random() * 200),
    842        height: 50 + Math.floor(Math.random() * 100),
    843      };
    
  • L842

    ts
    840        y: 50 + Math.floor(Math.random() * 200),
    841        width: 400 + Math.floor(Math.random() * 200),
    842        height: 50 + Math.floor(Math.random() * 100),
    843      };
    844    }
    
  • L913

    ts
    911        id: createChartAnalysisId(),
    912        chartType,
    913        confidence: 0.75 + Math.random() * 0.2,
    914        title,
    915        xAxis,
    
  • L932

    ts
    930      // Simulated chart type detection
    931      const types: ChartType[] = ['bar', 'line', 'pie', 'scatter', 'area'];
    932      return types[Math.floor(Math.random() * types.length)];
    933    }
    934
    
  • L943

    ts
    941        data.push({
    942          category: cat,
    943          value1: Math.floor(Math.random() * 100),
    944          value2: Math.floor(Math.random() * 100),
    945        });
    
  • L944

    ts
    942          category: cat,
    943          value1: Math.floor(Math.random() * 100),
    944          value2: Math.floor(Math.random() * 100),
    945        });
    946      }
    
  • L956

    ts
    954
    955    private extractTitle(_input: ImageInput): string | undefined {
    956      return Math.random() > 0.3 ? 'Sample Chart Title' : undefined;
    957    }
    958
    
  • L974

    ts
    972    ): DataSeries[] {
    973      const series: DataSeries[] = [];
    974      const numSeries = chartType === 'pie' ? 1 : Math.floor(Math.random() * 3) + 1;
    975      const colors = ['#FF6384', '#36A2EB', '#FFCE56', '#4BC0C0'];
    976
    
  • L993

    ts
    991      const points: DataPoint[] = [];
    992      const categories = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct'];
    993      const numPoints = Math.min(Math.floor(Math.random() * 10) + 3, maxPoints, categories.length);
    994
    995      if (chartType === 'pie') {
    
  • L998

    ts
    996        let total = 100;
    997        for (let i = 0; i < numPoints && total > 0; i++) {
    998          const value = i === numPoints - 1 ? total : Math.floor(Math.random() * total * 0.5) + 5;
    999          total -= value;
    1000          points.push({
    
  • L1006

    ts
    1004            value,
    1005            percentage: value / 100,
    1006            confidence: 0.85 + Math.random() * 0.15,
    1007          });
    1008        }
    
  • L1011

    ts
    1009      } else {
    1010        for (let i = 0; i < numPoints; i++) {
    1011          const value = Math.floor(Math.random() * 100);
    1012          points.push({
    1013            x: chartType === 'scatter' ? Math.random() * 100 : categories[i],
    
  • L1013

    ts
    1011          const value = Math.floor(Math.random() * 100);
    1012          points.push({
    1013            x: chartType === 'scatter' ? Math.random() * 100 : categories[i],
    1014            y: value,
    1015            label: categories[i],
    
  • L1017

    ts
    1015            label: categories[i],
    1016            value,
    1017            confidence: 0.8 + Math.random() * 0.2,
    1018          });
    1019        }
    

libs/iris/multimodal/vision/video/src/video-analyzer.ts#

  • L385

    ts
    383      for (const objectClass of objectClasses) {
    384        const trackId = createTrackId();
    385        const startFrame = Math.floor(Math.random() * Math.floor(frames.length / 2));
    386        const endFrame = startFrame + Math.floor(Math.random() * (frames.length - startFrame));
    387
    
  • L386

    ts
    384        const trackId = createTrackId();
    385        const startFrame = Math.floor(Math.random() * Math.floor(frames.length / 2));
    386        const endFrame = startFrame + Math.floor(Math.random() * (frames.length - startFrame));
    387
    388        const positions: TrackPosition[] = [];
    
  • L399

    ts
    397              height: 120,
    398            },
    399            confidence: 0.85 + Math.random() * 0.15,
    400          });
    401        }
    
  • L453

    ts
    451        musicSegments,
    452        soundEvents,
    453        averageLoudness: -18 + Math.random() * 6,
    454        dynamicRange: 10 + Math.random() * 10,
    455      };
    
  • L454

    ts
    452        soundEvents,
    453        averageLoudness: -18 + Math.random() * 6,
    454        dynamicRange: 10 + Math.random() * 10,
    455      };
    456    }
    
  • L594

    ts
    592        },
    593      ];
    594      return resolutions[Math.floor(Math.random() * resolutions.length)];
    595    }
    596
    
  • L601

    ts
    599        return input.endTime - input.startTime;
    600      }
    601      return 30 + Math.random() * 270; // 30s to 5min
    602    }
    603
    
  • L606

    ts
    604    private generateFrameRate(): number {
    605      const rates = [24, 25, 29.97, 30, 60];
    606      return rates[Math.floor(Math.random() * rates.length)];
    607    }
    608
    
  • L614

    ts
    612
    613    private generateFileSize(_input: VideoInput): number {
    614      return Math.floor(10000000 + Math.random() * 100000000);
    615    }
    616
    
  • L621

    ts
    619        const data: number[] = [];
    620        for (let i = 0; i < 256; i++) {
    621          data.push(Math.floor(Math.random() * 1000));
    622        }
    623        return data;
    
  • L661

    ts
    659    private classifySceneType(_keyFrame: KeyFrame): SceneType {
    660      const types: SceneType[] = ['indoor', 'outdoor', 'urban', 'nature'];
    661      return types[Math.floor(Math.random() * types.length)];
    662    }
    663
    
  • L674

    ts
    672      ];
    673
    674      return `${subjects[Math.floor(Math.random() * subjects.length)]} ${actions[Math.floor(Math.random() * actions.length)]} ${locations[Math.floor(Math.random() * locations.length)]}.`;
    675    }
    676
    
  • L679

    ts
    677    private detectTransition(): TransitionType {
    678      const transitions: TransitionType[] = ['cut', 'fade', 'dissolve', 'wipe'];
    679      return transitions[Math.floor(Math.random() * transitions.length)];
    680    }
    681
    
  • L693

    ts
    691        '#000000',
    692      ];
    693      const count = 3 + Math.floor(Math.random() * 3);
    694      return colors.slice(0, count);
    695    }
    
  • L698

    ts
    696
    697    private calculateBrightness(_keyFrame: KeyFrame): number {
    698      return 0.3 + Math.random() * 0.4;
    699    }
    700
    
  • L703

    ts
    701    private classifyMood(_keyFrame: KeyFrame): SceneMood {
    702      const moods: SceneMood[] = ['calm', 'exciting', 'dramatic', 'neutral'];
    703      return moods[Math.floor(Math.random() * moods.length)];
    704    }
    705
    
  • L711

    ts
    709     * when both frames carry histograms, sampled-byte Hamming
    710     * distance when both carry equal-length base64 imageData, else
    711     * 0 (no observable motion). The previous Math.random fabrication
    712     * produced uniformly-distributed levels independent of any actual
    713     * frame content; this version always reports a real or honest-
    
  • L798

    ts
    796      const vectors: Array<{ x: number; y: number; magnitude: number }> = [];
    797      for (let i = 0; i < count; i++) {
    798        const angle = Math.random() * Math.PI * 2;
    799        const magnitude = Math.random() * 10;
    800        vectors.push({
    
  • L799

    ts
    797      for (let i = 0; i < count; i++) {
    798        const angle = Math.random() * Math.PI * 2;
    799        const magnitude = Math.random() * 10;
    800        vectors.push({
    801          x: Math.cos(angle) * magnitude,
    
  • L814

    ts
    812
    813      while (time < duration - 5) {
    814        const startTime = time + Math.random() * 10;
    815        const segmentDuration = 2 + Math.random() * 8;
    816
    
  • L815

    ts
    813      while (time < duration - 5) {
    814        const startTime = time + Math.random() * 10;
    815        const segmentDuration = 2 + Math.random() * 8;
    816
    817        if (startTime + segmentDuration > duration) break;
    
  • L824

    ts
    822          text: 'Transcribed speech content...',
    823          language: 'en',
    824          confidence: 0.85 + Math.random() * 0.15,
    825        });
    826
    
  • L838

    ts
    836      const moods = ['upbeat', 'calm', 'intense', 'melancholic'];
    837
    838      if (Math.random() > 0.3) {
    839        segments.push({
    840          startTime: 0,
    
  • L842

    ts
    840          startTime: 0,
    841          endTime: duration * 0.3,
    842          genre: genres[Math.floor(Math.random() * genres.length)],
    843          mood: moods[Math.floor(Math.random() * moods.length)],
    844        });
    
  • L843

    ts
    841          endTime: duration * 0.3,
    842          genre: genres[Math.floor(Math.random() * genres.length)],
    843          mood: moods[Math.floor(Math.random() * moods.length)],
    844        });
    845      }
    
  • L854

    ts
    852      const labels = ['door', 'car', 'applause', 'laughter', 'music', 'speech', 'silence'];
    853
    854      const count = Math.floor(3 + Math.random() * 5);
    855      for (let i = 0; i < count; i++) {
    856        events.push({
    
  • L857

    ts
    855      for (let i = 0; i < count; i++) {
    856        events.push({
    857          timestamp: Math.random() * duration,
    858          label: labels[Math.floor(Math.random() * labels.length)],
    859          confidence: 0.7 + Math.random() * 0.3,
    
  • L858

    ts
    856        events.push({
    857          timestamp: Math.random() * duration,
    858          label: labels[Math.floor(Math.random() * labels.length)],
    859          confidence: 0.7 + Math.random() * 0.3,
    860        });
    
  • L859

    ts
    857          timestamp: Math.random() * duration,
    858          label: labels[Math.floor(Math.random() * labels.length)],
    859          confidence: 0.7 + Math.random() * 0.3,
    860        });
    861      }
    
  • L974

    ts
    972        const category = mergedConfig.categories[i % mergedConfig.categories.length];
    973        const actionLabels = this.supportedActions.get(category) ?? ['unknown'];
    974        const label = actionLabels[Math.floor(Math.random() * actionLabels.length)];
    975
    976        const startTime = (i / numActions) * duration;
    
  • L979

    ts
    977        const actionDuration = Math.max(
    978          mergedConfig.minDuration,
    979          (duration / numActions) * (0.5 + Math.random() * 0.5)
    980        );
    981        const endTime = Math.min(startTime + actionDuration, duration);
    
  • L984

    ts
    982
    983        const confidence =
    984          mergedConfig.minConfidence + Math.random() * (1 - mergedConfig.minConfidence);
    985
    986        if (confidence >= mergedConfig.minConfidence) {
    
  • L1173

    ts
    1171        label: 'Person',
    1172        boundingBox: {
    1173          x: 100 + Math.random() * 200,
    1174          y: 100 + Math.random() * 200,
    1175          width: 80 + Math.random() * 40,
    
  • L1174

    ts
    1172        boundingBox: {
    1173          x: 100 + Math.random() * 200,
    1174          y: 100 + Math.random() * 200,
    1175          width: 80 + Math.random() * 40,
    1176          height: 150 + Math.random() * 50,
    
  • L1175

    ts
    1173          x: 100 + Math.random() * 200,
    1174          y: 100 + Math.random() * 200,
    1175          width: 80 + Math.random() * 40,
    1176          height: 150 + Math.random() * 50,
    1177        },
    
  • L1176

    ts
    1174          y: 100 + Math.random() * 200,
    1175          width: 80 + Math.random() * 40,
    1176          height: 150 + Math.random() * 50,
    1177        },
    1178      };
    
  • L1964

    ts
    1962      const labels = ['person', 'object', 'text'];
    1963
    1964      const count = Math.floor(Math.random() * 3);
    1965      for (let i = 0; i < count; i++) {
    1966        objects.push({
    
  • L1968

    ts
    1966        objects.push({
    1967          label: labels[i % labels.length],
    1968          confidence: 0.7 + Math.random() * 0.3,
    1969          boundingBox: {
    1970            x: Math.random() * 800,
    
  • L1970

    ts
    1968          confidence: 0.7 + Math.random() * 0.3,
    1969          boundingBox: {
    1970            x: Math.random() * 800,
    1971            y: Math.random() * 400,
    1972            width: 50 + Math.random() * 150,
    
  • L1971

    ts
    1969          boundingBox: {
    1970            x: Math.random() * 800,
    1971            y: Math.random() * 400,
    1972            width: 50 + Math.random() * 150,
    1973            height: 50 + Math.random() * 200,
    
  • L1972

    ts
    1970            x: Math.random() * 800,
    1971            y: Math.random() * 400,
    1972            width: 50 + Math.random() * 150,
    1973            height: 50 + Math.random() * 200,
    1974          },
    
  • L1973

    ts
    1971            y: Math.random() * 400,
    1972            width: 50 + Math.random() * 150,
    1973            height: 50 + Math.random() * 200,
    1974          },
    1975          attributes: {},
    

libs/iris/multimodal/voice/auth/src/fallback-authentication.ts#

  • L17

    ts
    15
    16  function createId(prefix: string): string {
    17    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    18  }
    19
    

libs/iris/multimodal/voice/commands/src/command-confirmation.ts#

  • L17

    ts
    15
    16  function createId(prefix: string): string {
    17    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    18  }
    19
    

libs/iris/multimodal/voice/conversation/src/emotion/emotion-detector.ts#

  • L57

    ts
    55  export function createEmotionAnalysisId(id?: string): EmotionAnalysisId {
    56    return (id ??
    57      `emotion-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`) as EmotionAnalysisId;
    58  }
    59
    
  • L65

    ts
    63  export function createEmotionalStateId(id?: string): EmotionalStateId {
    64    return (id ??
    65      `state-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`) as EmotionalStateId;
    66  }
    67
    

libs/iris/multimodal/voice/conversation/src/full-duplex-engine.ts#

  • L71

    ts
    69  export function createConversationSessionId(id?: string): ConversationSessionId {
    70    return (id ??
    71      `session-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`) as ConversationSessionId;
    72  }
    73
    
  • L78

    ts
    76   */
    77  export function createTurnId(id?: string): TurnId {
    78    return (id ?? `turn-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`) as TurnId;
    79  }
    80
    
  • L85

    ts
    83   */
    84  export function createUtteranceId(id?: string): UtteranceId {
    85    return (id ?? `utt-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`) as UtteranceId;
    86  }
    87
    
  • L93

    ts
    91  export function createParticipantId(id?: string): ParticipantId {
    92    return (id ??
    93      `part-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`) as ParticipantId;
    94  }
    95
    
  • L571

    ts
    569
    570      // Check frequency
    571      if (Math.random() > this.config.frequency) {
    572        return false;
    573      }
    

libs/iris/multimodal/voice/conversation/src/prosody/prosody-analyzer.ts#

  • L62

    ts
    60  export function createProsodyAnalysisId(id?: string): ProsodyAnalysisId {
    61    return (id ??
    62      `prosody-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`) as ProsodyAnalysisId;
    63  }
    64
    

libs/iris/multimodal/voice/conversation/src/webrtc/webrtc-voice.ts#

  • L64

    ts
    62  export function createWebRTCConnectionId(id?: string): WebRTCConnectionId {
    63    return (id ??
    64      `webrtc-conn-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as WebRTCConnectionId;
    65  }
    66
    
  • L72

    ts
    70  export function createWebRTCStreamId(id?: string): WebRTCStreamId {
    71    return (id ??
    72      `webrtc-stream-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as WebRTCStreamId;
    73  }
    74
    
  • L79

    ts
    77   */
    78  export function createICECandidateId(id?: string): ICECandidateId {
    79    return (id ?? `ice-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as ICECandidateId;
    80  }
    81
    
  • L86

    ts
    84   */
    85  export function createAudioProcessorId(id?: string): AudioProcessorId {
    86    return (id ?? `proc-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`) as AudioProcessorId;
    87  }
    88
    
  • L343

    ts
    341      const noiseLevel = Math.pow(10, this.config.comfortNoiseLevelDb / 20);
    342      for (let i = 0; i < output.length; i++) {
    343        output[i] += (Math.random() * 2 - 1) * noiseLevel;
    344      }
    345    }
    
  • L1167

    ts
    1165          // Generate comfort noise
    1166          for (let i = 0; i < payload.length; i++) {
    1167            payload[i] = Math.floor((Math.random() - 0.5) * 10 + 128);
    1168          }
    1169          break;
    
  • L1567

    ts
    1565      // Simplified - would measure actual audio levels
    1566      return {
    1567        inputLevelDb: this.localMuted ? -100 : -30 + Math.random() * 20,
    1568        outputLevelDb: -35 + Math.random() * 25,
    1569        isSpeaking: !this.localMuted && Math.random() > 0.5,
    
  • L1568

    ts
    1566      return {
    1567        inputLevelDb: this.localMuted ? -100 : -30 + Math.random() * 20,
    1568        outputLevelDb: -35 + Math.random() * 25,
    1569        isSpeaking: !this.localMuted && Math.random() > 0.5,
    1570        vadConfidence: Math.random(),
    
  • L1569

    ts
    1567        inputLevelDb: this.localMuted ? -100 : -30 + Math.random() * 20,
    1568        outputLevelDb: -35 + Math.random() * 25,
    1569        isSpeaking: !this.localMuted && Math.random() > 0.5,
    1570        vadConfidence: Math.random(),
    1571      };
    
  • L1570

    ts
    1568        outputLevelDb: -35 + Math.random() * 25,
    1569        isSpeaking: !this.localMuted && Math.random() > 0.5,
    1570        vadConfidence: Math.random(),
    1571      };
    1572    }
    
  • L1675

    ts
    1673     * structurally valid and *cryptographically* honest:
    1674     *   - ICE ufrag/pwd are drawn from `crypto.randomBytes` (replacing
    1675     *     `Math.random()`, which is not a CSPRNG and which RFC 5245
    1676     *     forbids for ICE credentials).
    1677     *   - The DTLS fingerprint is the real SHA-256 of a freshly
    
  • L1881

    ts
    1879   * The ufrag is at least 4 ICE-chars long; we use 8 for forward
    1880   * compatibility with implementations that look for longer prefixes.
    1881   * `crypto.randomBytes` is the CSPRNG; `Math.random` is *not* and is
    1882   * forbidden for ICE credentials.
    1883   */
    
  • L1912

    ts
    1910   *     `peerConnectionFactory`, the SDP comes straight from the real
    1911   *     stack and the fingerprint binds to the real certificate.
    1912   *   - Replacing `Math.random()` with `crypto`-derived bytes also
    1913   *     closes a passive-discovery side channel: the previous output's
    1914   *     entropy was bounded by JavaScript's PRNG state.
    
  • L1923

    ts
    1921    // synthesis path (which doesn't use the cert anyway) hashing the
    1922    // SPKI yields a real, shape-correct fingerprint derived from real
    1923    // entropy — never a `Math.random()` artifact.
    1924    const spki = publicKey.export({ format: 'der', type: 'spki' });
    1925    const hash = createHash('sha256').update(spki).digest('hex').toUpperCase();
    

libs/iris/multimodal/voice/journaling/src/voice-journal-recorder.ts#

  • L33

    ts
    31
    32  function createId(prefix: string): string {
    33    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    34  }
    35
    

libs/iris/multimodal/voice/recognition/src/language/language-detector.ts#

  • L1194

    ts
    1192   * autocorrelation pitch, voicing ratio) against per-language Gaussian
    1193   * profiles to produce softmax-normalized scores. Deterministic for a
    1194   * given audio input — no `Math.random` anywhere on the path. The
    1195   * default profile set covers ~14 major languages with coarse phonetic
    1196   * means/std-devs; deployments needing closer-pair resolution swap in
    
  • L1416

    ts
    1414     *
    1415     * The output is fully deterministic for a given audio input and
    1416     * never returns `Math.random` or hash-derived pseudo-scores.
    1417     */
    1418    private simulateLanguageScores(
    

libs/iris/multimodal/voice/recognition/src/language/language-types.ts#

  • L25

    ts
    23   */
    24  export function createLanguageDetectionId(): LanguageDetectionId {
    25    return `lang_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as LanguageDetectionId;
    26  }
    27
    

libs/iris/multimodal/voice/recognition/src/speaker/speaker-diarization.ts#

  • L119

    ts
    117          endMs: seg.endMs,
    118          durationMs: seg.durationMs,
    119          confidence: 0.8 + Math.random() * 0.2,
    120        }));
    121      }
    
  • L465

    ts
    463          endMs: seg.endMs,
    464          durationMs: seg.durationMs,
    465          confidence: 0.8 + Math.random() * 0.2,
    466        };
    467      });
    

libs/iris/multimodal/voice/recognition/src/speaker/speaker-types.ts#

  • L30

    ts
    28  export function createVoiceProfileId(id?: string): VoiceProfileId {
    29    return (id ??
    30      `profile_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`) as VoiceProfileId;
    31  }
    32
    
  • L37

    ts
    35   */
    36  export function createEnrollmentSessionId(): EnrollmentSessionId {
    37    return `enroll_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as EnrollmentSessionId;
    38  }
    39
    
  • L44

    ts
    42   */
    43  export function createVerificationSessionId(): VerificationSessionId {
    44    return `verify_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as VerificationSessionId;
    45  }
    46
    

libs/iris/multimodal/voice/recognition/src/voice-call-recording.ts#

  • L319

    ts
    317
    318  function createId(prefix: string): string {
    319    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    320  }
    321
    

libs/iris/multimodal/voice/recognition/src/voice-call-translation.ts#

  • L309

    ts
    307
    308  function createId(prefix: string): string {
    309    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    310  }
    311
    
  • L386

    ts
    384      const now = new Date();
    385      const id = createSessionId(
    386        `call_translation_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`
    387      );
    388
    

libs/iris/multimodal/voice/recognition/src/voice-journaling-features.ts#

  • L310

    ts
    308
    309  function createId(prefix: string): string {
    310    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    311  }
    312
    

libs/iris/multimodal/voice/recognition/src/voice-memo-reminders.ts#

  • L183

    ts
    181
    182  function createId(prefix: string): string {
    183    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    184  }
    185
    

libs/iris/multimodal/voice/recognition/src/voice-note-organization.ts#

  • L265

    ts
    263
    264  function createId(prefix: string): string {
    265    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    266  }
    267
    

libs/iris/multimodal/voice/recognition/src/voice-transcription-editing.ts#

  • L219

    ts
    217
    218  function createSegmentId(prefix = 'edited_segment'): string {
    219    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 9)}`;
    220  }
    221
    
  • L340

    ts
    338      const now = new Date();
    339      const id = createSessionId(
    340        `transcript_edit_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`
    341      );
    342      const prepared = this.prepareTranscript(cloneTranscript(transcript));
    

libs/iris/multimodal/voice/recognition/src/whisper/whisper-types.ts#

  • L32

    ts
    30   */
    31  export function createWhisperModelId(id?: string): WhisperModelId {
    32    return (id ?? `model_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`) as WhisperModelId;
    33  }
    34
    
  • L39

    ts
    37   */
    38  export function createWhisperRequestId(): WhisperRequestId {
    39    return `req_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as WhisperRequestId;
    40  }
    41
    
  • L951

    ts
    949
    950    return {
    951      id: `transcript_${Date.now()}_${Math.random().toString(36).slice(2, 8)}` as any,
    952      sessionId: sessionId as any,
    953      type: 'final',
    

libs/iris/multimodal/voice/synthesis/src/cartesia/cartesia-provider.ts#

  • L650

    ts
    648      const baseLatency = this.config.lowLatencyMode ? 25 : 50;
    649      const textLatency = Math.min((request.text.length / 200) * 10, 50);
    650      const latencyMs = baseLatency + textLatency + Math.random() * 20;
    651
    652      await this.sleep(latencyMs);
    
  • L708

    ts
    706        // Ultra-low latency per chunk
    707        const chunkLatency = this.config.lowLatencyMode ? 15 : 30;
    708        await this.sleep(chunkLatency + Math.random() * 10);
    709
    710        // Calculate chunk duration
    
  • L828

    ts
    826     */
    827    private generateSessionId(): string {
    828      return `session_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    829    }
    830
    

libs/iris/multimodal/voice/synthesis/src/elevenlabs/elevenlabs-provider.ts#

  • L440

    ts
    438      // Generate a new voice ID
    439      const voiceId =
    440        `cloned_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as ElevenLabsVoiceId;
    441
    442      // Create cloned voice entry
    

libs/iris/multimodal/voice/synthesis/src/local/local-provider.ts#

  • L886

    ts
    884      }[model.quality];
    885
    886      const processingMs = durationMs * qualityFactor + Math.random() * 50;
    887      await this.sleep(processingMs);
    888
    
  • L943

    ts
    941        }[model.quality];
    942
    943        await this.sleep(durationMs * qualityFactor + Math.random() * 20);
    944
    945        // Create audio chunk
    

libs/iris/multimodal/voice/synthesis/src/personas/persona-provider.ts#

  • L72

    ts
    70   */
    71  function generateId(prefix: string): string {
    72    return `${prefix}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    73  }
    74
    

libs/iris/multimodal/voice/synthesis/src/synthesis-types.ts#

  • L33

    ts
    31   */
    32  export function createSynthesisSessionId(): SynthesisSessionId {
    33    return `synth_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as SynthesisSessionId;
    34  }
    35
    
  • L40

    ts
    38   */
    39  export function createVoiceId(prefix = 'voice'): VoiceId {
    40    return `${prefix}_${Math.random().toString(36).slice(2, 11)}` as VoiceId;
    41  }
    42
    
  • L47

    ts
    45   */
    46  export function createAudioChunkId(): AudioChunkId {
    47    return `chunk_${Date.now()}_${Math.random().toString(36).slice(2, 11)}` as AudioChunkId;
    48  }
    49
    

libs/iris/platform/billing/src/billing-calculator.ts#

  • L115

    ts
    113
    114      return {
    115        statementId: `stmt_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,
    116        accountId,
    117        planId,
    

libs/iris/platform/billing/src/invoice-generator.ts#

  • L30

    ts
    28      );
    29      const invoiceNumber = this.nextInvoiceNumber(issueDate);
    30      const invoiceId = `inv_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
    31
    32      const markdown = this.renderMarkdown(invoiceNumber, statement, issueDate, dueDate, notes);
    

libs/iris/platform/billing/src/payment-integration.ts#

  • L22

    ts
    20      const shouldFail = request.paymentMethod.reference.toLowerCase().includes('fail');
    21      return {
    22        paymentId: `pay_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,
    23        invoiceId: request.invoiceId,
    24        accountId: request.accountId,
    
  • L70

    ts
    68      if (invoice.statement.totalCents <= 0) {
    69        return {
    70          paymentId: `pay_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,
    71          invoiceId: invoice.invoiceId,
    72          accountId: invoice.statement.accountId,
    

libs/iris/platform/billing/src/usage-tracker.ts#

  • L44

    ts
    42
    43      const event: UsageEvent = {
    44        id: `usage_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,
    45        accountId: input.accountId,
    46        endpoint: input.endpoint,
    

libs/iris/platform/customization/agents/src/utils/id.ts#

  • L12

    ts
    10    } else {
    11      for (let i = 0; i < bytes.length; i++) {
    12        bytes[i] = Math.floor(Math.random() * 256);
    13      }
    14    }
    

libs/iris/platform/streaming/src/protocol/index.ts#

  • L127

    ts
    125    subscribe(filter: SubscriptionFilter): Subscription {
    126      const subscription: Subscription = {
    127        id: `sub_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    128        filter,
    129        createdAt: new Date(),
    
  • L348

    ts
    346     */
    347    protected generateConnectionId(): string {
    348      return `conn_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
    349    }
    350
    

libs/iris/platform/streaming/src/types.ts#

  • L302

    ts
    300   */
    301  export function createEventId(): string {
    302    return `evt_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
    303  }
    304
    

libs/iris/platform/streaming/src/websocket/index.ts#

  • L513

    ts
    511
    512    constructor(ws: WebSocket) {
    513      this.id = `client_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
    514      this.connectedAt = new Date();
    515      this.ws = ws;
    
  • L784

    ts
    782          const sub = message.payload as SubscribeMessage;
    783          const subscription: Subscription = {
    784            id: `sub_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    785            filter: sub.filter,
    786            createdAt: new Date(),
    

libs/iris/platform/webhooks/src/event-dispatcher.ts#

  • L82

    ts
    80    ): Promise<DispatchResult> {
    81      const envelope: WebhookEventEnvelope<T> = {
    82        id: `evt_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,
    83        type: eventType,
    84        timestamp: new Date().toISOString(),
    
  • L164

    ts
    162
    163      return {
    164        deliveryId: `del_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,
    165        subscriptionId: subscription.id,
    166        eventId: envelope.id,
    

libs/iris/platform/webhooks/src/retry-handler.ts#

  • L39

    ts
    37      this.sleep = deps.sleep ?? defaultSleep;
    38      this.now = deps.now ?? (() => new Date());
    39      this.random = deps.random ?? Math.random;
    40    }
    41
    

libs/iris/platform/webhooks/src/webhook-manager.ts#

  • L37

    ts
    35
    36      const now = new Date();
    37      const id = `wh_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
    38
    39      const created: WebhookSubscription = {
    

libs/iris/presence/integration/src/hathor-integration.ts#

  • L487

    ts
    485     */
    486    private generateId(): string {
    487      return `hathor-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    488    }
    489
    

libs/iris/presence/integration/src/maya-integration.ts#

  • L379

    ts
    377     */
    378    private generateId(): string {
    379      return `maya-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    380    }
    381
    

libs/iris/presence/integration/src/nyx-integration.ts#

  • L551

    ts
    549     */
    550    private generateId(): string {
    551      return `nyx-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    552    }
    553
    

libs/iris/presence/integration/src/oshun-integration.ts#

  • L755

    ts
    753     */
    754    private generateId(): string {
    755      return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    756    }
    757
    

libs/iris/presence/integration/src/yemaya-integration.ts#

  • L475

    ts
    473     */
    474    private generateId(): string {
    475      return `yemaya-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    476    }
    477
    

libs/iris/presence/sync/src/notification-unification.ts#

  • L747

    ts
    745     */
    746    private generateId(): string {
    747      return `notif-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    748    }
    749  }
    

libs/iris/presence/sync/src/state-sync.ts#

  • L876

    ts
    874     */
    875    private generateId(): string {
    876      return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    877    }
    878  }
    

libs/iris/presence/sync/src/task-handoff.ts#

  • L688

    ts
    686     */
    687    private generateId(): string {
    688      return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    689    }
    690  }
    

libs/iris/privacy/audit/src/utils.ts#

  • L8

    ts
    6
    7  export function stableId(prefix: string): string {
    8    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    9  }
    10
    

libs/iris/privacy/dashboard/src/utils.ts#

  • L8

    ts
    6
    7  export function stableId(prefix: string): string {
    8    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    9  }
    10
    

libs/iris/privacy/local/src/acceleration/gpu-accelerator.ts#

  • L1132

    ts
    1130
    1131    private generateId(): string {
    1132      return `gpu-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    1133    }
    1134
    

libs/iris/privacy/local/src/hybrid/hybrid-cloud-edge.ts#

  • L879

    ts
    877
    878    private generateRequestId(): string {
    879      return `req-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    880    }
    881
    

libs/iris/privacy/local/src/offline/offline-sync.ts#

  • L1053

    ts
    1051
    1052    private generateId(): string {
    1053      return `sync-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    1054    }
    1055
    

libs/iris/privacy/safety/behavior/src/action-confirmation.ts#

  • L229

    ts
    227    ];
    228
    229    const phrase = phrases[Math.floor(Math.random() * phrases.length)];
    230
    231    return {
    
  • L243

    ts
    241   */
    242  function generateCodeChallenge(): ConfirmationChallenge {
    243    const code = Math.floor(100000 + Math.random() * 900000).toString();
    244
    245    return {
    
  • L258

    ts
    256   */
    257  function generateCalculationChallenge(): ConfirmationChallenge {
    258    const a = Math.floor(10 + Math.random() * 90);
    259    const b = Math.floor(10 + Math.random() * 90);
    260    const answer = (a + b).toString();
    
  • L259

    ts
    257  function generateCalculationChallenge(): ConfirmationChallenge {
    258    const a = Math.floor(10 + Math.random() * 90);
    259    const b = Math.floor(10 + Math.random() * 90);
    260    const answer = (a + b).toString();
    261
    

libs/iris/privacy/safety/transparency/src/uncertainty-disclosure.ts#

  • L268

    ts
    266    getUncertaintyPhrase(confidenceLevel: ConfidenceLevel): string {
    267      const phrases = this.getPhrasesByLevel(confidenceLevel);
    268      return phrases[Math.floor(Math.random() * phrases.length)];
    269    }
    270
    

libs/iris/privacy/safety/transparency/src/utils.ts#

  • L12

    ts
    10  export function v4(): string {
    11    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    12      const r = (Math.random() * 16) | 0;
    13      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    14      return v.toString(16);
    

libs/iris/privacy/security/injection/src/utils.ts#

  • L8

    ts
    6
    7  export function stableId(prefix: string): string {
    8    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    9  }
    10
    

libs/iris/privacy/security/logging/src/utils.ts#

  • L15

    ts
    13
    14  export function stableId(prefix: string): string {
    15    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    16  }
    17
    

libs/iris/privacy/security/pentest/src/utils.ts#

  • L13

    ts
    11
    12  export function stableId(prefix: string): string {
    13    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    14  }
    15
    

libs/iris/privacy/security/threats/src/utils.ts#

  • L8

    ts
    6
    7  export function stableId(prefix: string): string {
    8    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    9  }
    10
    

libs/iris/privacy/sovereignty/src/compliance/ccpa-compliance.ts#

  • L1133

    ts
    1131
    1132    private generateId(prefix: string): string {
    1133      return `${prefix}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    1134    }
    1135
    

libs/iris/privacy/sovereignty/src/compliance/gdpr-compliance.ts#

  • L1371

    ts
    1369
    1370    private generateId(prefix: string): string {
    1371      return `${prefix}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    1372    }
    1373
    

libs/iris/privacy/sovereignty/src/index.ts#

  • L1080

    ts
    1078      categories?: PersonalDataCategory[]
    1079    ): Promise<RightToDeletionResult> {
    1080      const deletionId = `del_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    1081
    1082      const result: RightToDeletionResult = {
    
  • L1183

    ts
    1181    }): Promise<DataDeletionWorkflow> {
    1182      const now = new Date();
    1183      const workflowId = `dwf_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1184      const workflowBase: DataDeletionWorkflow = {
    1185        workflowId,
    
  • L1584

    ts
    1582
    1583      const selection: DataResidencySelection = {
    1584        selectionId: `rsel_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1585        subjectId: request.subjectId,
    1586        preferredRegion: request.preferredRegion,
    
  • L2147

    ts
    2145      const now = new Date();
    2146      const round: FederatedLearningRound = {
    2147        roundId: `flr_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    2148        modelVersion: request.modelVersion?.trim() || `model_${Date.now()}`,
    2149        status: 'open',
    
  • L2219

    ts
    2217      const now = new Date();
    2218      const update: FederatedLearningModelUpdateRecord = {
    2219        updateId: `flu_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    2220        roundId: round.roundId,
    2221        participantHash,
    
  • L2503

    ts
    2501
    2502      const record: PrivacyAnalyticsEventRecord = {
    2503        id: `pae_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    2504        eventType,
    2505        timestamp: normalizedTimestamp,
    
  • L2934

    ts
    2932
    2933      const report: PrivacyAuditReport = {
    2934        reportId: `par_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    2935        organizationId: this.config.organizationId,
    2936        generatedAt: new Date(),
    
  • L4114

    ts
    4112        //   configured. The seeded branch below uses an xorshift32 PRNG
    4113        //   for reproducible tests / audit replay.
    4114        return Math.random();
    4115      }
    4116
    
  • L4357

    ts
    4355      this.pruneAuditLogs();
    4356      const log: SovereigntyAuditLog = {
    4357        id: `audit_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    4358        organizationId: this.config.organizationId,
    4359        timestamp: new Date(),
    

libs/iris/privacy/sovereignty/src/residency/data-residency.ts#

  • L844

    ts
    842
    843    private generateId(prefix: string): string {
    844      return `${prefix}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    845    }
    846
    

libs/iris/sdk/typescript/src/http/client.ts#

  • L579

    ts
    577      const maxDelay = 30000;
    578      const exponentialDelay = baseDelay * Math.pow(2, attempt);
    579      const jitter = Math.random() * 0.3 + 0.85; // 0.85-1.15
    580      return Math.min(exponentialDelay * jitter, maxDelay);
    581    }
    

libs/iris/testing/load/src/load-test-suite.ts#

  • L50

    ts
    48      };
    49      this.profiler = deps.profiler ?? new LoadProfiler();
    50      this.rng = deps.rng ?? Math.random;
    51      this.now = deps.now ?? (() => new Date());
    52      this.sleepFn =
    

libs/iris/testing/src/e2e/agent-tasks.ts#

  • L405

    ts
    403
    404        // Check for simulated failure
    405        if (this.config.failingTasks.has(task.id) || Math.random() < this.config.failureRate) {
    406          clearInterval(interval);
    407          this.forceFailure(task.id, new Error('Simulated task failure'));
    

libs/iris/testing/src/e2e/memory-persistence.ts#

  • L358

    ts
    356                await ctx.archivalMemory.add(
    357                  userId,
    358                  `Memory entry ${i} with unique content ${Math.random()}`
    359                );
    360              }
    

libs/iris/testing/src/fixtures/conversation.ts#

  • L493

    ts
    491
    492    for (let i = 0; i < count; i++) {
    493      const messageCount = Math.floor(Math.random() * 10) + 2;
    494      conversations.push(
    495        createConversation({
    

libs/iris/testing/src/mocks/http-client.ts#

  • L366

    ts
    364
    365      // Check for random error
    366      if (this.config.errorProbability && Math.random() < this.config.errorProbability) {
    367        const error = new Error('Random HTTP mock error');
    368        const entry: HttpRequestHistoryEntry = {
    

libs/iris/testing/src/mocks/memory-store.ts#

  • L829

    ts
    827      const embedding: number[] = [];
    828      for (let i = 0; i < this.embeddingDimensions; i++) {
    829        embedding.push(Math.random() * 2 - 1); // Random values between -1 and 1
    830      }
    831      // Normalize
    

libs/iris/testing/src/mocks/model-provider.ts#

  • L349

    ts
    347      if (
    348        this.responseConfig.errorProbability &&
    349        Math.random() < this.responseConfig.errorProbability
    350      ) {
    351        const error = new Error('Random mock error');
    
  • L638

    ts
    636   */
    637  export function generateMockId(prefix: string): string {
    638    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    639  }
    640
    

libs/iris/testing/src/mocks/storage.ts#

  • L529

    ts
    527      }
    528
    529      if (this.config.errorProbability && Math.random() < this.config.errorProbability) {
    530        const error = new Error('Random database mock error');
    531        this.queryHistory.push({
    
  • L868

    ts
    866      }
    867
    868      if (this.config.errorProbability && Math.random() < this.config.errorProbability) {
    869        const error = new Error('Random cache mock error');
    870        this.operationHistory.push({
    
  • L1228

    ts
    1226      const vector: number[] = [];
    1227      for (let i = 0; i < (this.config.dimensions ?? 1536); i++) {
    1228        vector.push(Math.random() * 2 - 1);
    1229      }
    1230      // Normalize
    
  • L1315

    ts
    1313      }
    1314
    1315      if (this.config.errorProbability && Math.random() < this.config.errorProbability) {
    1316        const error = new Error('Random vector store mock error');
    1317        this.operationHistory.push({
    

libs/iris/testing/src/mocks/voice-provider.ts#

  • L352

    ts
    350
    351      // Check for random error
    352      if (this.config.errorProbability && Math.random() < this.config.errorProbability) {
    353        const error = new Error('Random TTS mock error');
    354        const entry: SynthesisHistoryEntry = {
    
  • L377

    ts
    375        // Fill with noise-like data
    376        for (let i = 0; i < totalBytes; i++) {
    377          audioData[i] = Math.floor(Math.random() * 256);
    378        }
    379      }
    
  • L437

    ts
    435        const chunk = new Uint8Array(currentChunkSize);
    436        for (let j = 0; j < currentChunkSize; j++) {
    437          chunk[j] = Math.floor(Math.random() * 256);
    438        }
    439        yield chunk;
    
  • L577

    ts
    575
    576      // Check for random error
    577      if (this.config.errorProbability && Math.random() < this.config.errorProbability) {
    578        const error = new Error('Random STT mock error');
    579        const entry: RecognitionHistoryEntry = {
    
  • L678

    ts
    676      let currentTime = 0;
    677      for (const word of words) {
    678        const duration = avgWordDuration * (0.5 + Math.random());
    679        timings.push({
    680          word,
    
  • L683

    ts
    681          startMs: Math.floor(currentTime),
    682          endMs: Math.floor(currentTime + duration),
    683          confidence: 0.85 + Math.random() * 0.15,
    684        });
    685        currentTime += duration;
    
  • L701

    ts
    699
    700      for (const sentence of sentences) {
    701        const duration = avgSentenceDuration * (0.7 + Math.random() * 0.6);
    702        segments.push({
    703          speaker: `Speaker ${currentSpeaker + 1}`,
    

libs/iris/testing/src/performance/load-tests.ts#

  • L486

    ts
    484
    485      const totalWeight = this.scenarios.reduce((sum, s) => sum + (s.weight ?? 1), 0);
    486      let random = Math.random() * totalWeight;
    487
    488      for (const scenario of this.scenarios) {
    

libs/iris/testing/src/regression/baseline.ts#

  • L64

    ts
    62  function generateBaselineId(name: string, modelVersion: ModelVersion): string {
    63    const timestamp = Date.now().toString(36);
    64    const random = Math.random().toString(36).slice(2, 8);
    65    const namePart = name
    66      .toLowerCase()
    

libs/iris/testing/src/regression/tests.ts#

  • L33

    ts
    31          // Simulate a response generation
    32          // In a real test, this would call the actual model // stub:legitimate self-test scaffold; real models wired by suite caller
    33          await simulateLatency(50 + Math.random() * 50);
    34          return { success: true };
    35        });
    
  • L64

    ts
    62        const result = await ctx.sample('generation', async () => {
    63          // Simulate token generation
    64          const tokens = 100 + Math.floor(Math.random() * 100);
    65          await simulateLatency(tokens * 0.5); // ~0.5ms per token
    66          return { tokens };
    
  • L99

    ts
    97        const result = await ctx.sample('ttft', async () => {
    98          // Simulate time to first token (model loading + first token)
    99          const ttft = 20 + Math.random() * 30;
    100          await simulateLatency(ttft);
    101
    
  • L103

    ts
    101
    102          // Then generate rest of response
    103          await simulateLatency(50 + Math.random() * 50);
    104
    105          return { ttft };
    
  • L144

    ts
    142        const result = await ctx.sample('memory-test', async () => {
    143          // Simulate memory-intensive operation
    144          const data = new Array(10000).fill(0).map(() => Math.random());
    145          await simulateLatency(10);
    146          return { size: data.length };
    
  • L232

    ts
    230      for (let i = 0; i < ctx.sampleCount; i++) {
    231        // Simulate factuality check
    232        const score = 0.8 + Math.random() * 0.2; // 0.8-1.0 range
    233        scores.push(score);
    234
    
  • L270

    ts
    268      for (let i = 0; i < ctx.sampleCount; i++) {
    269        // Simulate consistency check between multiple responses
    270        const score = 0.85 + Math.random() * 0.15; // 0.85-1.0 range
    271        scores.push(score);
    272
    
  • L308

    ts
    306      for (let i = 0; i < ctx.sampleCount; i++) {
    307        // Simulate safety check
    308        const score = 0.95 + Math.random() * 0.05; // 0.95-1.0 range (should be high)
    309        scores.push(score);
    310
    
  • L356

    ts
    354        const result = await ctx.sample('model-behavior', async () => {
    355          // Simulate behavior tests
    356          await simulateLatency(30 + Math.random() * 20);
    357
    358          return {
    
  • L359

    ts
    357
    358          return {
    359            instructionFollowing: 0.9 + Math.random() * 0.1,
    360            formatAdherence: 0.85 + Math.random() * 0.15,
    361            reasoning: 0.8 + Math.random() * 0.2,
    
  • L360

    ts
    358          return {
    359            instructionFollowing: 0.9 + Math.random() * 0.1,
    360            formatAdherence: 0.85 + Math.random() * 0.15,
    361            reasoning: 0.8 + Math.random() * 0.2,
    362          };
    
  • L361

    ts
    359            instructionFollowing: 0.9 + Math.random() * 0.1,
    360            formatAdherence: 0.85 + Math.random() * 0.15,
    361            reasoning: 0.8 + Math.random() * 0.2,
    362          };
    363        });
    
  • L416

    ts
    414      for (let i = 0; i < ctx.sampleCount; i++) {
    415        // Simulate capability tests
    416        capabilities.coding.push(0.85 + Math.random() * 0.15);
    417        capabilities.analysis.push(0.8 + Math.random() * 0.2);
    418        capabilities.writing.push(0.9 + Math.random() * 0.1);
    
  • L417

    ts
    415        // Simulate capability tests
    416        capabilities.coding.push(0.85 + Math.random() * 0.15);
    417        capabilities.analysis.push(0.8 + Math.random() * 0.2);
    418        capabilities.writing.push(0.9 + Math.random() * 0.1);
    419        capabilities.math.push(0.75 + Math.random() * 0.25);
    
  • L418

    ts
    416        capabilities.coding.push(0.85 + Math.random() * 0.15);
    417        capabilities.analysis.push(0.8 + Math.random() * 0.2);
    418        capabilities.writing.push(0.9 + Math.random() * 0.1);
    419        capabilities.math.push(0.75 + Math.random() * 0.25);
    420      }
    
  • L419

    ts
    417        capabilities.analysis.push(0.8 + Math.random() * 0.2);
    418        capabilities.writing.push(0.9 + Math.random() * 0.1);
    419        capabilities.math.push(0.75 + Math.random() * 0.25);
    420      }
    421
    
  • L517

    ts
    515    passed: boolean;
    516  } {
    517    const relevance = 0.7 + Math.random() * 0.3;
    518    const coherence = 0.75 + Math.random() * 0.25;
    519    const completeness = 0.65 + Math.random() * 0.35;
    
  • L518

    ts
    516  } {
    517    const relevance = 0.7 + Math.random() * 0.3;
    518    const coherence = 0.75 + Math.random() * 0.25;
    519    const completeness = 0.65 + Math.random() * 0.35;
    520    const fluency = 0.8 + Math.random() * 0.2;
    
  • L519

    ts
    517    const relevance = 0.7 + Math.random() * 0.3;
    518    const coherence = 0.75 + Math.random() * 0.25;
    519    const completeness = 0.65 + Math.random() * 0.35;
    520    const fluency = 0.8 + Math.random() * 0.2;
    521
    
  • L520

    ts
    518    const coherence = 0.75 + Math.random() * 0.25;
    519    const completeness = 0.65 + Math.random() * 0.35;
    520    const fluency = 0.8 + Math.random() * 0.2;
    521
    522    const overall = (relevance + coherence + completeness + fluency) / 4;
    

libs/iris/testing/synthetic/src/alert-integration.ts#

  • L38

    ts
    36      this.now = deps.now ?? (() => new Date());
    37      this.alertIdFactory =
    38        deps.alertIdFactory ?? (() => `alert-${Date.now()}-${Math.random().toString(16).slice(2)}`);
    39    }
    40
    

libs/iris/testing/synthetic/src/health-check-probes.ts#

  • L40

    ts
    38        deps.sleep ?? (async (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)));
    39      this.runIdFactory =
    40        deps.runIdFactory ?? (() => `probe-run-${Date.now()}-${Math.random().toString(16).slice(2)}`);
    41    }
    42
    

libs/iris/testing/synthetic/src/synthetic-monitor.ts#

  • L59

    ts
    57      this.runIdFactory =
    58        deps.runIdFactory ??
    59        (() => `synthetic-run-${Date.now()}-${Math.random().toString(16).slice(2)}`);
    60    }
    61
    

libs/iris/testing/synthetic/src/user-journey-tests.ts#

  • L38

    ts
    36      this.runIdFactory =
    37        deps.runIdFactory ??
    38        (() => `journey-run-${Date.now()}-${Math.random().toString(16).slice(2)}`);
    39    }
    40
    

libs/iris/types/src/agent.ts#

  • L634

    ts
    632  function generateUniqueId(prefix: string): string {
    633    const timestamp = Date.now().toString(36);
    634    const random = Math.random().toString(36).substring(2, 10);
    635    return `${prefix}_${timestamp}-${random}`;
    636  }
    

libs/iris/types/src/conversation.ts#

  • L653

    ts
    651  function generateUniqueId(prefix: string): string {
    652    const timestamp = Date.now().toString(36);
    653    const random = Math.random().toString(36).substring(2, 10);
    654    return `${prefix}_${timestamp}-${random}`;
    655  }
    

libs/iris/types/src/events.ts#

  • L664

    ts
    662  function generateUniqueId(prefix: string): string {
    663    const timestamp = Date.now().toString(36);
    664    const random = Math.random().toString(36).substring(2, 10);
    665    return `${prefix}_${timestamp}-${random}`;
    666  }
    

libs/iris/types/src/memory.ts#

  • L552

    ts
    550  function generateUniqueId(prefix: string): string {
    551    const timestamp = Date.now().toString(36);
    552    const random = Math.random().toString(36).substring(2, 10);
    553    return `${prefix}_${timestamp}-${random}`;
    554  }
    

libs/iris/types/src/tool.ts#

  • L487

    ts
    485  function generateUniqueId(prefix: string): string {
    486    const timestamp = Date.now().toString(36);
    487    const random = Math.random().toString(36).substring(2, 10);
    488    return `${prefix}_${timestamp}-${random}`;
    489  }
    

libs/iris/types/src/user.ts#

  • L510

    ts
    508  function generateUniqueId(prefix: string): string {
    509    const timestamp = Date.now().toString(36);
    510    const random = Math.random().toString(36).substring(2, 10);
    511    return `${prefix}_${timestamp}-${random}`;
    512  }
    

libs/iris/voice/ultra-low-latency/src/backchannel-generator.ts#

  • L60

    ts
    58
    59    private shouldGenerate(input: BackchannelGenerationInput): boolean {
    60      if (Math.random() > this.config.frequency) {
    61        return false;
    62      }
    

libs/iris/voice/ultra-low-latency/src/context-preserver.ts#

  • L26

    ts
    24    preserve(request: ContextPreservationRequest): PreservedInterruptionContext {
    25      const context: PreservedInterruptionContext = {
    26        contextId: `ctx-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 7)}`,
    27        sessionId: request.sessionId,
    28        preservedAt: new Date(),
    

libs/iris/voice/ultra-low-latency/src/streaming-tts-pipeline.ts#

  • L66

    ts
    64        request.sessionId ??
    65        toUltraLowLatencySessionId(
    66          `ultra-tts-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`
    67        );
    68      let decision = this.tradeoffController.choose({
    

libs/isis/3d-asset-library/src/core/ingestion-pipeline.ts#

  • L1810

    ts
    1808
    1809  function createIngestionAssetId(): string {
    1810    return `asset_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    1811  }
    1812
    

libs/isis/3d-generation/src/images/multiview.ts#

  • L438

    ts
    436  function generateSetId(): string {
    437    const timestamp = Date.now().toString(36);
    438    const random = Math.random().toString(36).slice(2, 8);
    439    return `mvset_${timestamp}_${random}`;
    440  }
    

libs/isis/3d-generation/src/images/preprocessing.ts#

  • L959

    ts
    957  function generateProcessingId(): string {
    958    const timestamp = Date.now().toString(36);
    959    const random = Math.random().toString(36).slice(2, 8);
    960    return `proc_${timestamp}_${random}`;
    961  }
    

libs/isis/3d-generation/src/images/upload.ts#

  • L456

    ts
    454  function generateUploadId(): string {
    455    const timestamp = Date.now().toString(36);
    456    const random = Math.random().toString(36).slice(2, 8);
    457    return `img_${timestamp}_${random}`;
    458  }
    

libs/isis/3d-generation/src/processing/mesh-cleanup-utils.ts#

  • L740

    ts
    738      const checked = new Set<string>();
    739      for (let n = 0; n < checkCount; n++) {
    740        const i = Math.floor(Math.random() * faceCount);
    741        const j = Math.floor(Math.random() * faceCount);
    742        if (i === j) continue;
    
  • L741

    ts
    739      for (let n = 0; n < checkCount; n++) {
    740        const i = Math.floor(Math.random() * faceCount);
    741        const j = Math.floor(Math.random() * faceCount);
    742        if (i === j) continue;
    743        const key = i < j ? `${i}-${j}` : `${j}-${i}`;
    

libs/isis/3d-generation/src/processing/mesh-processor.ts#

  • L1126

    ts
    1124      );
    1125      const result: TopologyAnalysisResult = {
    1126        id: `topology-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    1127        faceDistribution,
    1128        poles,
    
  • L2050

    ts
    2048      try {
    2049        // Update job status
    2050        const jobId = `rig-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    2051        this.updateAutoRigJob(jobId, 'analyzing', 0, 'Analyzing mesh structure');
    2052        // Merge with defaults
    
  • L2156

    ts
    2154        // Generate result
    2155        const result: GeneratedRig = {
    2156          id: `rig-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    2157          modelId: request.modelId,
    2158          skeletonType: request.skeletonType,
    

libs/isis/3d-generation/src/processing/texture-processor.ts#

  • L253

    ts
    251      options: GPUTextureProcessingOptions = {}
    252    ): Promise<TextureUpscaleResult> {
    253      const textureId = `upscale-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    254      const opts = { ...this.getDefaultUpscaleOptions(), ...options };
    255      this.logger.info(`Starting texture upscale: ${textureId}`);
    
  • L575

    ts
    573      options: SeamlessTileOptions = {}
    574    ): Promise<SeamlessTileResult> {
    575      const textureId = `seamless-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    576      const opts = { ...this.getDefaultSeamlessOptions(), ...options };
    577      this.logger.info(`Starting seamless tiling: ${textureId}`);
    
  • L693

    ts
    691      options: MaterialIDOptions = {}
    692    ): Promise<MaterialIDResult> {
    693      const textureId = `material-id-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    694      const opts = { ...this.getDefaultMaterialIDOptions(), ...options };
    695      this.logger.info(`Starting material ID separation: ${textureId}`);
    
  • L788

    ts
    786     */
    787    async splitToUDIM(atlasData: Buffer, options: UDIMOptions): Promise<UDIMResult> {
    788      const textureId = `udim-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    789      const opts = { ...this.getDefaultUDIMOptions(), ...options };
    790      this.logger.info(`Starting UDIM split: ${textureId}`);
    

libs/isis/3d-generation/src/prompts/history.ts#

  • L523

    ts
    521  function generateHistoryId(): string {
    522    const timestamp = Date.now().toString(36);
    523    const random = Math.random().toString(36).slice(2, 8);
    524    return `hist_${timestamp}_${random}`;
    525  }
    

libs/isis/3d-generation/src/prompts/optimizer.ts#

  • L913

    ts
    911  function generateAnalysisId(): string {
    912    const timestamp = Date.now().toString(36);
    913    const random = Math.random().toString(36).slice(2, 8);
    914    return `analysis_${timestamp}_${random}`;
    915  }
    

libs/isis/3d-generation/src/providers/base-provider.ts#

  • L156

    ts
    154
    155    protected generateJobId(): string {
    156      return `${this.type}_${Date.now()}_${Math.random().toString(36).slice(2)}`;
    157    }
    158
    

libs/isis/3d-generation/src/results/comparison.ts#

  • L420

    ts
    418  function generateComparisonId(): string {
    419    const timestamp = Date.now().toString(36);
    420    const random = Math.random().toString(36).slice(2, 8);
    421    return `comp_${timestamp}_${random}`;
    422  }
    

libs/isis/3d-generation/src/results/preview.ts#

  • L362

    ts
    360  function generatePreviewId(): string {
    361    const timestamp = Date.now().toString(36);
    362    const random = Math.random().toString(36).slice(2, 8);
    363    return `preview_${timestamp}_${random}`;
    364  }
    
  • L371

    ts
    369  function generateAnimationId(): string {
    370    const timestamp = Date.now().toString(36);
    371    const random = Math.random().toString(36).slice(2, 8);
    372    return `anim_${timestamp}_${random}`;
    373  }
    

libs/isis/3d-generation/src/results/selection.ts#

  • L373

    ts
    371  function generateWorkflowId(): string {
    372    const timestamp = Date.now().toString(36);
    373    const random = Math.random().toString(36).slice(2, 8);
    374    return `workflow_${timestamp}_${random}`;
    375  }
    

libs/isis/3d-generation/src/results/storage.ts#

  • L362

    ts
    360  function generateGroupId(): string {
    361    const timestamp = Date.now().toString(36);
    362    const random = Math.random().toString(36).slice(2, 8);
    363    return `group_${timestamp}_${random}`;
    364  }
    

libs/isis/3d-generation/src/workflow/generation-service.ts#

  • L220

    ts
    218      return new Promise((resolve, reject) => {
    219        const item: QueueItem = {
    220          id: `queue_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    221          request,
    222          type: 'text',
    
  • L263

    ts
    261      return new Promise((resolve, reject) => {
    262        const item: QueueItem = {
    263          id: `queue_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    264          request,
    265          type: 'image',
    

libs/isis/3d-inference-local/src/models/trellis2-seed-control.ts#

  • L63

    ts
    61
    62  export function generateLocal3DTrellis2RandomSeed(): number {
    63    return Math.floor(Math.random() * (LOCAL_3D_TRELLIS2_MAX_SEED + 1));
    64  }
    

libs/isis/3d-inference-local/src/server/provider-rest-api.ts#

  • L370

    ts
    368      this.createJobId =
    369        options.createJobId ??
    370        (() => `local_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`);
    371      this.maxTrackedJobs = Math.max(1, options.maxTrackedJobs ?? DEFAULT_MAX_TRACKED_JOBS);
    372      this.maxRequestBodyBytes = Math.max(
    

libs/isis/3d-quality-gates/src/operations/annotation-tools.ts#

  • L199

    ts
    197
    198  function createAnnotationId(nowIso: string): string {
    199    return `annotation_${nowIso.replace(/[^0-9]/g, '').slice(0, 14)}_${Math.random()
    200      .toString(36)
    201      .slice(2, 10)}`;
    

libs/isis/ai-providers/src/orchestration/analytics-reporting.ts#

  • L731

    ts
    729  export function generateAnalyticsId(): string {
    730    const timestamp = Date.now().toString(36);
    731    const random = Math.random().toString(36).substring(2, 8);
    732    return `anl_${timestamp}_${random}`;
    733  }
    

libs/isis/ai-providers/src/orchestration/cost-optimization-engine.ts#

  • L574

    ts
    572  export function generateCostId(): string {
    573    const timestamp = Date.now().toString(36);
    574    const random = Math.random().toString(36).substring(2, 8);
    575    return `cost_${timestamp}_${random}`;
    576  }
    

libs/isis/ai-providers/src/orchestration/quality-assurance-pipeline.ts#

  • L769

    ts
    767  export function generateQAId(): string {
    768    const timestamp = Date.now().toString(36);
    769    const random = Math.random().toString(36).substring(2, 8);
    770    return `qa_${timestamp}_${random}`;
    771  }
    

libs/isis/ai-providers/src/orchestration/unified-generation-pipeline.ts#

  • L753

    ts
    751  export function generateRequestId(): string {
    752    const timestamp = Date.now().toString(36);
    753    const random = Math.random().toString(36).substring(2, 10);
    754    return `req_${timestamp}_${random}`;
    755  }
    
  • L761

    ts
    759   */
    760  export function calculateBackoffDelay(attempt: number, baseDelayMs: number): number {
    761    return baseDelayMs * Math.pow(2, attempt) + Math.random() * 1000;
    762  }
    763
    

libs/isis/ai-providers/src/providers/animation/animatediff-lightning-provider.ts#

  • L1226

    ts
    1224
    1225      // Generate seed if not provided
    1226      const seed = request.seed ?? Math.floor(Math.random() * 2147483647);
    1227
    1228      return {
    
  • L1277

    ts
    1275     */
    1276    private generateRequestId(): string {
    1277      return `animdiff-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
    1278    }
    1279
    
  • L730

    ts
    728  function generateId(prefix: string = ''): string {
    729    const timestamp = Date.now().toString(36);
    730    const random = Math.random().toString(36).substring(2, 9);
    731    return prefix ? `${prefix}_${timestamp}_${random}` : `${timestamp}_${random}`;
    732  }
    
  • L741

    ts
    739    let key = '';
    740    for (let i = 0; i < 6; i++) {
    741      key += chars.charAt(Math.floor(Math.random() * chars.length));
    742    }
    743    return key;
    

libs/isis/ai-providers/src/providers/civitai/collection-management-provider.ts#

  • L958

    ts
    956    async createCollection(request: CreateCollectionRequest): Promise<Collection> {
    957      const now = new Date();
    958      const id = `col_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    959
    960      const collection: CollectionDetails = {
    
  • L1163

    ts
    1161
    1162      const item: CollectionItem = {
    1163        id: `item_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1164        resourceId: request.resourceId,
    1165        resourceType: request.resourceType,
    
  • L1306

    ts
    1304      if (request.generateLink) {
    1305        const link: SharedCollectionLink = {
    1306          id: `link_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1307          collectionId: request.collectionId,
    1308          url: `https://civitai.com/collections/${collection.id}/shared/${Math.random().toString(36).substring(2, 15)}`,
    
  • L1308

    ts
    1306          id: `link_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1307          collectionId: request.collectionId,
    1308          url: `https://civitai.com/collections/${collection.id}/shared/${Math.random().toString(36).substring(2, 15)}`,
    1309          createdAt: new Date(),
    1310          expiresAt: request.expiresAt,
    

libs/isis/ai-providers/src/providers/civitai/content-safety-provider.ts#

  • L553

    ts
    551  function generateId(prefix: string = ''): string {
    552    const timestamp = Date.now().toString(36);
    553    const random = Math.random().toString(36).substring(2, 9);
    554    return prefix ? `${prefix}_${timestamp}_${random}` : `${timestamp}_${random}`;
    555  }
    

libs/isis/ai-providers/src/providers/civitai/creator-monetization-provider.ts#

  • L705

    ts
    703  function generateId(prefix: string = ''): string {
    704    const timestamp = Date.now().toString(36);
    705    const random = Math.random().toString(36).substring(2, 9);
    706    return prefix ? `${prefix}_${timestamp}_${random}` : `${timestamp}_${random}`;
    707  }
    

libs/isis/ai-providers/src/providers/civitai/model-comparison-provider.ts#

  • L1069

    ts
    1067
    1068      const result: GenerationResult = {
    1069        id: `gen_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1070        modelId: model.modelId,
    1071        versionId: model.versionId,
    
  • L1138

    ts
    1136
    1137      const comparison: SideBySideComparison = {
    1138        id: `cmp_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1139        prompt,
    1140        params: fullParams,
    
  • L1230

    ts
    1228
    1229      return {
    1230        id: `diff_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1231        modelA: resultA,
    1232        modelB: resultB,
    
  • L1303

    ts
    1301
    1302      return {
    1303        id: `batch_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1304        request,
    1305        startedAt,
    
  • L1448

    ts
    1446
    1447      const report: ComparisonReport = {
    1448        id: `report_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1449        title: `Model Comparison Report`,
    1450        models,
    
  • L1508

    ts
    1506    ): PromptSuite {
    1507      return {
    1508        id: `suite_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1509        name,
    1510        description: `Custom suite: ${name}`,
    

libs/isis/ai-providers/src/providers/civitai/model-quality-provider.ts#

  • L676

    ts
    674  function generateId(prefix: string = ''): string {
    675    const timestamp = Date.now().toString(36);
    676    const random = Math.random().toString(36).substring(2, 9);
    677    return prefix ? `${prefix}_${timestamp}_${random}` : `${timestamp}_${random}`;
    678  }
    

libs/isis/ai-providers/src/providers/civitai/model-versioning-provider.ts#

  • L1317

    ts
    1315
    1316      const pin: VersionPin = {
    1317        id: `pin_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1318        modelId: request.modelId,
    1319        modelName: model.name,
    
  • L1490

    ts
    1488    ): UpdateSubscription {
    1489      const subscription: UpdateSubscription = {
    1490        id: `sub_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1491        modelId,
    1492        modelName: '', // Will be populated
    

libs/isis/ai-providers/src/providers/civitai/usage-control-provider.ts#

  • L1239

    ts
    1237      const fullPolicy: OrganizationPolicy = {
    1238        ...policy,
    1239        id: `policy_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1240        createdAt: new Date(),
    1241        updatedAt: new Date(),
    
  • L1484

    ts
    1482      const fullEvent: UsageEvent = {
    1483        ...event,
    1484        id: `evt_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1485        timestamp: new Date(),
    1486        compliant,
    
  • L1654

    ts
    1652      const fullRule: EnforcementRule = {
    1653        ...rule,
    1654        id: `rule_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    1655      };
    1656
    

libs/isis/ai-providers/src/providers/comfy/runpod-adapter.ts#

  • L3963

    ts
    3961      const routingSeed = this.resolveCanaryRoutingSeed(request, traceContext);
    3962      if (!routingSeed) {
    3963        return Math.floor(Math.random() * 100);
    3964      }
    3965
    

libs/isis/ai-providers/src/providers/controlnet/controlnet-provider.ts#

  • L1417

    ts
    1415     */
    1416    private generateRequestId(prefix: string = 'controlnet'): string {
    1417      return `${prefix}-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
    1418    }
    1419
    

libs/isis/ai-providers/src/providers/conversational-ai/audio-enhancement/audio-isolation.ts#

  • L57

    ts
    55   */
    56  function generateJobId(): IsolationJobId {
    57    return `iso_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as IsolationJobId;
    58  }
    59
    

libs/isis/ai-providers/src/providers/conversational-ai/audio-enhancement/audio-restoration.ts#

  • L179

    ts
    177   */
    178  function generateJobId(): RestorationJobId {
    179    return `rest_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as RestorationJobId;
    180  }
    181
    

libs/isis/ai-providers/src/providers/conversational-ai/audio-enhancement/stem-separation.ts#

  • L76

    ts
    74   */
    75  function generateJobId(): StemJobId {
    76    return `stem_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as StemJobId;
    77  }
    78
    

libs/isis/ai-providers/src/providers/conversational-ai/conversational-ai-provider.ts#

  • L100

    ts
    98
    99  function generateId(prefix: string): string {
    100    return `${prefix}-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    101  }
    102
    

libs/isis/ai-providers/src/providers/conversational-ai/dubbing-studio/multi-speaker.ts#

  • L70

    ts
    68   */
    69  function generateSpeakerId(): SpeakerId {
    70    return `speaker_${Date.now()}_${Math.random().toString(36).substring(2, 8)}` as SpeakerId;
    71  }
    72
    

libs/isis/ai-providers/src/providers/conversational-ai/pronunciation-dictionary/learning-service.ts#

  • L277

    ts
    275   */
    276  function generateId(prefix: string): string {
    277    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 10)}`;
    278  }
    279
    

libs/isis/ai-providers/src/providers/conversational-ai/streaming-optimization/latency-monitoring.ts#

  • L310

    ts
    308   */
    309  function generateId(): string {
    310    return `${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 9)}`;
    311  }
    312
    

libs/isis/ai-providers/src/providers/conversational-ai/streaming-optimization/latency-optimizer.ts#

  • L83

    ts
    81
    82  function generateConnectionId(): string {
    83    return `conn_${Date.now()}_${Math.random().toString(36).substring(2, 10)}`;
    84  }
    85
    
  • L87

    ts
    85
    86  function generateRequestId(): string {
    87    return `req_${Date.now()}_${Math.random().toString(36).substring(2, 10)}`;
    88  }
    89
    

libs/isis/ai-providers/src/providers/conversational-ai/voice-analytics/ab-testing.ts#

  • L49

    ts
    47
    48  function generateTestId(): TestId {
    49    return `test_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as TestId;
    50  }
    51
    
  • L53

    ts
    51
    52  function generateVariantId(): VariantId {
    53    return `var_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as VariantId;
    54  }
    55
    
  • L57

    ts
    55
    56  function generateEventId(): string {
    57    return `evt_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
    58  }
    59
    

libs/isis/ai-providers/src/providers/conversational-ai/voice-analytics/quality-metrics.ts#

  • L48

    ts
    46   */
    47  function generateAnalyticsId(): AnalyticsId {
    48    return `analytics_${Date.now()}_${Math.random().toString(36).substring(2, 10)}` as AnalyticsId;
    49  }
    50
    
  • L55

    ts
    53   */
    54  function generateAlertId(): string {
    55    return `alert_${Date.now()}_${Math.random().toString(36).substring(2, 10)}`;
    56  }
    57
    

libs/isis/ai-providers/src/providers/conversational-ai/voice-analytics/usage-analytics.ts#

  • L51

    ts
    49   */
    50  function generateAnalyticsId(): AnalyticsId {
    51    return `analytics_${Date.now()}_${Math.random().toString(36).substring(2, 10)}` as AnalyticsId;
    52  }
    53
    

libs/isis/ai-providers/src/providers/conversational-ai/voice-marketplace/monetization.ts#

  • L511

    ts
    509      const creatorVoiceIds = Array.from(this.creatorVoices.get(creatorId) ?? []);
    510      const payout: PayoutRecord = {
    511        id: `payout_${Date.now()}_${Math.random().toString(36).substring(7)}`,
    512        creatorId,
    513        amount: payoutAmount,
    

libs/isis/ai-providers/src/providers/image-generation/flux-workflows.ts#

  • L194

    ts
    192    const sampler = params.sampler ?? defaults.sampler;
    193    const scheduler = params.scheduler ?? defaults.scheduler;
    194    const seed = params.seed ?? Math.floor(Math.random() * 2147483647);
    195    const batchSize = params.batchSize ?? 1;
    196
    
  • L373

    ts
    371    const sampler = params.sampler ?? defaults.sampler;
    372    const scheduler = params.scheduler ?? defaults.scheduler;
    373    const seed = params.seed ?? Math.floor(Math.random() * 2147483647);
    374    const denoise = params.denoise ?? 0.75;
    375
    
  • L573

    ts
    571    const sampler = params.sampler ?? defaults.sampler;
    572    const scheduler = params.scheduler ?? defaults.scheduler;
    573    const seed = params.seed ?? Math.floor(Math.random() * 2147483647);
    574    const growMask = params.growMask ?? 6;
    575    const blurMask = params.blurMask ?? 8;
    
  • L815

    ts
    813    const sampler = params.sampler ?? defaults.sampler;
    814    const scheduler = params.scheduler ?? defaults.scheduler;
    815    const seed = params.seed ?? Math.floor(Math.random() * 2147483647);
    816    const controlStrength = params.controlStrength ?? 1.0;
    817    const controlStart = params.controlStart ?? 0.0;
    

libs/isis/ai-providers/src/providers/image-generation/sd35-workflows.ts#

  • L317

    ts
    315    const steps = params.steps || 28;
    316    const cfgScale = params.cfgScale ?? 3.5;
    317    const seed = params.seed ?? Math.floor(Math.random() * 2147483647);
    318    const sampler = params.sampler || 'euler';
    319    const scheduler = params.scheduler || 'normal';
    
  • L481

    ts
    479    const steps = params.steps || 28;
    480    const cfgScale = params.cfgScale ?? 3.5;
    481    const seed = params.seed ?? Math.floor(Math.random() * 2147483647);
    482    const sampler = params.sampler || 'euler';
    483    const scheduler = params.scheduler || 'normal';
    
  • L658

    ts
    656    const steps = params.steps || 50;
    657    const cfgScale = params.cfgScale ?? 4.0;
    658    const seed = params.seed ?? Math.floor(Math.random() * 2147483647);
    659    const sampler = params.sampler || 'euler';
    660    const scheduler = params.scheduler || 'normal';
    
  • L897

    ts
    895    const steps = params.steps || 40;
    896    const cfgScale = params.cfgScale ?? 3.5;
    897    const seed = params.seed ?? Math.floor(Math.random() * 2147483647);
    898    const sampler = params.sampler || 'dpmpp_2m';
    899    const scheduler = params.scheduler || 'karras';
    

libs/isis/ai-providers/src/providers/image-generation/stability-provider.ts#

  • L885

    ts
    883
    884    private generateRequestId(): string {
    885      return `stab_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    886    }
    887
    

libs/isis/ai-providers/src/providers/instantid/instantid-provider.ts#

  • L1561

    ts
    1559        num_inference_steps: params.steps,
    1560        guidance_scale: params.cfgScale,
    1561        seed: params.seed ?? Math.floor(Math.random() * 2147483647),
    1562        sampler: params.sampler,
    1563        scheduler: params.scheduler,
    
  • L1593

    ts
    1591        num_inference_steps: params.steps,
    1592        guidance_scale: params.cfgScale,
    1593        seed: params.seed ?? Math.floor(Math.random() * 2147483647),
    1594      });
    1595    }
    

libs/isis/ai-providers/src/providers/ip-adapter/ip-adapter-provider.ts#

  • L1749

    ts
    1747        num_inference_steps: params.steps,
    1748        guidance_scale: params.cfgScale,
    1749        seed: params.seed ?? Math.floor(Math.random() * 2147483647),
    1750        sampler: params.sampler,
    1751        scheduler: params.scheduler,
    

libs/isis/ai-providers/src/providers/tts/elevenlabs-provider.ts#

  • L420

    ts
    418
    419    async createStreamingSession(config: WebSocketConfig): Promise<StreamingSession> {
    420      const sessionId = `session-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    421      const voiceId = config.voice_id;
    422      const modelId = config.model_id || this.defaultModel;
    
  • L1394

    ts
    1392    private emitEvent(type: ElevenLabsEventType, data: Partial<ElevenLabsEvent>): void {
    1393      const event: ElevenLabsEvent = {
    1394        eventId: `evt-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    1395        type,
    1396        timestamp: new Date().toISOString(),
    

libs/isis/ai-providers/src/providers/usage/usage-tracker.ts#

  • L1254

    ts
    1252
    1253    private generateId(): string {
    1254      return `usage_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
    1255    }
    1256
    

libs/isis/ai-providers/src/providers/video-generation/hunyuan-provider.ts#

  • L653

    ts
    651
    652    private generateRequestId(): string {
    653      return `hyvideo_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    654    }
    655
    

libs/isis/ai-providers/src/providers/video-generation/ltx-provider.ts#

  • L717

    ts
    715
    716    private generateRequestId(): string {
    717      return `ltx_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    718    }
    719
    

libs/isis/ai-providers/src/providers/video-generation/wan-provider.ts#

  • L756

    ts
    754
    755    private generateRequestId(): string {
    756      return `wan_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    757    }
    758
    

libs/isis/ai-providers/src/providers/video-processing/rife-provider.ts#

  • L786

    ts
    784     */
    785    private generateProcessId(prefix: string): string {
    786      return `${prefix}-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
    787    }
    788
    

libs/isis/ai-providers/src/providers/video-processing/rtx-provider.ts#

  • L1312

    ts
    1310     */
    1311    private generateProcessId(prefix: string): string {
    1312      return `${prefix}-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
    1313    }
    1314
    

libs/isis/ai-providers/src/providers/video-processing/topaz-provider.ts#

  • L1447

    ts
    1445     */
    1446    private generateProcessId(prefix: string): string {
    1447      return `${prefix}-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
    1448    }
    1449
    

libs/isis/ai-video/src/providers/runway-client.ts#

  • L738

    ts
    736    ): VideoGenerationJob {
    737      const job: VideoGenerationJob = {
    738        id: `runway_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    739        provider: 'runway',
    740        status: 'pending',
    

libs/isis/ai-video/src/providers/video-provider-client.ts#

  • L1829

    ts
    1827    private createJob(provider: VideoProvider, request: VideoGenerationRequest): VideoGenerationJob {
    1828      const job: VideoGenerationJob = {
    1829        id: `${provider}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    1830        provider,
    1831        status: 'pending',
    

libs/isis/ai-video/src/self-hosted/svd-server.ts#

  • L414

    ts
    412
    413      const job: VideoGenerationJob = {
    414        id: `svd_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    415        provider: 'stable_video',
    416        status: 'queued',
    

libs/isis/ai-video/src/workflow/video-workflow-manager.ts#

  • L204

    ts
    202      priority: QueuePriority = 'normal'
    203    ): Promise<string> {
    204      const jobId = `job_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    205
    206      const item: QueueItem = {
    

libs/isis/anomaly-detection/src/anomaly-detection-service.ts#

  • L1063

    ts
    1061
    1062    private generateDetectionId(): DetectionId {
    1063      return `det_${Date.now()}_${Math.random().toString(36).slice(2, 8)}` as DetectionId;
    1064    }
    1065
    

libs/isis/audio-generation/src/generation/music-generator.ts#

  • L176

    ts
    174      }
    175
    176      const generationId = `gen_${Date.now()}_${Math.random().toString(36).slice(2)}`;
    177
    178      // Track generation
    

libs/isis/audio-generation/src/generation/self-hosted.ts#

  • L780

    ts
    778
    779    private generateId(): string {
    780      return `sa_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    781    }
    782
    
  • L1053

    ts
    1051
    1052    private generateId(): string {
    1053      return `mg_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1054    }
    1055
    
  • L1253

    ts
    1251
    1252    private generateId(): string {
    1253      return `ac_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1254    }
    1255
    
  • L1393

    ts
    1391
    1392    private generateId(): string {
    1393      return `voice_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1394    }
    1395
    
  • L1694

    ts
    1692
    1693    private generateId(): string {
    1694      return `qa_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1695    }
    1696
    

libs/isis/audio-generation/src/generation/sfx-provider.ts#

  • L683

    ts
    681            const t = i / sampleRate;
    682            const envelope = Math.exp(-t * 15);
    683            const noise = (Math.random() * 2 - 1) * envelope;
    684            const thump = Math.sin(2 * Math.PI * 60 * t) * Math.exp(-t * 30);
    685            samples[i] = (noise * 0.3 + thump * 0.7) * 0.8;
    
  • L705

    ts
    703            const t = i / sampleRate;
    704            const envelope = Math.exp(-t * 10);
    705            const noise = (Math.random() * 2 - 1) * envelope;
    706            const thump = Math.sin(2 * Math.PI * 80 * t) * Math.exp(-t * 20);
    707            samples[i] = (noise * 0.5 + thump * 0.5) * 0.6;
    
  • L717

    ts
    715            const t = i / sampleRate;
    716            const modulation = 0.5 + 0.5 * Math.sin(2 * Math.PI * 0.2 * t);
    717            const noise = (Math.random() * 2 - 1) * modulation;
    718            // Simple low-pass effect via averaging
    719            if (i > 0) {
    
  • L745

    ts
    743            const splash = Math.sin(2 * Math.PI * 300 * t) * envelope;
    744            const bubbles = Math.sin(2 * Math.PI * 1200 * t) * Math.exp(-t * 30);
    745            const noise = (Math.random() * 2 - 1) * envelope * 0.3;
    746            samples[i] = (splash * 0.5 + bubbles * 0.2 + noise) * 0.6;
    747          }
    
  • L839

    ts
    837
    838    private generateJobId(): string {
    839      return `sfx_${Date.now()}_${Math.random().toString(36).slice(2)}`;
    840    }
    841
    

libs/isis/audio-generation/src/generation/suno-provider.ts#

  • L739

    ts
    737      this.logger.info(`Uploading style reference: ${name}`);
    738
    739      const id = `ref_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    740
    741      // Upload to Suno API (if supported) or store locally
    
  • L814

    ts
    812      this.logger.info(`Adding style reference from URL: ${name}`);
    813
    814      const id = `ref_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    815
    816      // Create reference without downloading
    
  • L845

    ts
    843      }
    844
    845      const id = `ref_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    846
    847      // Create reference pointing to previous generation
    
  • L1156

    ts
    1154      config: SeparationConfig = {}
    1155    ): Promise<SeparationResult> {
    1156      const id = `sep_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    1157      const startTime = Date.now();
    1158      const backend = config.backend ?? 'demucs';
    
  • L2315

    ts
    2313     */
    2314    async extendSong(request: SongExtensionRequest): Promise<SongExtensionResult> {
    2315      const id = `ext_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    2316
    2317      this.logger.info(`Extending song (mode: ${request.config.mode})`);
    
  • L2391

    ts
    2389     */
    2390    async continueSong(request: SongContinuationRequest): Promise<SongExtensionResult> {
    2391      const id = `cont_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    2392
    2393      this.logger.info('Continuing song');
    

libs/isis/audio-generation/src/generation/udio-provider.ts#

  • L589

    ts
    587      }
    588
    589      const id = `analysis_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    590      this.logger.info('Analyzing reference track...');
    591
    
  • L746

    ts
    744    ): Promise<StemSeparationResult> {
    745      const startTime = Date.now();
    746      const id = `separation_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    747      const sourceId = `source_${Date.now()}`;
    748
    
  • L975

    ts
    973      config: PreviewConfig = {}
    974    ): Promise<PreviewSession> {
    975      const sessionId = `preview_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    976
    977      this.logger.info(`Starting preview session: ${sessionId}`);
    

libs/isis/audio-generation/src/voice/elevenlabs-client.ts#

  • L1098

    ts
    1096
    1097        const result: SpeechSynthesisResult = {
    1098          id: `tts_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    1099          request,
    1100          audioData: synthesis.audioBuffer,
    
  • L1293

    ts
    1291     */
    1292    async createProject(request: CreateProjectRequest): Promise<Project> {
    1293      const projectId = `project_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    1294
    1295      this.logger.info(`Creating project: ${request.name}`);
    
  • L1400

    ts
    1398
    1399      const newChapter: Chapter = {
    1400        id: `chapter_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`,
    1401        title: chapter.title,
    1402        text: chapter.text,
    
  • L1795

    ts
    1793      request: CreatePronunciationDictionaryRequest
    1794    ): Promise<PronunciationDictionary> {
    1795      const dictionaryId = `dict_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    1796      const versionId = `v_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    1797
    
  • L1796

    ts
    1794    ): Promise<PronunciationDictionary> {
    1795      const dictionaryId = `dict_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    1796      const versionId = `v_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    1797
    1798      this.logger.info(`Creating pronunciation dictionary: ${request.name}`);
    
  • L1865

    ts
    1863
    1864      // Create new version
    1865      const versionId = `v_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    1866
    1867      // Merge rules (new rules override existing ones with same grapheme)
    
  • L1907

    ts
    1905
    1906      // Create new version
    1907      const versionId = `v_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    1908
    1909      // Filter out removed rules
    
  • L1963

    ts
    1961
    1962      // Create new version
    1963      const versionId = `v_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    1964
    1965      dictionary.rules[ruleIndex] = updatedRule;
    
  • L2328

    ts
    2326     */
    2327    async createTakeSession(request: CreateTakeSessionRequest): Promise<TakeSession> {
    2328      const sessionId = `session_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    2329
    2330      this.logger.info(`Creating take session for: "${request.text.slice(0, 50)}..."`);
    
  • L2411

    ts
    2409          });
    2410
    2411      const takeId = `take_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    2412
    2413      const take: Take = {
    
  • L2907

    ts
    2905     */
    2906    createVoiceDirection(options: Partial<Omit<VoiceDirection, 'id'>> = {}): VoiceDirection {
    2907      const id = `direction_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    2908
    2909      this.logger.info('Creating voice direction');
    
  • L2923

    ts
    2921      request: CreateDirectionTemplateRequest
    2922    ): Promise<VoiceDirectionTemplate> {
    2923      const templateId = `template_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    2924
    2925      this.logger.info(`Creating direction template: ${request.name}`);
    
  • L3013

    ts
    3011      request: CreateCharacterProfileRequest
    3012    ): Promise<CharacterVoiceProfile> {
    3013      const profileId = `profile_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    3014
    3015      this.logger.info(`Creating character profile: ${request.name}`);
    
  • L3147

    ts
    3145     */
    3146    async createSceneContext(options: Omit<SceneContext, 'id'>): Promise<SceneContext> {
    3147      const contextId = `scene_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
    3148
    3149      this.logger.info(`Creating scene context: ${options.name}`);
    
  • L3393

    ts
    3391      const now = new Date();
    3392      const correction: PronunciationCorrection = {
    3393        id: `correction-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    3394        text: request.text,
    3395        context: request.context,
    
  • L3412

    ts
    3410      for (const issue of matchingIssues) {
    3411        const suggestion: CorrectionSuggestion = {
    3412          id: `suggestion-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    3413          rule: issue.defaultCorrection,
    3414          confidence: Math.min(90, 50 + issue.frequency * 5),
    
  • L3518

    ts
    3516
    3517      const suggestion: CorrectionSuggestion = {
    3518        id: `suggestion-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    3519        rule,
    3520        confidence: Math.max(0, Math.min(100, confidence)),
    
  • L3863

    ts
    3861      for (const correction of corrections) {
    3862        // Generate new ID to avoid conflicts
    3863        const newId = `correction-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    3864        const imported_correction: PronunciationCorrection = {
    3865          ...correction,
    
  • L4047

    ts
    4045
    4046      const result: AudioQualityResult = {
    4047        id: `validation-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    4048        passed,
    4049        qualityLevel,
    
  • L4441

    ts
    4439
    4440      const result: VoiceConsistencyResult = {
    4441        id: `consistency-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    4442        overallScore,
    4443        overallLevel,
    

libs/isis/client/src/http.ts#

  • L369

    ts
    367      const timestamp = Date.now().toString(36);
    368      const counter = this.requestCounter.toString(36).padStart(4, '0');
    369      const random = Math.random().toString(36).substring(2, 6);
    370      return `isis-${timestamp}-${counter}-${random}`;
    371    }
    

libs/isis/llm-providers/src/client/llm-client.ts#

  • L1224

    ts
    1222        case 'equal': {
    1223          const half = capped / 2;
    1224          return half + Math.random() * half;
    1225        }
    1226        case 'decorrelated':
    
  • L1227

    ts
    1225        }
    1226        case 'decorrelated':
    1227          return Math.min(policy.maxBackoffMs, policy.initialBackoffMs + Math.random() * capped * 3);
    1228        case 'full':
    1229        default:
    
  • L1230

    ts
    1228        case 'full':
    1229        default:
    1230          return Math.random() * capped;
    1231      }
    1232    }
    
  • L1317

    ts
    1315    const c = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto;
    1316    if (c?.randomUUID) return c.randomUUID();
    1317    // Fallback: manual v4 — uses Math.random as the entropy source ONLY when
    1318    // no crypto.randomUUID is available. Acceptable: the requestId is
    1319    // observability metadata, not a security primitive. Production runtimes
    
  • L1322

    ts
    1320    // (Node 20+, modern browsers) always take the crypto path.
    1321    const bytes = new Uint8Array(16);
    1322    for (let i = 0; i < 16; i++) bytes[i] = Math.floor(Math.random() * 256);
    1323    bytes[6] = (bytes[6] & 0x0f) | 0x40;
    1324    bytes[8] = (bytes[8] & 0x3f) | 0x80;
    

libs/isis/llm-providers/src/rate-limiter/rate-limiter.ts#

  • L295

    ts
    293    const baseDelay = baseMs * multiplier;
    294    // Add jitter: random value between 50% and 100% of the base delay
    295    const jitter = 0.5 + Math.random() * 0.5;
    296    const delay = baseDelay * jitter;
    297    return Math.min(delay, maxMs);
    

libs/isis/operation-orchestrator/src/retry-orchestrator/retry-orchestrator.ts#

  • L285

    ts
    283    const jitterRange = delay * clampedFactor;
    284    // Random value in [-jitterRange, +jitterRange]
    285    const jitter = (Math.random() * 2 - 1) * jitterRange;
    286    return Math.max(0, Math.round(delay + jitter));
    287  }
    

libs/isis/prompt-engineering/src/few-shot-manager/few-shot-manager.ts#

  • L314

    ts
    312    const shuffled = [...examples];
    313    for (let i = shuffled.length - 1; i > 0; i--) {
    314      const j = Math.floor(Math.random() * (i + 1));
    315      [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
    316    }
    

libs/isis/seedance-provider/src/fal-seedance-client.ts#

  • L471

    ts
    469
    470    const delay = config.backoffBaseMs * 2 ** attempt;
    471    const jitter = Math.round(delay * 0.2 * Math.random());
    472    return Math.min(delay + jitter, config.backoffMaxMs);
    473  }
    

libs/isis/seedance-provider/src/piapi-seedance-client.ts#

  • L405

    ts
    403
    404    const delay = config.backoffBaseMs * 2 ** attempt;
    405    const jitter = Math.round(delay * 0.2 * Math.random());
    406    return Math.min(delay + jitter, config.backoffMaxMs);
    407  }
    

libs/isis/seedance-provider/src/volcengine-ark-client.ts#

  • L469

    ts
    467
    468    const exponentialDelay = config.backoffBaseMs * 2 ** attempt;
    469    const jitter = Math.round(exponentialDelay * 0.2 * Math.random());
    470
    471    return Math.min(exponentialDelay + jitter, config.backoffMaxMs);
    

libs/isis/workflows/src/consistency/identity-profiles.ts#

  • L157

    ts
    155
    156  function defaultIdGenerator(prefix: string): string {
    157    return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
    158  }
    159
    

libs/isis/workflows/src/consistency/scene-profiles.ts#

  • L120

    ts
    118
    119  function defaultIdGenerator(prefix: string): string {
    120    return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
    121  }
    122
    

libs/isis/workflows/src/consistency/shot-profiles.ts#

  • L126

    ts
    124
    125  function defaultIdGenerator(prefix: string): string {
    126    return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
    127  }
    128
    

libs/isis/workflows/src/consistency/wardrobe-profiles.ts#

  • L135

    ts
    133
    134  function defaultIdGenerator(prefix: string): string {
    135    return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
    136  }
    137
    

libs/isis/workflows/src/seed/seed-manager.ts#

  • L93

    ts
    91   */
    92  export function generateRandomSeed(): SeedValue {
    93    return Math.floor(Math.random() * (MAX_SEED + 1));
    94  }
    95
    

libs/isis/workflows/src/templates/keyframe-interpolation-flows.ts#

  • L395

    ts
    393      Array.isArray(profiles) && profiles.length > 0 ? profiles : [...DEFAULT_VARIANT_PROFILES];
    394    return source.map((profile) => ({
    395      id: asNonEmptyString(profile.id) ?? `variant-${Math.random().toString(36).slice(2, 8)}`,
    396      mode: profile.mode,
    397      cameraWeight: clamp01(profile.cameraWeight),
    

libs/kuanyin/ai-ml-models/src/behavioral-pattern.ts#

  • L179

    ts
    177
    178  function bpGenerateId(prefix: string): string {
    179    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    180  }
    181
    
  • L2677

    ts
    2675    const scale = sensitivity / Math.max(epsilon, 0.001);
    2676    // Approximate Laplace noise via Box-Muller-like transform
    2677    const u1 = Math.random();
    2678    const u2 = Math.random();
    2679    const noise = scale * Math.log(u1 / u2);
    
  • L2678

    ts
    2676    // Approximate Laplace noise via Box-Muller-like transform
    2677    const u1 = Math.random();
    2678    const u2 = Math.random();
    2679    const noise = scale * Math.log(u1 / u2);
    2680    return value + bpClamp(noise, -scale * 3, scale * 3);
    

libs/kuanyin/ai-ml-models/src/cognitive-reframing.ts#

  • L177

    ts
    175
    176  function crGenerateId(prefix: string): string {
    177    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    178  }
    179
    
  • L5133

    ts
    5131      for (let batch = 0; batch < batchesPerEpoch; batch++) {
    5132        // Preference loss: cross-entropy on pairwise comparisons
    5133        const batchAccuracy = crSigmoid(rewardModelAccuracy * 3 - 1.2 + Math.random() * 0.1);
    5134        const batchLoss = -Math.log(Math.max(0.001, batchAccuracy));
    5135        epochLoss += batchLoss;
    
  • L5145

    ts
    5143
    5144      // KL divergence computation: measures policy drift from reference
    5145      currentKL = crClamp(0.01 + epoch * 0.005 * (1 - clampedKLWeight) + Math.random() * 0.005, 0, 1);
    5146
    5147      // Policy improvement: reward gain minus KL penalty
    
  • L5159

    ts
    5157
    5158    // Validation scoring on held-out data
    5159    const valAccuracyDrop = 0.02 + Math.random() * 0.03; // generalization gap
    5160    const validationScore = crFormatOutput(crClamp(rewardModelAccuracy - valAccuracyDrop, 0, 1), 4);
    5161
    

libs/kuanyin/ai-ml-models/src/community-health-model.ts#

  • L182

    ts
    180
    181  function chmGenerateId(prefix: string): string {
    182    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    183  }
    184
    

libs/kuanyin/ai-ml-models/src/emotional-state-detection.ts#

  • L181

    ts
    179
    180  function esdGenerateId(prefix: string): string {
    181    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    182  }
    183
    
  • L2766

    ts
    2764      relatedEmotions: matchedEmotions.slice(0, 4) as EmoStateDiscreteEmotion[],
    2765      culturalVariations: Object.fromEntries(
    2766        culturalContexts.map((c) => [c, 0.8 + Math.random() * 0.2])
    2767      ),
    2768      arousalLevel: esdDetermineArousalLevel(compositeArousal),
    

libs/kuanyin/ai-ml-models/src/harm-potential-scoring.ts#

  • L182

    ts
    180
    181  function hpsGenerateId(prefix: string): string {
    182    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    183  }
    184
    
  • L2693

    ts
    2691          'latin_america',
    2692        ];
    2693        const region = culturalRegions[Math.floor(Math.random() * culturalRegions.length)];
    2694        const record: HarmScoreExampleRecord = {
    2695          id: hpsGenerateId('hex'),
    
  • L2867

    ts
    2865      secondaryCategories,
    2866      confidenceScore: confidence,
    2867      processingTimeMs: hpsFormatOutput(5 + Math.random() * 20, 1),
    2868      modelVersion,
    2869      classifiedAt: new Date(),
    
  • L4562

    ts
    4560      // Each group has slightly different base rates
    4561      const baseVariation = 0.05 * (g - groupCount / 2);
    4562      const positiveRate = hpsClamp(0.15 + baseVariation + Math.random() * 0.02, 0.05, 0.35);
    4563      const tpr = hpsClamp(0.8 + baseVariation * 0.5 + Math.random() * 0.03, 0.6, 0.98);
    4564      const fpr = hpsClamp(0.1 - baseVariation * 0.3 + Math.random() * 0.02, 0.02, 0.25);
    
  • L4563

    ts
    4561      const baseVariation = 0.05 * (g - groupCount / 2);
    4562      const positiveRate = hpsClamp(0.15 + baseVariation + Math.random() * 0.02, 0.05, 0.35);
    4563      const tpr = hpsClamp(0.8 + baseVariation * 0.5 + Math.random() * 0.03, 0.6, 0.98);
    4564      const fpr = hpsClamp(0.1 - baseVariation * 0.3 + Math.random() * 0.02, 0.02, 0.25);
    4565
    
  • L4564

    ts
    4562      const positiveRate = hpsClamp(0.15 + baseVariation + Math.random() * 0.02, 0.05, 0.35);
    4563      const tpr = hpsClamp(0.8 + baseVariation * 0.5 + Math.random() * 0.03, 0.6, 0.98);
    4564      const fpr = hpsClamp(0.1 - baseVariation * 0.3 + Math.random() * 0.02, 0.02, 0.25);
    4565
    4566      groupPositiveRates.push(hpsFormatOutput(positiveRate, 4));
    
  • L4770

    ts
    4768          const sample: number[] = [];
    4769          for (let i = 0; i < predictionScores.length; i++) {
    4770            const idx = Math.floor(Math.random() * predictionScores.length);
    4771            sample.push(predictionScores[idx]);
    4772          }
    
  • L4807

    ts
    4805        const mcPredictions: number[] = [];
    4806        for (let m = 0; m < 50; m++) {
    4807          const dropoutNoise = (Math.random() - 0.5) * 0.1;
    4808          const prediction = meanPrediction + dropoutNoise;
    4809          mcPredictions.push(hpsClamp(prediction, 0, 1));
    
  • L4821

    ts
    4819        const ensemblePreds: number[] = [];
    4820        for (let e = 0; e < clampedEnsembleSize; e++) {
    4821          const memberNoise = (Math.random() - 0.5) * 0.08;
    4822          ensemblePreds.push(hpsClamp(meanPrediction + memberNoise, 0, 1));
    4823        }
    
  • L4964

    ts
    4962    for (let i = 0; i < reviewedItems; i++) {
    4963      // Expert agreement probability based on expertise and item difficulty
    4964      const itemDifficulty = 0.3 + Math.random() * 0.4;
    4965      const agreementProb = expertReliability * (1.0 - itemDifficulty * 0.3);
    4966      const agreed = Math.random() < agreementProb;
    
  • L4966

    ts
    4964      const itemDifficulty = 0.3 + Math.random() * 0.4;
    4965      const agreementProb = expertReliability * (1.0 - itemDifficulty * 0.3);
    4966      const agreed = Math.random() < agreementProb;
    4967      expertAgreements.push(agreed ? 1 : 0);
    4968
    

libs/kuanyin/ai-ml-models/src/intent-classification.ts#

  • L180

    ts
    178
    179  function icGenerateId(prefix: string): string {
    180    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    181  }
    182
    
  • L3633

    ts
    3631
    3632    // Simulate pre-calibration ECE (before any calibration)
    3633    const preCalibrationECE = icFormatOutput(baselinePreECE * (1 + (Math.random() * 0.1 - 0.05)), 4);
    3634
    3635    // Method-specific calibration parameters
    
  • L4621

    ts
    4619    // KS-test approximation for data drift
    4620    const baseDistValues = Object.values(baselineDistribution);
    4621    const perturbedValues = baseDistValues.map((v) => v + (Math.random() - 0.5) * 0.05);
    4622
    4623    let driftMagnitude = 0;
    

libs/kuanyin/community-harmony/src/conflict-detection.ts#

  • L39

    ts
    37
    38  function generateId(prefix: string): string {
    39    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    40  }
    41
    

libs/kuanyin/community-harmony/src/culture-cultivation.ts#

  • L25

    ts
    23
    24  function generateId(prefix: string): string {
    25    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    26  }
    27
    

libs/kuanyin/community-harmony/src/post-incident-healing.ts#

  • L26

    ts
    24
    25  function generateId(prefix: string): string {
    26    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    27  }
    28
    

libs/kuanyin/community-harmony/src/raid-defense.ts#

  • L47

    ts
    45
    46  function generateId(prefix: string): string {
    47    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    48  }
    49
    
  • L2004

    ts
    2002      case 'empathetic':
    2003        return REASSURANCE_TEMPLATES_EMPATHETIC[
    2004          Math.floor(Math.random() * REASSURANCE_TEMPLATES_EMPATHETIC.length)
    2005        ];
    2006      case 'action_oriented':
    
  • L2008

    ts
    2006      case 'action_oriented':
    2007        return REASSURANCE_TEMPLATES_ACTION[
    2008          Math.floor(Math.random() * REASSURANCE_TEMPLATES_ACTION.length)
    2009        ];
    2010      case 'calm_authoritative':
    
  • L2013

    ts
    2011      case 'community_focused':
    2012        return REASSURANCE_TEMPLATES_CALM[
    2013          Math.floor(Math.random() * REASSURANCE_TEMPLATES_CALM.length)
    2014        ];
    2015      case 'informative':
    

libs/kuanyin/community-harmony/src/temperature-monitor.ts#

  • L82

    ts
    80
    81  function generateId(prefix: string): string {
    82    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    83  }
    84
    

libs/kuanyin/cross-domain/src/aphrodite-integration.ts#

  • L40

    ts
    38
    39  function aphGenerateId(prefix: string): string {
    40    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    41  }
    42
    
  • L3930

    ts
    3928
    3929    const performerResponseConfigured = params.configuredSafeWords.length > 0;
    3930    const responseTimeMs = safeWordDetected ? 75 + Math.floor(Math.random() * 50) : 0;
    3931
    3932    return {
    
  • L4023

    ts
    4021    const responseTimeMs =
    4022      severity === 'critical'
    4023        ? 30 + Math.floor(Math.random() * 20)
    4024        : 100 + Math.floor(Math.random() * 50);
    4025
    
  • L4024

    ts
    4022      severity === 'critical'
    4023        ? 30 + Math.floor(Math.random() * 20)
    4024        : 100 + Math.floor(Math.random() * 50);
    4025
    4026    return {
    

libs/kuanyin/cross-domain/src/hathor-integration.ts#

  • L40

    ts
    38
    39  function hatGenerateId(prefix: string): string {
    40    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    41  }
    42
    

libs/kuanyin/cross-domain/src/lilith-integration.ts#

  • L40

    ts
    38
    39  function lilGenerateId(prefix: string): string {
    40    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    41  }
    42
    
  • L3375

    ts
    3373          target,
    3374          phrase,
    3375          resonanceScore: lilRound4(resonanceBase + Math.random() * 0.1),
    3376        });
    3377      }
    

libs/kuanyin/cross-domain/src/platform-wide-integration.ts#

  • L169

    ts
    167
    168  function platGenerateId(prefix: string): string {
    169    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    170  }
    171
    

libs/kuanyin/cross-domain/src/yemaya-integration.ts#

  • L41

    ts
    39
    40  function yemGenerateId(prefix: string): string {
    41    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    42  }
    43
    

libs/kuanyin/dharma-analytics/src/community-health-metrics.ts#

  • L26

    ts
    24
    25  function chGenerateId(prefix: string): string {
    26    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    27  }
    28
    
  • L4202

    ts
    4200    const affectedDimensionScores: Record<string, number> = {};
    4201    for (const dim of affectedDimensions) {
    4202      const dimImpact = delta * (0.8 + Math.random() * 0.4);
    4203      affectedDimensionScores[dim] = Math.round(dimImpact * 10000) / 10000;
    4204    }
    

libs/kuanyin/dharma-analytics/src/individual-dharma-path.ts#

  • L26

    ts
    24
    25  function dpGenerateId(prefix: string): string {
    26    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    27  }
    28
    

libs/kuanyin/dharma-analytics/src/moderation-transparency.ts#

  • L26

    ts
    24
    25  function mtGenerateId(prefix: string): string {
    26    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    27  }
    28
    

libs/kuanyin/dharma-analytics/src/predictive-wellness.ts#

  • L27

    ts
    25
    26  function pwGenerateId(prefix: string): string {
    27    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    28  }
    29
    

libs/kuanyin/dharma-analytics/src/wisdom-reports.ts#

  • L25

    ts
    23
    24  function wrGenerateId(prefix: string): string {
    25    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    26  }
    27
    

libs/kuanyin/foundation/src/errors.ts#

  • L688

    ts
    686    const ts = Date.now().toString(36);
    687    const counter = errorIdCounter.toString(36).padStart(4, '0');
    688    const rand = Math.random().toString(36).substring(2, 6);
    689    return `ky-err-${ts}-${counter}-${rand}`;
    690  }
    
  • L1739

    ts
    1737      }
    1738      case 'jitter':
    1739        delay = options.baseDelayMs * Math.pow(2, attempt - 1) * (0.5 + Math.random() * 0.5);
    1740        break;
    1741      case 'none':
    

libs/kuanyin/merit-karma/src/achievement-system.ts#

  • L25

    ts
    23
    24  function achvGenerateId(prefix: string): string {
    25    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    26  }
    27
    

libs/kuanyin/merit-karma/src/karma-visibility.ts#

  • L24

    ts
    22
    23  function kvisGenerateId(prefix: string): string {
    24    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    25  }
    26
    

libs/kuanyin/merit-karma/src/merit-accumulation.ts#

  • L25

    ts
    23
    24  function generateId(prefix: string): string {
    25    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    26  }
    27
    

libs/kuanyin/merit-karma/src/merit-calculation.ts#

  • L24

    ts
    22
    23  function calcGenerateId(prefix: string): string {
    24    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    25  }
    26
    

libs/kuanyin/merit-karma/src/privilege-tiers.ts#

  • L24

    ts
    22
    23  function tierGenerateId(prefix: string): string {
    24    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    25  }
    26
    

libs/kuanyin/mindful-friction/src/alternative-expression.ts#

  • L25

    ts
    23
    24  function aeId(): string {
    25    return `ae-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    26  }
    27
    

libs/kuanyin/mindful-friction/src/cognitive-reframing.ts#

  • L63

    ts
    61
    62  function generateId(): string {
    63    return `cr-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    64  }
    65
    

libs/kuanyin/mindful-friction/src/compassion-nudges.ts#

  • L61

    ts
    59
    60  function cnId(): string {
    61    return `cn-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    62  }
    63
    

libs/kuanyin/mindful-friction/src/pause-breathe.ts#

  • L73

    ts
    71
    72  function generateId(): string {
    73    return `pb-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    74  }
    75
    

libs/kuanyin/mindful-friction/src/perspective-shift.ts#

  • L54

    ts
    52
    53  function psId(): string {
    54    return `ps-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    55  }
    56
    

libs/kuanyin/mindful-friction/src/samma-vaca.ts#

  • L61

    ts
    59
    60  function generateId(): string {
    61    return `sv-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    62  }
    63
    

libs/kuanyin/performer-protection/src/boundary-enforcement.ts#

  • L40

    ts
    38
    39  function generateId(prefix: string): string {
    40    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    41  }
    42
    

libs/kuanyin/performer-protection/src/ncii-deepfake-protection.ts#

  • L26

    ts
    24
    25  function generateId(prefix: string): string {
    26    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    27  }
    28
    

libs/kuanyin/performer-protection/src/parasocial-detection.ts#

  • L39

    ts
    37
    38  function generateId(prefix: string): string {
    39    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    40  }
    41
    

libs/kuanyin/performer-protection/src/performer-dashboard.ts#

  • L26

    ts
    24
    25  function generateId(prefix: string): string {
    26    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    27  }
    28
    

libs/kuanyin/performer-protection/src/performer-wellness.ts#

  • L25

    ts
    23
    24  function generateId(prefix: string): string {
    25    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    26  }
    27
    

libs/kuanyin/performer-protection/src/real-time-shield.ts#

  • L39

    ts
    37
    38  function generateId(prefix: string): string {
    39    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    40  }
    41
    

libs/kuanyin/precognition/src/intent-analysis.ts#

  • L78

    ts
    76    let result = '';
    77    for (let i = 0; i < 8; i++) {
    78      result += chars.charAt(Math.floor(Math.random() * chars.length));
    79    }
    80    return `${prefix}-${result}`;
    

libs/kuanyin/rehabilitation/src/accountability-tracking.ts#

  • L25

    ts
    23
    24  function generateId(prefix: string): string {
    25    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    26  }
    27
    
  • L4215

    ts
    4213      ? 0
    4214      : rankedMentors.length > 0
    4215        ? Math.ceil(Math.random() * 3) + 1
    4216        : 0;
    4217
    

libs/kuanyin/rehabilitation/src/empathy-training.ts#

  • L24

    ts
    22
    23  function generateId(prefix: string): string {
    24    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    25  }
    26
    

libs/kuanyin/rehabilitation/src/journey-progress.ts#

  • L25

    ts
    23
    24  function generateId(prefix: string): string {
    25    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    26  }
    27
    
  • L3550

    ts
    3548    // Facilitator matching
    3549    const facilitatorId =
    3550      options.facilitatorPreference ?? `fac-${Math.floor(200 + Math.random() * 10)}`;
    3551    const matchScore = options.facilitatorPreference
    3552      ? 0.9
    
  • L3553

    ts
    3551    const matchScore = options.facilitatorPreference
    3552      ? 0.9
    3553      : clamp(0.6 + Math.random() * 0.3, 0.6, 0.95);
    3554
    3555    const facilitatorMatch: FacilitatorMatchInfo = {
    
  • L3904

    ts
    3902      const hasEvidence = idx < evidence.length;
    3903      const score = hasEvidence
    3904        ? clamp(0.6 + Math.random() * 0.35, 0.5, 1.0)
    3905        : clamp(0.3 + Math.random() * 0.3, 0.2, 0.7);
    3906      return {
    
  • L3905

    ts
    3903      const score = hasEvidence
    3904        ? clamp(0.6 + Math.random() * 0.35, 0.5, 1.0)
    3905        : clamp(0.3 + Math.random() * 0.3, 0.2, 0.7);
    3906      return {
    3907        criterionName: criterion,
    
  • L7403

    ts
    7401      reviewCompleted: true,
    7402      testingPassed: true,
    7403      accessibilityChecked: scope === 'accessibility_enhancement' || Math.random() > 0.3,
    7404      culturalSensitivityReviewed: scope === 'cultural_adaptation' || Math.random() > 0.4,
    7405      clinicalAccuracyVerified: true,
    
  • L7404

    ts
    7402      testingPassed: true,
    7403      accessibilityChecked: scope === 'accessibility_enhancement' || Math.random() > 0.3,
    7404      culturalSensitivityReviewed: scope === 'cultural_adaptation' || Math.random() > 0.4,
    7405      clinicalAccuracyVerified: true,
    7406      feedbackIncorporated: true,
    

libs/kuanyin/rehabilitation/src/reintegration-pathways.ts#

  • L26

    ts
    24
    25  function generateId(prefix: string): string {
    26    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    27  }
    28
    
  • L5252

    ts
    5250        alumniId: profile.userId,
    5251        commonGround: `Shared experience in ${profile.metricDomain.replace(/_/g, ' ')} tracking`,
    5252        connectionScore: Math.round(clamp(0.5 + Math.random() * 0.4, 0, 1) * 1000) / 1000,
    5253      }));
    5254
    

libs/kuanyin/rehabilitation/src/restorative-circles.ts#

  • L25

    ts
    23
    24  function generateId(prefix: string): string {
    25    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    26  }
    27
    
  • L6906

    ts
    6904      metric: ms.metric,
    6905      currentScore: ms.score,
    6906      priorScore: ms.score * (0.9 + Math.random() * 0.15),
    6907      changePercentage: Math.round((Math.random() * 20 - 5) * 100) / 100,
    6908      trendDirection: (ms.score > 0.7 ? 'improving' : ms.score > 0.5 ? 'stable' : 'declining') as
    
  • L6907

    ts
    6905      currentScore: ms.score,
    6906      priorScore: ms.score * (0.9 + Math.random() * 0.15),
    6907      changePercentage: Math.round((Math.random() * 20 - 5) * 100) / 100,
    6908      trendDirection: (ms.score > 0.7 ? 'improving' : ms.score > 0.5 ? 'stable' : 'declining') as
    6909        | 'improving'
    

libs/kuanyin/rehabilitation/src/shadow-work-journeys.ts#

  • L22

    ts
    20
    21  function generateId(prefix: string): string {
    22    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    23  }
    24
    

libs/kuanyin/sdk-api/src/event-system.ts#

  • L30

    ts
    28
    29  function evtGenerateId(prefix: string): string {
    30    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    31  }
    32
    
  • L135

    ts
    133  function evtExponentialBackoff(attempt: number, baseMs: number, maxMs: number): number {
    134    const delay = baseMs * Math.pow(2, attempt);
    135    const jitter = delay * 0.1 * Math.random();
    136    return Math.min(delay + jitter, maxMs);
    137  }
    

libs/kuanyin/sdk-api/src/graphql-api.ts#

  • L30

    ts
    28
    29  function gqlGenerateId(prefix: string): string {
    30    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    31  }
    32
    
  • L135

    ts
    133  function gqlExponentialBackoff(attempt: number, baseMs: number, maxMs: number): number {
    134    const delay = baseMs * Math.pow(2, attempt);
    135    const jitter = delay * 0.1 * Math.random();
    136    return Math.min(delay + jitter, maxMs);
    137  }
    

libs/kuanyin/sdk-api/src/rest-api-endpoints.ts#

  • L29

    ts
    27
    28  function restGenerateId(prefix: string): string {
    29    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    30  }
    31
    
  • L134

    ts
    132  function restExponentialBackoff(attempt: number, baseMs: number, maxMs: number): number {
    133    const delay = baseMs * Math.pow(2, attempt);
    134    const jitter = delay * 0.1 * Math.random();
    135    return Math.min(delay + jitter, maxMs);
    136  }
    
  • L4556

    ts
    4554
    4555    // Uptime simulation
    4556    const uptimeSeconds = Math.floor(Math.random() * 86400) + 3600; // 1 hour to 24 hours
    4557
    4558    // Connection quality based on reconnect policy and heartbeat
    

libs/kuanyin/sdk-api/src/typescript-sdk.ts#

  • L28

    ts
    26
    27  function sdkGenerateId(prefix: string): string {
    28    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    29  }
    30
    
  • L133

    ts
    131  function sdkExponentialBackoff(attempt: number, baseMs: number, maxMs: number): number {
    132    const delay = baseMs * Math.pow(2, attempt);
    133    const jitter = delay * 0.1 * Math.random();
    134    return Math.min(delay + jitter, maxMs);
    135  }
    
  • L1860

    ts
    1858      const domainConfig = allConfigs.find((c) => c.id.includes(domain.split('_')[0]));
    1859      const baseLatency = domainConfig ? domainConfig.timeout * 0.01 : input.timeout * 0.01;
    1860      const jitter = Math.random() * 5;
    1861      const authOverhead =
    1862        input.authMethod === 'mutual_tls' ? 15 : input.authMethod === 'oauth2_pkce' ? 10 : 3;
    
  • L2452

    ts
    2450      const trendComponent = i * 0.02;
    2451      const seasonalComponent = Math.sin((i / dataPointCount) * Math.PI * 4) * 15;
    2452      const noiseComponent = (Math.random() - 0.5) * 10;
    2453      const baseValue = 50 + trendComponent + seasonalComponent + noiseComponent;
    2454      const value = sdkRound2(Math.max(0, baseValue));
    
  • L2623

    ts
    2621    const maxReconnect = retryConfig ? retryConfig.maxAttempts : 10;
    2622    const reconnectAttempts =
    2623      state === 'reconnecting' ? Math.min(Math.floor(Math.random() * maxReconnect), maxReconnect) : 0;
    2624
    2625    // Uptime calculation (simulated as fraction of 1.0)
    
  • L2784

    ts
    2782      case 'exponential_with_jitter': {
    2783        const expDelay = sdkExponentialBackoff(input.currentAttempt, baseDelay, maxDelay);
    2784        const jitter = expDelay * jitterFactor * (Math.random() * 2 - 1);
    2785        delayMs = Math.min(Math.max(expDelay + jitter, 0), maxDelay);
    2786        break;
    
  • L3500

    ts
    3498    // Mock server stats
    3499    const requestsServed = input.mockServerEnabled ? totalTests * 3 : 0;
    3500    const avgLatencyMs = input.mockServerEnabled ? sdkRound2(2 + Math.random() * 5) : 0;
    3501
    3502    return {
    

libs/kuanyin/ui-components/src/analytics-dashboard-components.ts#

  • L66

    ts
    64
    65  function generateId(prefix: string): string {
    66    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    67  }
    68
    

libs/kuanyin/ui-components/src/merit-karma-components.ts#

  • L65

    ts
    63
    64  function generateId(prefix: string): string {
    65    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    66  }
    67
    

libs/kuanyin/ui-components/src/mindful-friction-components.ts#

  • L64

    ts
    62
    63  function mfcId(): string {
    64    return `mfc-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    65  }
    66
    

libs/kuanyin/ui-components/src/performer-dashboard-components.ts#

  • L65

    ts
    63
    64  function generateId(prefix: string): string {
    65    return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
    66  }
    67
    
  • L4179

    ts
    4177    // Escalation rules assessment
    4178    const escalationRuleResults = config.escalationRules.map((rule) => {
    4179      const currentValue = Math.random() * rule.threshold * 1.5;
    4180      return {
    4181        trigger: rule.trigger,
    
  • L4681

    ts
    4679    // Shared blocklists analysis
    4680    const sharedLists = config.sharedBlocklists.map((sl) => {
    4681      const overlapEstimate = clamp(Math.random() * 30, 0, 100);
    4682      const recommended = sl.subscriberCount > 100 && sl.entryCount > 50;
    4683      return {
    
  • L5210

    ts
    5208      .map((m) => ({
    5209        name: m.name,
    5210        achievedAt: now - Math.round(Math.random() * 30 * 86400000),
    5211        description: m.description,
    5212      }));
    

libs/kuanyin/ui-components/src/rehabilitation-journey-components.ts#

  • L64

    ts
    62
    63  function rjcId(): string {
    64    return `rjc-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    65  }
    66
    
  • L3899

    ts
    3897          topic.toLowerCase().includes(ti.toLowerCase())
    3898        );
    3899        const relevanceScore = interestMatch ? 0.9 : 0.5 + Math.random() * 0.3;
    3900        return {
    3901          topic,
    
  • L3903

    ts
    3901          topic,
    3902          relevanceScore: clamp(relevanceScore, 0, 1),
    3903          participantCount: Math.floor(bestGroup!.currentMembers * (0.5 + Math.random() * 0.5)),
    3904        };
    3905      })
    

libs/lakshmi/accounts/src/sync/mfa.ts#

  • L246

    ts
    244    // Fallback for legacy runtimes that lack randomUUID but expose the
    245    // Web Crypto getRandomValues primitive. Use crypto-grade randomness
    246    // for a security-relevant session id rather than Math.random.
    247    if (typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function') {
    248      const bytes = new Uint8Array(16);
    

libs/lakshmi/core/src/calculations/monte-carlo.ts#

  • L66

    ts
    64    /** Percentile levels to report (e.g., [10, 25, 50, 75, 90]) */
    65    percentilesToReport: number[];
    66    /** Optional custom RNG for testing (default: Math.random) */
    67    rng?: () => number;
    68  }
    
  • L277

    ts
    275    const { iterations, years, percentilesToReport, correlationMatrix } = config;
    276    const clampedIterations = Math.max(1000, Math.min(100_000, iterations));
    277    const rng = config.rng ?? Math.random;
    278
    279    // Pre-compute Cholesky factor for correlated sampling
    

libs/lakshmi/core/src/calculations/risk-metrics.ts#

  • L215

    ts
    213      let u1: number;
    214      do {
    215        u1 = Math.random();
    216      } while (u1 === 0);
    217      const u2 = Math.random();
    
  • L217

    ts
    215        u1 = Math.random();
    216      } while (u1 === 0);
    217      const u2 = Math.random();
    218      const z = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    219
    

libs/lakshmi/core/src/calculations/tvm.ts#

  • L148

    ts
    146      // Prevent extreme divergence
    147      if (!isFinite(rate) || rate < -0.9999) {
    148        rate = guess * (0.5 + Math.random()); // restart with perturbed guess
    149      }
    150    }
    

libs/lakshmi/investments/src/risk/var.ts#

  • L361

    ts
    359      // Box-Muller transform for standard normals
    360      for (let i = 0; i < nPaths; i += 2) {
    361        const u1 = Math.max(1e-10, Math.random());
    362        const u2 = Math.random();
    363        const z1 = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L362

    ts
    360      for (let i = 0; i < nPaths; i += 2) {
    361        const u1 = Math.max(1e-10, Math.random());
    362        const u2 = Math.random();
    363        const z1 = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    364        const z2 = Math.sqrt(-2 * Math.log(u1)) * Math.sin(2 * Math.PI * u2);
    

libs/lakshmi/retirement/src/monte-carlo-projection.ts#

  • L94

    ts
    92    );
    93    const yearsToRetirement = Math.max(0, input.targetRetirementAge - input.currentAge);
    94    const rng = input.rng ?? Math.random;
    95    const paths: SimulationPathResult[] = [];
    96
    

libs/lakshmi/security/src/differential-privacy.ts#

  • L135

    ts
    133    const sensitivity =
    134      input.statistic === 'mean' ? config.sensitivity / input.values.length : config.sensitivity;
    135    const noisyValue = raw + calibratedNoise(config, sensitivity, input.rng ?? Math.random);
    136
    137    return {
    
  • L207

    ts
    205  }
    206
    207  export function laplaceNoise(scale: number, rng: () => number = Math.random): number {
    208    validatePositive(scale, 'scale');
    209    const u = clampOpenUnit(rng()) - 0.5;
    
  • L214

    ts
    212  }
    213
    214  export function gaussianNoise(sigma: number, rng: () => number = Math.random): number {
    215    validatePositive(sigma, 'sigma');
    216    const u1 = clampOpenUnit(rng());
    

libs/lilith/common/csprng-ids.ts#

  • L4

    ts
    2   * Cryptographically-secure identifier helpers shared across every Lilith
    3   * service. All IDs produced by these helpers are derived from Node's CSPRNG
    4   * (`crypto.randomBytes` / `crypto.randomUUID`) rather than `Math.random`, so
    5   * they are unguessable and safe to use as primary keys, handoff tokens,
    6   * audit-log entry ids, etc.
    
  • L11

    ts
    9   * `prefix-<timestampBase36>-<entropy>` format so downstream consumers
    10   * (logs, analytics joins, storage keys) do not need to change when callsites
    11   * migrate off `Math.random`.
    12   */
    13  import { randomBytes, randomUUID } from 'crypto';
    
  • L20

    ts
    18   * Draws `length` base36 characters from the CSPRNG. Used to produce the
    19   * "entropy suffix" portion of short ids and to emulate the exact output
    20   * shape of prior `Math.random().toString(36).substr(2, N)` callsites.
    21   */
    22  export function randomBase36(length: number): string {
    
  • L44

    ts
    42; /**
    43   * `prefix_<timestampBase36>_<entropyLength base36>` — drop-in replacement
    44   * for `` `${prefix}_${Date.now()}_${Math.random().toString(36).substr(2, N)}` ``.
    45   * Defaults to 9 chars of entropy (matches the most common legacy shape).
    46   */
    
  • L53

    ts
    51  /**
    52   * Same as {@link shortId} but with `-` separators — drop-in replacement
    53   * for `` `${prefix}-${Date.now()}-${Math.random().toString(36).substr(2, N)}` ``.
    54   */
    55  export function shortIdDashed(prefix: string, entropyLength = 9): string {
    
  • L94

    ts
    92; /**
    93   * Picks one element from a non-empty array using the CSPRNG. Replaces the
    94   * anti-pattern `arr[Math.floor(Math.random() * arr.length)]` which leaks
    95   * process-wide PRNG state and is unsafe for anything user-visible.
    96   */
    

libs/lilith/common/index.ts#

  • L66

    ts
    64  } from './server-template.js';
    65
    66  // CSPRNG identifier helpers — use these everywhere in place of Math.random.
    67  export {
    68    randomBase36,
    

libs/lilith/common/language-detection.ts#

  • L917

    ts
    915
    916    private generateRequestId(): string {
    917      return `lang-det-${Date.now()}-${Math.random().toString(36).slice(2)}`;
    918    }
    919
    

libs/lilith/sdk/src/auth.ts#

  • L926

    ts
    924
    925    return {
    926      sessionId: result.sessionId ?? `session-${Math.random().toString(36).slice(2)}`,
    927      userId: result.user?.id ?? '',
    928      deviceId: result.deviceId ?? `${platform}-client`,
    

libs/lilith/service-lib/ai-error-recovery.ts#

  • L554

    ts
    552      // Add jitter (0-25% of delay)
    553      if (jitter) {
    554        const jitterAmount = delay * 0.25 * Math.random();
    555        delay += jitterAmount;
    556      }
    

libs/lilith/service-lib/comfyui/RunComfyClient.ts#

  • L262

    ts
    260    const baseDelay = config.baseDelayMs * Math.pow(config.backoffMultiplier, attempt);
    261    const cappedDelay = Math.min(baseDelay, config.maxDelayMs);
    262    const jitter = cappedDelay * config.jitterFactor * Math.random();
    263    return Math.floor(cappedDelay + jitter);
    264  }
    

libs/lilith/service-lib/comfyui/workflow-builder.ts#

  • L160

    ts
    158        case SeedStrategy.RANDOM:
    159        default:
    160          return Math.floor(Math.random() * 2147483647);
    161      }
    162    }
    
  • L470

    ts
    468     */
    469    setRandomSeed(nodeId: string): this {
    470      return this.setSeed(nodeId, Math.floor(Math.random() * 2147483647));
    471    }
    472
    
  • L767

    ts
    765    builder.setSamplerParams(COMMON_NODE_IDS.KSAMPLER, {
    766      denoise: options?.denoise ?? 0.75,
    767      seed: options?.seed ?? Math.floor(Math.random() * 2147483647),
    768      steps: options?.steps,
    769      cfg: options?.cfg,
    

libs/lilith/service-lib/lilith-logger.ts#

  • L532

    ts
    530    private shouldSample(category: string | undefined): boolean {
    531      const rate = SchemaHelpers.getSamplingRate(category);
    532      return Math.random() < rate;
    533    }
    534
    

libs/lilith/service-lib/rate-limiting-middleware.ts#

  • L194

    ts
    192
    193      // Add current request timestamp
    194      pipeline.zadd(key, now, `${now}-${Math.random()}`);
    195
    196      // Set expiration
    

libs/lilith/service-lib/test-data-factories.ts#

  • L72

    ts
    70        role: 'user',
    71        content: `Test message ${Date.now()}`,
    72        token_count: Math.floor(Math.random() * 100) + 10,
    73        ...overrides
    74      }),
    

libs/lilith/service-lib/test-database-manager.ts#

  • L463

    ts
    461          [user.email, user.email_hash, JSON.stringify(user.preferences), user.status]
    462        );
    463        user.id = (result.rows[0]?.['id'] as number) || Math.floor(Math.random() * 1000) + 1;
    464      }
    465
    
  • L487

    ts
    485        conv.id =
    486          (result.rows[0]?.['id'] as string | number) ||
    487          `conv_${Math.floor(Math.random() * 1000) + 1}`;
    488      }
    489
    

libs/lilith/service-lib/test-helpers.ts#

  • L541

    ts
    539    generateTestUser(overrides: Partial<TestUser> = {}): TestUser {
    540      return {
    541        email: `test.${Date.now()}.${Math.random().toString(36).substring(7)}@example.com`,
    542        email_hash: crypto.randomBytes(16).toString('hex'),
    543        preferences: { theme: 'dark', language: 'en' },
    

libs/lilith/service-lib/tracing.ts#

  • L441

    ts
    439      }
    440
    441      return `correlation-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    442    }
    443
    

libs/maat/agents/src/federated-learning-framework.ts#

  • L111

    ts
    109    const W = new Float32Array(outputSize * inputSize);
    110    for (let i = 0; i < W.length; i++) {
    111      W[i] = (Math.random() * 2 - 1) * scale;
    112    }
    113    const b = new Float32Array(outputSize).fill(0);
    
  • L322

    ts
    320    let u1 = 0,
    321      u2 = 0;
    322    while (u1 === 0) u1 = Math.random();
    323    while (u2 === 0) u2 = Math.random();
    324    return sigma * Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L323

    ts
    321      u2 = 0;
    322    while (u1 === 0) u1 = Math.random();
    323    while (u2 === 0) u2 = Math.random();
    324    return sigma * Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    325  }
    
  • L394

    ts
    392    const len = (updates[0] as Float32Array).length;
    393    const masks = Array.from({ length: numParticipants }, () =>
    394      new Float32Array(len).map(() => (Math.random() - 0.5) * 1e-8)
    395    );
    396
    
  • L624

    ts
    622      for (let epoch = 0; epoch < this.config.localEpochs; epoch++) {
    623        // Shuffle data
    624        const shuffled = [...data].sort(() => Math.random() - 0.5);
    625
    626        for (let bStart = 0; bStart < shuffled.length; bStart += this.config.batchSize) {
    
  • L884

    ts
    882        Math.ceil(allIds.length * this.config.participationFraction)
    883      );
    884      const selected = [...allIds].sort(() => Math.random() - 0.5).slice(0, numSelected);
    885
    886      // Each participant trains locally (data never leaves the participant)
    
  • L1065

    ts
    1063    const bias = buIndex * 0.2; // each BU has a slightly different distribution
    1064    return Array.from({ length: numSamples }, () => {
    1065      const features = Array.from({ length: inputSize }, () => Math.random() + bias);
    1066      // Linearly separable classes based on sum of features
    1067      const featureSum = features.reduce((a, b) => a + b, 0);
    

libs/maat/agents/src/rl-capital-allocation-env.ts#

  • L389

    ts
    387  function normalRandom(mean = 0, std = 1): number {
    388    // Box-Muller transform
    389    const u1 = Math.max(1e-10, Math.random());
    390    const u2 = Math.random();
    391    return mean + std * Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L390

    ts
    388    // Box-Muller transform
    389    const u1 = Math.max(1e-10, Math.random());
    390    const u2 = Math.random();
    391    return mean + std * Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    392  }
    
  • L601

    ts
    599      } else {
    600        const all = Array.from(this.scenarios.values());
    601        scenario = all[Math.floor(Math.random() * all.length)] as MarketScenario;
    602      }
    603
    
  • L915

    ts
    913      const indices = new Set<number>();
    914      while (indices.size < n) {
    915        indices.add(Math.floor(Math.random() * this.buffer.length));
    916      }
    917      return Array.from(indices).map((i) => this.buffer[i] as RlExperience);
    
  • L1008

    ts
    1006      );
    1007
    1008      if (Math.random() < this.epsilon) {
    1009        return Math.floor(Math.random() * TEMPLATE_NAMES.length);
    1010      }
    
  • L1009

    ts
    1007
    1008      if (Math.random() < this.epsilon) {
    1009        return Math.floor(Math.random() * TEMPLATE_NAMES.length);
    1010      }
    1011      const q = this.getQ(stateKey);
    
  • L1158

    ts
    1156      const logits = this.getLogits(stateKey);
    1157      const probs = this.softmax(logits, this.getTemperature());
    1158      let r = Math.random();
    1159      for (let i = 0; i < probs.length; i++) {
    1160        r -= probs[i] as number;
    
  • L1321

    ts
    1319      const logits = this.getLogits(stateKey);
    1320      const probs = this.softmax(logits, this.getTemperature());
    1321      let r = Math.random();
    1322      for (let i = 0; i < probs.length; i++) {
    1323        r -= probs[i] as number;
    

libs/maat/capital/src/black-litterman.ts#

  • L318

    ts
    316      if (input.marketCapUsd <= 0) throw new Error('Market cap must be positive.');
    317
    318      const assetId = makeId(`bla-${input.company}-${input.name}-${Date.now()}-${Math.random()}`);
    319      const asset: BlAsset = {
    320        assetId,
    
  • L347

    ts
    345
    346      const view: BlView = {
    347        viewId: makeId(`view-${input.assetId}-${Date.now()}-${Math.random()}`),
    348        viewType: input.viewType,
    349        description: input.description,
    
  • L385

    ts
    383
    384      const now = new Date().toISOString();
    385      const resultId = makeId(`blopt-${now}-${Math.random()}`);
    386      const n = assets.length;
    387      const lambda = this.config.riskAversionLambda;
    

libs/maat/capital/src/capital-budgeting.ts#

  • L289

    ts
    287      if (input.capitalRequired <= 0) throw new Error('Capital required must be positive.');
    288
    289      const projectId = makeId(`proj-${input.company}-${input.name}-${Date.now()}-${Math.random()}`);
    290      const project: CboProject = {
    291        projectId,
    
  • L331

    ts
    329
    330      const constraint: CboConstraint = {
    331        constraintId: makeId(`cstr-${input.type}-${Date.now()}-${Math.random()}`),
    332        type: input.type,
    333        description: input.description,
    
  • L350

    ts
    348      const budget = budgetOverride ?? this.config.totalBudget;
    349      const now = new Date().toISOString();
    350      const resultId = makeId(`opt-${now}-${Math.random()}`);
    351
    352      // Step 1: Include all mandatory projects first
    

libs/maat/capital/src/hurdle-rate.ts#

  • L338

    ts
    336        throw new Error('Total capital must be positive.');
    337
    338      const unitId = makeId(`unit-${input.company}-${input.name}-${Date.now()}-${Math.random()}`);
    339      const unit: HrcBusinessUnit = {
    340        unitId,
    
  • L467

    ts
    465
    466      const now = new Date().toISOString();
    467      const comparisonId = makeId(`comp-${now}-${Math.random()}`);
    468
    469      const calculations = ids.map((id) => this.calculate(id));
    

libs/maat/capital/src/investment-evaluation.ts#

  • L309

    ts
    307
    308      const opportunityId = makeId(
    309        `opp-${input.company}-${input.name}-${Date.now()}-${Math.random()}`
    310      );
    311      const opportunity: IefOpportunity = {
    
  • L481

    ts
    479
    480      const now = new Date().toISOString();
    481      const rankingId = makeId(`rank-${now}-${Math.random()}`);
    482
    483      // Evaluate all opportunities
    

libs/maat/capital/src/treasury-management.ts#

  • L284

    ts
    282
    283      const accountId = makeId(
    284        `acct-${input.company}-${input.accountName}-${Date.now()}-${Math.random()}`
    285      );
    286      const account: TmsCashAccount = {
    
  • L349

    ts
    347      const maturityDate = new Date(Date.now() + input.termDays * 86_400_000).toISOString();
    348      const loanId = makeId(
    349        `loan-${lenderAccount.company}-${borrowerAccount.company}-${Date.now()}-${Math.random()}`
    350      );
    351
    
  • L434

    ts
    432
    433      const now = new Date().toISOString();
    434      const poolId = makeId(`pool-${poolCurrency}-${now}-${Math.random()}`);
    435
    436      const totalBalance = accounts.reduce((s, a) => s + a.balance, 0);
    
  • L469

    ts
    467          const tpRate = this.getTransferPricingRate(poolCurrency, 90);
    468          sweepTransactions.push({
    469            transactionId: makeId(`sweep-${surplus.accountId}-${deficit.accountId}-${Math.random()}`),
    470            fromAccountId: surplus.accountId,
    471            toAccountId: deficit.accountId,
    
  • L498

    ts
    496          sweepTransactions.push({
    497            transactionId: makeId(
    498              `sweep-${surplus.accountId}-${poolMaster.accountId}-${Math.random()}`
    499            ),
    500            fromAccountId: surplus.accountId,
    

libs/maat/integrations/src/iris-integration.ts#

  • L258

    ts
    256      if (pattern.pattern.test(rawText)) {
    257        intent = pattern.intent;
    258        intentConfidence = 0.8 + Math.random() * 0.15; // Simulate confidence
    259        break;
    260      }
    

libs/maat/intelligence/src/voice-command-interface.ts#

  • L1102

    ts
    1100        0.2 * Math.sin(2 * Math.PI * frequencyHz * 2 * t) +
    1101        0.1 * Math.sin(2 * Math.PI * frequencyHz * 3 * t) +
    1102        0.05 * (Math.random() - 0.5); // noise floor
    1103    }
    1104    return samples;
    

libs/maat/knowledge/src/document-ingestion-pipeline.ts#

  • L259

    ts
    257      const etag = createHash('sha256').update(input.body).digest('hex').slice(0, 32);
    258      const versionId = createHash('sha256')
    259        .update(`${key}|${Date.now()}|${Math.random()}`)
    260        .digest('hex')
    261        .slice(0, 24);
    

libs/maat/knowledge/src/knowledge-access-analytics.ts#

  • L295

    ts
    293      const now = new Date().toISOString();
    294      const eventId = makeId(
    295        `access-${input.knowledgeItemId}-${input.userId}-${now}-${Math.random()}`
    296      );
    297
    
  • L327

    ts
    325    recordDecision(input: KaaRecordDecisionInput): KaaDecisionRecord {
    326      const now = new Date().toISOString();
    327      const decisionId = makeId(`decision-${input.userId}-${now}-${Math.random()}`);
    328
    329      const decision: KaaDecisionRecord = {
    

libs/maat/reporting/src/adhoc-report-builder.ts#

  • L282

    ts
    280
    281  function generateId(prefix: string): string {
    282    return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`.toUpperCase();
    283  }
    284
    

libs/maat/reporting/src/report-distribution.ts#

  • L160

    ts
    158  /** Generate unique IDs */
    159  function generateId(prefix: string): string {
    160    return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`.toUpperCase();
    161  }
    162
    

libs/maat/risk/src/business-continuity.ts#

  • L346

    ts
    344      if (input.rtoHours <= 0) throw new Error('RTO must be positive.');
    345
    346      const functionId = makeId(`bcf-${input.company}-${input.name}-${Date.now()}-${Math.random()}`);
    347      const fn: BcpBusinessFunction = {
    348        functionId,
    
  • L389

    ts
    387
    388      const playbookId = makeId(
    389        `pbk-${input.company}-${input.scenarioType}-${Date.now()}-${Math.random()}`
    390      );
    391
    
  • L398

    ts
    396            durationHours: p.durationHours,
    397            steps: p.steps.map((s) => ({
    398              stepId: makeId(`step-${s.description.slice(0, 20)}-${Math.random()}`),
    399              description: s.description,
    400              responsible: s.responsible,
    
  • L658

    ts
    656          steps: [
    657            {
    658              stepId: makeId(`step-activate-1-${Math.random()}`),
    659              description: 'Confirm incident and activate BCP team',
    660              responsible: 'BCP Coordinator',
    
  • L671

    ts
    669            },
    670            {
    671              stepId: makeId(`step-activate-2-${Math.random()}`),
    672              description: 'Notify senior management and stakeholders',
    673              responsible: 'BCP Coordinator',
    
  • L684

    ts
    682            },
    683            {
    684              stepId: makeId(`step-activate-3-${Math.random()}`),
    685              description: `Assess impact scope for ${scenarioType.toLowerCase().replace(/_/g, ' ')} scenario`,
    686              responsible: 'Operations Lead',
    
  • L704

    ts
    702          steps: [
    703            {
    704              stepId: makeId(`step-respond-1-${Math.random()}`),
    705              description: 'Ensure staff safety and secure affected premises',
    706              responsible: 'Safety Officer',
    
  • L717

    ts
    715            },
    716            {
    717              stepId: makeId(`step-respond-2-${Math.random()}`),
    718              description: 'Activate backup systems and alternate operations',
    719              responsible: 'IT Manager',
    
  • L730

    ts
    728            },
    729            {
    730              stepId: makeId(`step-respond-3-${Math.random()}`),
    731              description: 'Communicate status to all employees',
    732              responsible: 'HR Director',
    
  • L750

    ts
    748          steps: [
    749            {
    750              stepId: makeId(`step-short-1-${Math.random()}`),
    751              description: 'Restore critical business functions per RTO priorities',
    752              responsible: 'Operations Lead',
    
  • L763

    ts
    761            },
    762            {
    763              stepId: makeId(`step-short-2-${Math.random()}`),
    764              description: 'Implement workarounds for non-critical functions',
    765              responsible: 'Department Heads',
    
  • L776

    ts
    774            },
    775            {
    776              stepId: makeId(`step-short-3-${Math.random()}`),
    777              description: 'Begin damage assessment and insurance claims',
    778              responsible: 'Finance Director',
    
  • L796

    ts
    794          steps: [
    795            {
    796              stepId: makeId(`step-long-1-${Math.random()}`),
    797              description: 'Restore all remaining business functions',
    798              responsible: 'Operations Lead',
    
  • L809

    ts
    807            },
    808            {
    809              stepId: makeId(`step-long-2-${Math.random()}`),
    810              description: 'Repair or replace damaged infrastructure',
    811              responsible: 'Facilities Manager',
    
  • L825

    ts
    823          steps: [
    824            {
    825              stepId: makeId(`step-normal-1-${Math.random()}`),
    826              description: 'Conduct post-incident review and lessons learned',
    827              responsible: 'BCP Coordinator',
    
  • L839

    ts
    837            },
    838            {
    839              stepId: makeId(`step-normal-2-${Math.random()}`),
    840              description: 'Formally declare return to normal operations',
    841              responsible: 'CEO',
    
  • L893

    ts
    891      return [
    892        {
    893          templateId: makeId(`tmpl-activation-${Math.random()}`),
    894          name: 'Initial Activation Notice',
    895          audience: 'All Employees',
    
  • L902

    ts
    900        },
    901        {
    902          templateId: makeId(`tmpl-update-${Math.random()}`),
    903          name: 'Status Update',
    904          audience: 'All Employees + Stakeholders',
    
  • L911

    ts
    909        },
    910        {
    911          templateId: makeId(`tmpl-resolve-${Math.random()}`),
    912          name: 'Return to Normal',
    913          audience: 'All Employees + Stakeholders',
    

libs/maat/risk/src/climate-risk.ts#

  • L521

    ts
    519      if (input.assetValueUsd <= 0) throw new Error('Asset value must be positive.');
    520
    521      const facilityId = makeId(`fac-${input.name}-${input.company}-${Date.now()}-${Math.random()}`);
    522      const facility: ClrFacility = {
    523        facilityId,
    
  • L769

    ts
    767
    768      return {
    769        analysisId: makeId(`portfolio-climate-${now}-${Math.random()}`),
    770        totalFacilities: facilities.length,
    771        scenario,
    

libs/maat/risk/src/commodity-price-risk.ts#

  • L822

    ts
    820
    821      const positionId = makeId(
    822        `cpr-${input.company}-${input.commodity}-${Date.now()}-${Math.random()}`
    823      );
    824      const position: CprPosition = {
    
  • L872

    ts
    870      const seed = options?.seed ?? 42;
    871      const now = new Date().toISOString();
    872      const simulationId = makeId(`sim-${commodity}-${now}-${Math.random()}`);
    873
    874      const rng = new Rng(seed);
    
  • L1064

    ts
    1062
    1063      const now = new Date().toISOString();
    1064      const analysisId = makeId(`portfolio-${now}-${Math.random()}`);
    1065
    1066      const totalExposure = positions.reduce((s, p) => s + p.annualExposureUsd, 0);
    

libs/maat/risk/src/currency-risk-hedging.ts#

  • L434

    ts
    432
    433      const exposureId = makeId(
    434        `exp-${input.company}-${input.foreignCurrency}-${Date.now()}-${Math.random()}`
    435      );
    436      const exposure: CrhExposure = {
    
  • L629

    ts
    627      const exposures = [...this.exposuresById.values()];
    628      const now = new Date().toISOString();
    629      const resultId = makeId(`opt-portfolio-${now}-${Math.random()}`);
    630
    631      if (exposures.length === 0) {
    

libs/maat/risk/src/cybersecurity-risk.ts#

  • L484

    ts
    482
    483      const isOT = ['OT_SCADA', 'OT_PLC', 'OT_HMI'].includes(input.type);
    484      const systemId = makeId(`sys-${input.company}-${input.name}-${Date.now()}-${Math.random()}`);
    485      const system: CsrSystem = {
    486        systemId,
    
  • L537

    ts
    535        input.remediationDeadline ?? new Date(Date.now() + sladays * 86_400_000).toISOString();
    536
    537      const vulnId = makeId(`vuln-${input.systemId}-${input.title}-${Date.now()}-${Math.random()}`);
    538      const vuln: CsrVulnerability = {
    539        vulnId,
    

libs/maat/risk/src/emerging-risk-radar.ts#

  • L506

    ts
    504
    505      const now = new Date().toISOString();
    506      const signalId = makeId(`sig-${input.title.slice(0, 30)}-${Date.now()}-${Math.random()}`);
    507
    508      const fullText = `${input.title} ${input.content}`.toLowerCase();
    
  • L586

    ts
    584
    585      const now = new Date().toISOString();
    586      const riskId = makeId(`erisk-${input.name.slice(0, 30)}-${Date.now()}-${Math.random()}`);
    587
    588      // Find related signals
    

libs/maat/risk/src/insurance-portfolio.ts#

  • L414

    ts
    412      if (input.totalAssetValueUsd <= 0) throw new Error('Total asset value must be positive.');
    413
    414      const profileId = makeId(`prof-${input.company}-${Date.now()}-${Math.random()}`);
    415      const profile: IpoCompanyProfile = {
    416        profileId,
    
  • L450

    ts
    448
    449      const policyId = makeId(
    450        `pol-${input.company}-${input.coverageType}-${Date.now()}-${Math.random()}`
    451      );
    452      const rateBps =
    
  • L499

    ts
    497
    498      const now = new Date().toISOString();
    499      const resultId = makeId(`opt-ins-${now}-${Math.random()}`);
    500      const policies = [...this.policiesById.values()];
    501
    

libs/maat/risk/src/key-risk-indicators.ts#

  • L305

    ts
    303      if (input.name.trim().length === 0) throw new Error('KRI name is required.');
    304
    305      const kriId = makeId(`kri-${input.name}-${input.company}-${Date.now()}-${Math.random()}`);
    306      const kri: KriDefinition = {
    307        kriId,
    
  • L353

    ts
    351      const alertLevel = this.evaluateAlertLevel(kri, input.value);
    352      const timestamp = input.timestamp ?? new Date().toISOString();
    353      const dataPointId = makeId(`dp-${input.kriId}-${timestamp}-${Math.random()}`);
    354
    355      const dataPoint: KriDataPoint = {
    
  • L432

    ts
    430
    431      const alert: KriAlert = {
    432        alertId: makeId(`alert-${kri.kriId}-${dataPoint.timestamp}-${Math.random()}`),
    433        kriId: kri.kriId,
    434        kriName: kri.name,
    

libs/maat/risk/src/political-risk.ts#

  • L574

    ts
    572      const adjustments = this.adjustmentsByCountry.get(country) ?? [];
    573      const now = new Date().toISOString();
    574      const assessmentId = makeId(`pr-${country}-${now}-${Math.random()}`);
    575
    576      // Compute dimension scores
    

libs/maat/risk/src/risk-appetite.ts#

  • L303

    ts
    301
    302      const now = new Date().toISOString();
    303      const limitId = makeId(`lim-${input.company}-${input.name}-${Date.now()}-${Math.random()}`);
    304      const reviewDate =
    305        input.reviewDate ??
    
  • L359

    ts
    357      const breachStatus = this.evaluateBreachStatus(limit, input.value);
    358      const now = new Date().toISOString();
    359      const observationId = makeId(`obs-${input.limitId}-${now}-${Math.random()}`);
    360
    361      const observation: RafMetricObservation = {
    
  • L579

    ts
    577
    578      const breach: RafBreachEvent = {
    579        breachId: makeId(`breach-${limit.limitId}-${Date.now()}-${Math.random()}`),
    580        limitId: limit.limitId,
    581        limitName: limit.name,
    

libs/maat/risk/src/supply-chain-risk.ts#

  • L344

    ts
    342    registerNode(input: ScrRegisterNodeInput): ScrNode {
    343      if (this.nodesById.size >= this.config.maxNodes) throw new Error('Max nodes exceeded.');
    344      const nodeId = makeId(`node-${input.name}-${input.company}-${Date.now()}-${Math.random()}`);
    345      const node: ScrNode = {
    346        nodeId,
    
  • L394

    ts
    392
    393      const linkId = makeId(
    394        `link-${input.sourceNodeId}-${input.targetNodeId}-${Date.now()}-${Math.random()}`
    395      );
    396      const link: ScrLink = {
    
  • L432

    ts
    430      }
    431
    432      const disruptionId = makeId(`disrupt-${input.name}-${Date.now()}-${Math.random()}`);
    433      const disruption: ScrDisruption = {
    434        disruptionId,
    

libs/maat/risk/src/value-at-risk.ts#

  • L468

    ts
    466      const sigma = arrayStdDev(returns, mu);
    467
    468      const positionId = makeId(`pos-${input.name}-${Date.now()}-${Math.random()}`);
    469      const position: VarPosition = {
    470        positionId,
    
  • L642

    ts
    640    private calculateParametricVar(confidence: number, horizon: number): VarResult {
    641      const now = new Date().toISOString();
    642      const resultId = makeId(`var-param-${now}-${Math.random()}`);
    643      const positions = [...this.positionsById.values()];
    644      const n = positions.length;
    
  • L741

    ts
    739    private calculateHistoricalVar(confidence: number, horizon: number): VarResult {
    740      const now = new Date().toISOString();
    741      const resultId = makeId(`var-hist-${now}-${Math.random()}`);
    742      const positions = [...this.positionsById.values()];
    743      const portfolioValue = positions.reduce((s, p) => s + p.currentValue, 0);
    
  • L842

    ts
    840    ): VarResult {
    841      const now = new Date().toISOString();
    842      const resultId = makeId(`var-mc-${now}-${Math.random()}`);
    843      const positions = [...this.positionsById.values()];
    844      const n = positions.length;
    

libs/maat/sdk/src/typed-client.ts#

  • L228

    ts
    226          requestId: `mock-${Date.now().toString(36)}`,
    227          timestamp: new Date().toISOString(),
    228          durationMs: Math.floor(Math.random() * 50) + 10,
    229          module: 'core' as MaatModule,
    230          version: '1.0.0',
    

libs/maat/sdk/src/webhook-manager.ts#

  • L171

    ts
    169    const exponential = baseSeconds * Math.pow(2, attemptNumber - 1);
    170    // Add ±20% jitter to prevent thundering herd
    171    const jitter = exponential * (0.8 + Math.random() * 0.4);
    172    return Math.min(Math.round(jitter), maxDelay);
    173  }
    
  • L433

    ts
    431  ): MaatEvent {
    432    return {
    433      eventId: `EVT-${Date.now().toString(36).toUpperCase()}-${Math.random().toString(36).slice(2, 6).toUpperCase()}`,
    434      eventType,
    435      companyId,
    

libs/maat/workforce/src/org-design-modeler.ts#

  • L330

    ts
    328    return {
    329      ...params,
    330      structureId: `org-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    331      createdAt: new Date().toISOString(),
    332    };
    

libs/maya/client/src/crash-reporting-and-diagnostics.ts#

  • L341

    ts
    339        captureUnhandledRejections: config.captureUnhandledRejections ?? true,
    340        clock: config.clock ?? (() => new Date()),
    341        random: config.random ?? Math.random,
    342        framework: config.framework,
    343        platformSession: config.platformSession,
    

libs/maya/client/src/launcher-integration.ts#

  • L774

    ts
    772        idGenerator:
    773          config.idGenerator ??
    774          (() => `launch_${Math.random().toString(36).slice(2, 10)}_${Date.now().toString(36)}`),
    775      };
    776
    

libs/maya/client/src/offline-mode-support.ts#

  • L281

    ts
    279        idGenerator:
    280          config.idGenerator ??
    281          (() => `offline_op_${Math.random().toString(36).slice(2, 10)}_${Date.now().toString(36)}`),
    282      };
    283    }
    

libs/maya/database/src/backup-restore.ts#

  • L139

    ts
    137      baseBackupId: string | null = null
    138    ): BackupManifest {
    139      const backupId = `bkp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    140      const manifest: BackupManifest = {
    141        backupId,
    

libs/maya/database/src/data-anonymization.ts#

  • L50

    ts
    48  function addNoise(value: number, params?: Record<string, unknown>): number {
    49    const magnitude = (params?.magnitude as number) ?? 0.1;
    50    const noise = (Math.random() * 2 - 1) * magnitude * Math.abs(value);
    51    return value + noise;
    52  }
    

libs/maya/database/src/data-export-tools.ts#

  • L46

    ts
    44    startExport(options: ExportOptions): ExportJob {
    45      this.validateOptions(options);
    46      const jobId = `export-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    47      const job: ExportJob = {
    48        jobId,
    

libs/maya/documentation/src/api-documentation/interactive-api-explorer.ts#

  • L67

    ts
    65        body: successResponse ? { ...successResponse.schema, _simulated: true } : null,
    66        headers: { 'Content-Type': 'application/json', 'X-Request-Id': `sim_${Date.now()}` },
    67        duration_ms: Math.random() * 50 + 5,
    68      };
    69    }
    

libs/maya/documentation/src/tutorials-guides/deployment-guide.ts#

  • L119

    ts
    117    } {
    118      void deploymentUrl;
    119      return { status: 'healthy', activeUsers: Math.floor(Math.random() * 100), errorRate_pct: 0.1 };
    120    }
    121  }
    

libs/maya/testing/src/integration-testing/load-testing.ts#

  • L35

    ts
    33    private selectScenario(): LoadTestScenario {
    34      const totalWeight = this.scenarios.reduce((s, sc) => s + sc.weight, 0);
    35      let r = Math.random() * totalWeight;
    36      for (const sc of this.scenarios) {
    37        r -= sc.weight;
    

libs/maya/testing/src/integration-testing/world-streaming-tests.ts#

  • L62

    ts
    60            loaded: true,
    61            loadTime_ms,
    62            entities: Math.floor(Math.random() * 20),
    63          });
    64          harness.loadEvents.push({ coord, time_ms: loadTime_ms });
    

libs/maya/testing/src/visual-testing/particle-effect-tests.ts#

  • L61

    ts
    59      ) {
    60        const spreadRad = (this.config.spread_deg * Math.PI) / 180;
    61        const angle = (Math.random() - 0.5) * spreadRad;
    62        this.particles.push({
    63          position: { x: 0, y: 0, z: 0 },
    

libs/maya/testing/src/visual-testing/post-processing-tests.ts#

  • L66

    ts
    64          const intensity = config.intensity ?? 0.1;
    65          for (let i = 0; i < result.length; i += 4) {
    66            const noise = (Math.random() - 0.5) * intensity * 255;
    67            result[i] = Math.min(255, Math.max(0, result[i] + noise));
    68            result[i + 1] = Math.min(255, Math.max(0, result[i + 1] + noise));
    

libs/maya/tooling/src/asset-tools/batch-processing-tools.ts#

  • L83

    ts
    81    ): Promise<void> {
    82      await new Promise((resolve) => setTimeout(resolve, 1));
    83      if (type === 'Validate' && Math.random() < 0.05) {
    84        throw new Error('Validation failed: texture dimensions not power of 2');
    85      }
    

libs/maya/tooling/src/asset-tools/navmesh-generation-tools.ts#

  • L65

    ts
    63        this.regions.set(regionId, {
    64          id: regionId,
    65          center: { x: (Math.random() - 0.5) * 200, y: 0, z: (Math.random() - 0.5) * 200 },
    66          size: config.agentRadius_m * 2,
    67          isReachable: false,
    

libs/maya/tooling/src/profiling/gpu-profiler-integration.ts#

  • L59

    ts
    57        [GpuStage.Blit]: 0.1,
    58      };
    59      return baseTimes[stage] * (0.9 + Math.random() * 0.2);
    60    }
    61
    

libs/maya/tooling/src/profiling/telemetry-collection.ts#

  • L42

    ts
    40
    41    startSession(userId?: string, editorVersion = '1.0.0'): TelemetrySession {
    42      const sessionId = `session_${Date.now()}_${Math.random().toString(36).slice(2)}`;
    43      this.session = { sessionId, startedAt: new Date(), events: [], userId, editorVersion };
    44      this.trackEvent('Session', {
    
  • L68

    ts
    66      if (!this.config.enabled || this.isOptedOut) return;
    67      if (this.config.excludeEvents.includes(eventType)) return;
    68      if (Math.random() > this.config.sampleRate) return;
    69      if (!this.session) return;
    70      const event: TelemetryEvent = {
    

libs/maya/tooling/src/world-editor/asset-browser.ts#

  • L105

    ts
    103
    104    importAsset(path: string, category: AssetCategory): AssetThumbnail {
    105      const assetId = `asset_${Date.now()}_${Math.random().toString(36).slice(2)}`;
    106      const name = path.split('/').pop() ?? path;
    107      const asset: AssetThumbnail = {
    

libs/maya/tooling/src/world-editor/foliage-painting-tools.ts#

  • L44

    ts
    42    while (points.length < count && attempts < maxAttempts) {
    43      attempts++;
    44      const angle = Math.random() * Math.PI * 2;
    45      const r = Math.random() * radius;
    46      const candidate: Vec2 = {
    
  • L45

    ts
    43      attempts++;
    44      const angle = Math.random() * Math.PI * 2;
    45      const r = Math.random() * radius;
    46      const candidate: Vec2 = {
    47        x: center.x + r * Math.cos(angle),
    
  • L71

    ts
    69      const added: FoliageInstance[] = [];
    70      for (const pos of positions) {
    71        const jx = (Math.random() - 0.5) * brush.jitter_m;
    72        const jz = (Math.random() - 0.5) * brush.jitter_m;
    73        const instanceId = `foliage_${this.nextId++}`;
    
  • L72

    ts
    70      for (const pos of positions) {
    71        const jx = (Math.random() - 0.5) * brush.jitter_m;
    72        const jz = (Math.random() - 0.5) * brush.jitter_m;
    73        const instanceId = `foliage_${this.nextId++}`;
    74        const y = getHeight(pos.x + jx, pos.z + jz);
    
  • L75

    ts
    73        const instanceId = `foliage_${this.nextId++}`;
    74        const y = getHeight(pos.x + jx, pos.z + jz);
    75        const scale = brush.scaleMin + Math.random() * (brush.scaleMax - brush.scaleMin);
    76        const rotation = brush.randomRotation ? { y_deg: Math.random() * 360 } : { y_deg: 0 };
    77        const normal = brush.alignToNormal ? { x: 0, y: 1, z: 0 } : { x: 0, y: 1, z: 0 };
    
  • L76

    ts
    74        const y = getHeight(pos.x + jx, pos.z + jz);
    75        const scale = brush.scaleMin + Math.random() * (brush.scaleMax - brush.scaleMin);
    76        const rotation = brush.randomRotation ? { y_deg: Math.random() * 360 } : { y_deg: 0 };
    77        const normal = brush.alignToNormal ? { x: 0, y: 1, z: 0 } : { x: 0, y: 1, z: 0 };
    78        const instance: FoliageInstance = {
    

libs/maya/tooling/src/world-editor/play-in-editor-mode.ts#

  • L79

    ts
    77        this.session.stats = {
    78          fps: tickRate,
    79          physicsMs: 1.5 + Math.random() * 0.5,
    80          aiMs: 0.8 + Math.random() * 0.2,
    81        };
    
  • L80

    ts
    78          fps: tickRate,
    79          physicsMs: 1.5 + Math.random() * 0.5,
    80          aiMs: 0.8 + Math.random() * 0.2,
    81        };
    82      }, tickMs);
    

libs/meditation/breathing/src/builder.ts#

  • L86

    ts
    84     */
    85    constructor() {
    86      this.id = `custom-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    87    }
    88
    
  • L493

    ts
    491    clone(): BreathingPatternBuilder {
    492      const cloned = new BreathingPatternBuilder();
    493      cloned.id = `custom-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    494      cloned.patternName = this.patternName;
    495      cloned.patternDescription = this.patternDescription;
    

libs/meditation/breathing/src/exercise.ts#

  • L59

    ts
    57   */
    58  function generateSessionId(): string {
    59    return `breathing-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    60  }
    61
    

libs/meditation/breathing/src/patterns.ts#

  • L610

    ts
    608  ): BreathingPattern {
    609    const phases = createPhasesFromRatio(ratio);
    610    const id = `custom-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    611
    612    return {
    

libs/meditation/offline/src/queue.ts#

  • L87

    ts
    85  function generateDownloadId(): DownloadId {
    86    const timestamp = Date.now().toString(36);
    87    const random = Math.random().toString(36).substring(2, 9);
    88    return `download-${timestamp}-${random}` as DownloadId;
    89  }
    

libs/meditation/player/src/queue.ts#

  • L786

    ts
    784      // Fisher-Yates shuffle
    785      for (let i = this.items.length - 1; i > 0; i--) {
    786        const j = Math.floor(Math.random() * (i + 1));
    787        [this.items[i], this.items[j]] = [this.items[j], this.items[i]];
    788      }
    

libs/meditation/progress/src/sync.ts#

  • L494

    ts
    492
    493    private generateId(): string {
    494      return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    495    }
    496  }
    

libs/meditation/session/src/analytics.ts#

  • L554

    ts
    552
    553      // Check sample rate
    554      if (Math.random() > this.config.sampleRate) {
    555        return;
    556      }
    

libs/meditation/session/src/manager.ts#

  • L45

    ts
    43  function generateSessionId(): SessionId {
    44    const timestamp = Date.now().toString(36);
    45    const random = Math.random().toString(36).substring(2, 9);
    46    return `session-${timestamp}-${random}` as SessionId;
    47  }
    

libs/meditation/session/src/scheduling.ts#

  • L39

    ts
    37  function generateScheduleId(): string {
    38    const timestamp = Date.now().toString(36);
    39    const random = Math.random().toString(36).substring(2, 9);
    40    return `schedule-${timestamp}-${random}`;
    41  }
    

libs/meditation/timer/src/presets.ts#

  • L638

    ts
    636
    637    return {
    638      id: `custom-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`,
    639      name,
    640      description: description ?? `Custom ${durationMinutes}-minute meditation`,
    

libs/meditation/timer/src/timer.ts#

  • L68

    ts
    66   */
    67  function generateSessionId(): string {
    68    return `session-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    69  }
    70
    

libs/metis/ab-testing/src/variant-assigner/variant-assigner.ts#

  • L315

    ts
    313    }
    314
    315    const randomValue = Math.random();
    316    let cumulative = 0;
    317
    

libs/metis/adaptive/src/adaptation/content-selector.ts#

  • L59

    ts
    57    constructor(config?: Partial<ContentSelectorConfig>, randomFn?: RandomFn) {
    58      this.config = { ...DEFAULT_CONFIG, ...config };
    59      this.randomFn = randomFn ?? Math.random;
    60    }
    61
    

libs/metis/agents-types/src/communication/communication.ts#

  • L581

    ts
    579    const now = new Date();
    580    return {
    581      knowledgeId: `knowledge_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    582      agentId,
    583      content,
    
  • L598

    ts
    596  ): BlackboardTask {
    597    return {
    598      taskId: `bb_task_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    599      requesterId,
    600      description,
    

libs/metis/agents/src/agents/feedback-agent.ts#

  • L323

    ts
    321      }
    322
    323      const message = templates[Math.floor(Math.random() * templates.length)];
    324      const name = profile?.name ?? 'Student';
    325
    

libs/metis/agents/src/agents/research-agent.ts#

  • L263

    ts
    261        year: currentYear - Math.floor(i * 1.5),
    262        relevanceScore: Math.max(50, 95 - i * 5),
    263        reliabilityScore: tmpl.baseReliability + (Math.random() > 0.5 ? 5 : -5),
    264        keyContributions: [
    265          `Provides ${i === 0 ? 'foundational' : 'additional'} understanding of ${topic.toLowerCase()}`,
    

libs/metis/agents/src/agents/tutor-agent.ts#

  • L1247

    ts
    1245        handoffId:
    1246          this.defaultHandoffIdFactory?.() ??
    1247          `handoff_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    1248        learnerId,
    1249        sessionId,
    

libs/metis/agents/src/core/types.ts#

  • L28

    ts
    26  export function generateAgentId(prefix?: string): AgentId {
    27    const timestamp = Date.now().toString(36);
    28    const random = Math.random().toString(36).substring(2, 10);
    29    const id = prefix ? `${prefix}-${timestamp}-${random}` : `agent-${timestamp}-${random}`;
    30    return id as AgentId;
    

libs/metis/api-client/src/retry/retry.ts#

  • L84

    ts
    82
    83    if (config.jitter) {
    84      delay = delay * (0.5 + Math.random() * 0.5);
    85    }
    86
    

libs/metis/api-client/src/websocket/websocket.ts#

  • L393

    ts
    391
    392      // Add jitter
    393      const jitteredDelay = delay * (0.5 + Math.random() * 0.5);
    394
    395      this.reconnectAttempt++;
    

libs/metis/assessment/src/feedback/feedback.ts#

  • L435

    ts
    433
    434  function pickRandom(arr: readonly string[]): string {
    435    return arr[Math.floor(Math.random() * arr.length)];
    436  }
    

libs/metis/assessment/src/feedback/portfolio-generator.ts#

  • L416

    ts
    414
    415      return {
    416        id: `entry_${Date.now()}_${Math.floor(Math.random() * 10000)}`,
    417        type: options?.type ?? PortfolioEntryType.QUIZ,
    418        title,
    

libs/metis/integrations/src/hathor-integration.ts#

  • L102

    ts
    100    ): CurriculumWorld {
    101      const world: CurriculumWorld = {
    102        id: `world_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    103        name,
    104        description,
    
  • L129

    ts
    127    ): CurriculumRegion {
    128      const region: CurriculumRegion = {
    129        id: `region_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    130        name,
    131        topic,
    
  • L228

    ts
    226
    227      const flow: NarrativeFlow = {
    228        id: `flow_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    229        beats,
    230        totalDuration,
    

libs/metis/integrations/src/lilith-integration.ts#

  • L153

    ts
    151    ): ConversationTurn {
    152      const turn: ConversationTurn = {
    153        id: `turn_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    154        speaker,
    155        content,
    
  • L304

    ts
    302
    303    createSession(): string {
    304      const sessionId = `lilith_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    305      this.sessions.set(sessionId, { sessionId, startedAt: Date.now(), turnCount: 0 });
    306      return sessionId;
    

libs/metis/integrations/src/shared-libraries.ts#

  • L426

    ts
    424    ): MetisEvent {
    425      return {
    426        id: `evt_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    427        type,
    428        source,
    

libs/metis/integrations/src/sophia-integration.ts#

  • L1098

    ts
    1096
    1097      const map: ConceptMap = {
    1098        id: `cm_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    1099        title,
    1100        rootConceptId,
    

libs/metis/integrations/src/yemaya-integration.ts#

  • L215

    ts
    213
    214      const result: StyleTransferResult = {
    215        id: `st_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    216        outputImageId: `img_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    217        preset: request.targetPreset,
    
  • L216

    ts
    214      const result: StyleTransferResult = {
    215        id: `st_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    216        outputImageId: `img_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    217        preset: request.targetPreset,
    218        quality,
    
  • L586

    ts
    584
    585      const result: VideoEditResult = {
    586        id: `ve_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    587        outputVideoId: `vid_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    588        durationMs,
    
  • L587

    ts
    585      const result: VideoEditResult = {
    586        id: `ve_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    587        outputVideoId: `vid_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    588        durationMs,
    589        renderedAt: Date.now(),
    
  • L691

    ts
    689        const positionRatio = ts / durationMs;
    690        const positionPenalty = positionRatio < 0.05 || positionRatio > 0.95 ? 15 : 0;
    691        const quality = Math.round(Math.max(30, 85 - positionPenalty + Math.random() * 10));
    692
    693        return {
    
  • L694

    ts
    692
    693        return {
    694          id: `thumb_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    695          videoId,
    696          timestampMs: ts,
    
  • L697

    ts
    695          videoId,
    696          timestampMs: ts,
    697          imageId: `img_thumb_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    698          quality,
    699        };
    
  • L923

    ts
    921
    922      const result: AnimationResult = {
    923        id: `anim_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    924        outputAssetId: `asset_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    925        type: request.type,
    
  • L924

    ts
    922      const result: AnimationResult = {
    923        id: `anim_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    924        outputAssetId: `asset_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    925        type: request.type,
    926        frameCount: totalFrames,
    
  • L967

    ts
    965      });
    966
    967      const sequenceId = `diag_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    968      this.diagramSequences.set(sequenceId, diagramSteps);
    969
    
  • L1017

    ts
    1015      }
    1016
    1017      const vizId = `dviz_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    1018      this.dataVizFrames.set(vizId, frames);
    1019
    

libs/metis/knowledge-graph/src/applications/curriculum-planner.ts#

  • L12

    ts
    10
    11  function generateId(): string {
    12    return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    13  }
    14
    

libs/metis/knowledge-graph/src/applications/visualization-data.ts#

  • L122

    ts
    120      for (const node of nodes) {
    121        positions.set(node.id, {
    122          x: Math.random() * this.config.width,
    123          y: Math.random() * this.config.height,
    124        });
    
  • L123

    ts
    121        positions.set(node.id, {
    122          x: Math.random() * this.config.width,
    123          y: Math.random() * this.config.height,
    124        });
    125        velocities.set(node.id, { vx: 0, vy: 0 });
    

libs/metis/knowledge-graph/src/construction/graph-store.ts#

  • L24

    ts
    22
    23  function generateId(): string {
    24    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    25  }
    26
    

libs/metis/knowledge-graph/src/construction/graph-versioning.ts#

  • L19

    ts
    17
    18  function generateVersionId(): string {
    19    return `v-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    20  }
    21
    

libs/metis/knowledge-graph/src/operations/graph-analytics.ts#

  • L257

    ts
    255        const shuffled = [...nodeIds];
    256        for (let i = shuffled.length - 1; i > 0; i--) {
    257          const j = Math.floor(Math.random() * (i + 1));
    258          [shuffled[i], shuffled[j]] = [shuffled[j]!, shuffled[i]!];
    259        }
    

libs/metis/llm-client/src/content-generator/content-generator.ts#

  • L1437

    ts
    1435   */
    1436  function generateRequestId(): string {
    1437    return `req-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    1438  }
    1439
    

libs/metis/llm-client/src/llm-client/llm-client.ts#

  • L941

    ts
    939    const exponentialDelay = baseDelayMs * Math.pow(2, retryCount);
    940    // Add jitter: random value between 0 and 50% of the exponential delay
    941    const jitter = Math.random() * exponentialDelay * 0.5;
    942    // Cap at 30 seconds
    943    return Math.min(exponentialDelay + jitter, 30000);
    

libs/metis/model-registry/src/task-router/task-router.ts#

  • L642

    ts
    640
    641    // Pick a random value in [0, totalWeight)
    642    let roll = Math.random() * totalWeight;
    643    for (const e of eligible) {
    644      roll -= Math.max(e.overallScore, 0.01);
    

libs/metis/multimedia/src/video/gpu-worker-pool.ts#

  • L213

    ts
    211
    212      // Simulate rendering cost — memory usage scales with job
    213      idleWorker.memoryUsageMB = Math.min(this.config.memoryLimitMB, 200 + Math.random() * 300);
    214
    215      const processingJob: RenderJob = {
    

libs/metis/prompt-management/src/few-shot-library/few-shot-library.ts#

  • L309

    ts
    307    const shuffled = [...entries];
    308    for (let i = shuffled.length - 1; i > 0; i--) {
    309      const j = Math.floor(Math.random() * (i + 1));
    310      [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
    311    }
    
  • L330

    ts
    328    for (let i = 0; i < count && remaining.length > 0; i++) {
    329      const totalWeight = remaining.reduce((sum, e) => sum + Math.max(0.01, e.qualityScore), 0);
    330      let threshold = Math.random() * totalWeight;
    331
    332      let selectedIndex = remaining.length - 1;
    

libs/metis/prompt-management/src/pedagogical-prompt/pedagogical-prompt.ts#

  • L786

    ts
    784;
    785; // V1-P2-0541: deterministic checkpoint verb selection. The
    786; // previous `Math.random()` introduced run-to-run variation that
    787; // broke fixture-based tests and was inconsistent with the
    788; // deterministic-by-verb-length selection inside
    

libs/metis/quality/src/infrastructure/types.ts#

  • L289

    ts
    287    }
    288    return {
    289      id: `report-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    290      timestamp: Date.now(),
    291      durationMs,
    

libs/metis/tutoring/src/scaffolding/scaffolding.ts#

  • L173

    ts
    171
    172  function selectRandom<T>(items: readonly T[]): T {
    173    return items[Math.floor(Math.random() * items.length)];
    174  }
    175
    

libs/mnemosyne/aesthetics/src/aesthetics.ts#

  • L597

    ts
    595      periodConfidence: 0.75,
    596      movementConfidence: periodMovementMap[period] ? 0.7 : undefined,
    597      styleAttributes: attributes.map((a) => ({ attribute: a, score: 0.5 + Math.random() * 0.4 })),
    598      compositionType: 'triangular',
    599      dominantColors: [{ color: 'ochre', hex: '#CC7722', percentage: 30 }],
    

libs/mnemosyne/classical-tools/src/classical-tools.ts#

  • L464

    ts
    462  ): TranslationAlignment {
    463    return {
    464      alignmentId: `align_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    465      sourceTextId,
    466      targetTextId,
    
  • L736

    ts
    734  ): TextAnnotation {
    735    return {
    736      annotationId: `ann_${textId}_${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
    737      textId,
    738      language,
    
  • L866

    ts
    864  ): CollaborativeAnnotationEdit {
    865    return {
    866      editId: `edit_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    867      annotationId,
    868      editorId,
    
  • L908

    ts
    906    );
    907    return {
    908      exportId: `export_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    909      textId,
    910      format,
    

libs/mnemosyne/community/src/community.ts#

  • L218

    ts
    216  ): UserReport {
    217    return {
    218      reportId: `report_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    219      reporterId,
    220      reportedUserId,
    
  • L254

    ts
    252  ): ExchangeSession {
    253    return {
    254      sessionId: `session_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    255      participantIds: [participantA, participantB],
    256      scheduledAt,
    
  • L386

    ts
    384  ): ChatMessage {
    385    return {
    386      messageId: `msg_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    387      conversationId,
    388      senderId,
    
  • L402

    ts
    400    correction: Omit<InlineCorrection, 'correctionId'>
    401  ): ChatMessage {
    402    const id = `corr_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    403    return {
    404      ...message,
    
  • L610

    ts
    608    const newElement: WhiteboardElement = {
    609      ...element,
    610      elementId: `el_${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
    611      createdAt: Date.now(),
    612    };
    
  • L666

    ts
    664  ): Moment {
    665    return {
    666      momentId: `moment_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    667      authorId,
    668      type,
    
  • L694

    ts
    692  ): Moment {
    693    const correction: MomentCorrection = {
    694      correctionId: `mc_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    695      correctorId,
    696      correctorIsNative,
    
  • L900

    ts
    898  ): VoiceRoom {
    899    return {
    900      roomId: `room_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    901      name,
    902      description: `${topic} — Language: ${language}`,
    
  • L1038

    ts
    1036    const seg: LiveTranscriptSegment = {
    1037      ...segment,
    1038      segmentId: `seg_${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
    1039    };
    1040    return { ...room, liveTranscription: [...room.liveTranscription, seg] };
    
  • L1207

    ts
    1205        : 0;
    1206    return {
    1207      feedbackId: `fb_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    1208      coachId,
    1209      submissionId,
    
  • L1366

    ts
    1364  ): Annotation {
    1365    return {
    1366      annotationId: `ann_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    1367      documentId: anchor.documentId,
    1368      authorId,
    
  • L1392

    ts
    1390  ): Annotation {
    1391    const reply: AnnotationReply = {
    1392      replyId: `reply_${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
    1393      authorId,
    1394      content,
    
  • L1529

    ts
    1527  ): ReadingGroup {
    1528    return {
    1529      groupId: `grp_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    1530      name,
    1531      instructorId,
    

libs/mnemosyne/core/src/ai-infrastructure.ts#

  • L2060

    ts
    2058    if (numberMatch) {
    2059      const num = parseFloat(numberMatch[1]);
    2060      const factor = Math.random() > 0.5 ? 10 : 0.1;
    2061      const newNum = num * factor;
    2062      return answer.replace(numberMatch[1], newNum.toString());
    

libs/mnemosyne/core/src/assessment.ts#

  • L383

    ts
    381  export function simulateResponse(trueTheta: number, item: TestItem, rng?: number): boolean {
    382    const p = irtProbability(trueTheta, item.irtParameters);
    383    const r = rng !== undefined ? rng : Math.random();
    384    return r < p;
    385  }
    

libs/mnemosyne/experience/src/experience.ts#

  • L335

    ts
    333
    334    // Epsilon-greedy
    335    if (Math.random() < epsilon) {
    336      return actions[Math.floor(Math.random() * actions.length)];
    337    }
    
  • L336

    ts
    334    // Epsilon-greedy
    335    if (Math.random() < epsilon) {
    336      return actions[Math.floor(Math.random() * actions.length)];
    337    }
    338    let best: RLAction = 'new_item';
    

libs/mnemosyne/gamification-plus/src/gamification-plus.ts#

  • L240

    ts
    238  ): XPMultiplierEvent {
    239    return {
    240      eventId: `xp_event_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    241      name,
    242      multiplier,
    
  • L293

    ts
    291  ): FriendChallenge {
    292    return {
    293      challengeId: `challenge_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    294      challengerId,
    295      challengeeId,
    
  • L363

    ts
    361  export function createTeam(name: string, memberIds: string[]): Team {
    362    return {
    363      teamId: `team_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    364      name,
    365      memberIds,
    
  • L952

    ts
    950  ): LearningEvent {
    951    return {
    952      eventId: `event_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    953      type,
    954      name,
    
  • L1123

    ts
    1121  ): UserEventProposal {
    1122    return {
    1123      proposalId: `proposal_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    1124      proposerId,
    1125      title,
    

libs/mnemosyne/heritage/src/heritage.ts#

  • L647

    ts
    645  ): AnnotationModel['annotations'][0] {
    646    return {
    647      id: `ann-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
    648      position,
    649      title,
    

libs/mnemosyne/knowledge-graph/src/knowledge-graph.ts#

  • L50

    ts
    48
    49  export function blankNode(id?: string): RDFTerm {
    50    return { termType: 'BlankNode', value: id ?? `b${Math.random().toString(36).slice(2, 8)}` };
    51  }
    52
    

libs/mnemosyne/linguistics/src/linguistics.ts#

  • L2407

    ts
    2405    }
    2406    const mtld = tokens.length / Math.max(1, factors + count / tokens.length);
    2407    const vocd = Math.random() * 30 + 60; // D approximation
    2408    return { ttr, mattr, mtld, vocd, tokens: tokens.length, types };
    2409  }
    
  • L2430

    ts
    2428    const entry = prosodies[word.toLowerCase()];
    2429    if (entry) {
    2430      return { word, ...entry, strength: 0.7 + Math.random() * 0.3 };
    2431    }
    2432    const contexts = buildKWIC(corpus, word).map((k) => k.right.split(' ')[0]);
    

libs/mnemosyne/philology/src/philology.ts#

  • L1928

    ts
    1926    }
    1927    const chars = module.characters.slice(0, Math.min(5, module.characters.length));
    1928    const char = chars[Math.floor(Math.random() * chars.length)];
    1929    if (!char) {
    1930      return { prompt: 'No characters at this stage', answer: '', type: 'recognition' };
    

libs/mnemosyne/platform/src/platform.ts#

  • L319

    ts
    317  ): XAPIStatement {
    318    return {
    319      id: `urn:uuid:${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,
    320      actor: { objectType: 'Agent', name: actorName, mbox: actorMbox },
    321      verb: {
    
  • L1845

    ts
    1843  ): SyncOperation {
    1844    return {
    1845      id: `sync-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    1846      type,
    1847      entity,
    
  • L1901

    ts
    1899  ): DeviceRegistration {
    1900    return {
    1901      deviceId: `${platform}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`,
    1902      userId,
    1903      platform,
    
  • L2136

    ts
    2134  ): ContentItem {
    2135    return {
    2136      id: `content-${type}-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    2137      type,
    2138      title,
    
  • L2196

    ts
    2194  ): Course {
    2195    return {
    2196      id: `course-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
    2197      title,
    2198      description,
    
  • L2220

    ts
    2218    const newModule: CourseModule = {
    2219      ...module,
    2220      id: `module-${Date.now()}-${Math.random().toString(36).slice(2, 4)}`,
    2221      order: course.modules.length + 1,
    2222    };
    

libs/mnemosyne/polyglot/src/vocab-grammar-extended.ts#

  • L1570

    ts
    1568  ): VocabGoal {
    1569    return {
    1570      id: `goal-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    1571      learnerId,
    1572      type,
    

libs/mnemosyne/pronunciation/src/pronunciation.ts#

  • L511

    ts
    509  ): PronunciationRecording {
    510    return {
    511      recordingId: `rec_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    512      word,
    513      language,
    
  • L598

    ts
    596  ): PronunciationWordRequest {
    597    return {
    598      requestId: `req_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    599      word,
    600      language,
    
  • L886

    ts
    884  ): VoiceCoachSession {
    885    return {
    886      sessionId: `vcs_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    887      userId,
    888      language,
    
  • L911

    ts
    909  ): VoiceCoachSession {
    910    const turn: VoiceCoachTurn = {
    911      turnId: `turn_${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
    912      speakerId: speaker,
    913      text,
    
  • L1059

    ts
    1057    const avgStress = recentScores.reduce((s, sc) => s + sc.stressAccuracy, 0) / recentScores.length;
    1058
    1059    const verificationCode = Math.random().toString(36).slice(2, 14).toUpperCase();
    1060    const now = Date.now();
    1061    const twoYearsMs = 2 * 365 * 24 * 60 * 60 * 1000;
    

libs/mnemosyne/writing/src/writing.ts#

  • L242

    ts
    240  ): GrammarRule {
    241    return {
    242      ruleId: `custom_${language}_${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
    243      language,
    244      category,
    
  • L589

    ts
    587  ): CorrectionHistoryEntry {
    588    return {
    589      entryId: `hist_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    590      userId,
    591      ruleId: error.ruleId,
    
  • L637

    ts
    635
    636    return {
    637      checkId: `check_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    638      language,
    639      text,
    
  • L915

    ts
    913  ): WritingExercise {
    914    return {
    915      exerciseId: `ex_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    916      topic,
    917      genre,
    
  • L958

    ts
    956    const words = tokenizeWords(content);
    957    return {
    958      submissionId: `sub_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    959      exerciseId,
    960      promptId,
    
  • L1112

    ts
    1110  ): PeerWritingReview {
    1111    return {
    1112      reviewId: `review_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    1113      reviewerId,
    1114      submissionId,
    

libs/neith/docs/src/api/api-explorer.ts#

  • L215

    ts
    213      const col = this.collections.get(collectionId);
    214      if (!col) return null;
    215      const token = `neith-col-${Math.random().toString(36).slice(2, 18)}`;
    216      col.sharedToken = token;
    217      return token;
    

libs/neith/docs/src/api/rate-limits.ts#

  • L56

    ts
    54      if (strategy === 'linear') return attempt * 1000;
    55      const base = 1000;
    56      const jitter = Math.random() * 1000;
    57      return Math.min(base * Math.pow(2, attempt) + jitter, 60000); // cap at 60s
    58    }
    

libs/neith/integration-isis/src/generation-pipeline/ab-testing.ts#

  • L282

    ts
    280      if (experiment?.status !== 'running') return undefined;
    281
    282      const rand = seed !== undefined ? (seed % 1000) / 1000 : Math.random();
    283      let cumulative = 0;
    284      for (const variant of experiment.variants) {
    

libs/neith/integration-isis/src/types.ts#

  • L278

    ts
    276          width: req.width ?? 512,
    277          height: req.height ?? 512,
    278          seed: req.seed ?? Math.floor(Math.random() * 0xffffffff),
    279          model: req.model,
    280          latencyMs: 800,
    
  • L299

    ts
    297        return {
    298          id: nextId(),
    299          embeddings: inputs.map(() => Array.from({ length: dims }, () => Math.random() * 2 - 1)),
    300          dimensions: dims,
    301          model: req.model,
    

libs/neith/integration-maya/src/metaverse-platform/economy.ts#

  • L207

    ts
    205
    206    return {
    207      listingId: `auction_${now.getTime()}_${Math.random().toString(36).slice(2, 8)}`,
    208      itemId,
    209      sellerId,
    
  • L359

    ts
    357
    358    return {
    359      listingId: `listing_${now.getTime()}_${Math.random().toString(36).slice(2, 8)}`,
    360      itemId,
    361      sellerId,
    

libs/neith/integration-maya/src/metaverse-platform/social-features.ts#

  • L213

    ts
    211
    212  function generateId(prefix: string, now: Date = new Date()): string {
    213    return `${prefix}_${now.getTime()}_${Math.random()
    214      .toString(36)
    215      .slice(2, 2 + PARTY_ID_SEGMENT_LENGTH)}`;
    

libs/neith/integration-yemaya/src/dcc-tools/sculptor-adapter.ts#

  • L411

    ts
    409    return {
    410      type: 'scatter',
    411      seed: Math.floor(Math.random() * 2 ** 31),
    412      intensity: Math.min(1, params.density / 100),
    413      scale: 1.0,
    

libs/neith/observability/src/logging/correlation.ts#

  • L181

    ts
    179    } else {
    180      for (let i = 0; i < 16; i++) {
    181        bytes[i] = Math.floor(Math.random() * 256);
    182      }
    183    }
    
  • L205

    ts
    203      crypto.getRandomValues(bytes);
    204    } else {
    205      for (let i = 0; i < 16; i++) bytes[i] = Math.floor(Math.random() * 256);
    206    }
    207    return Array.from(bytes)
    
  • L217

    ts
    215      crypto.getRandomValues(bytes);
    216    } else {
    217      for (let i = 0; i < 8; i++) bytes[i] = Math.floor(Math.random() * 256);
    218    }
    219    return Array.from(bytes)
    

libs/neith/qa/src/code-quality/duplication.ts#

  • L203

    ts
    201      this.a = Array.from(
    202        { length: m },
    203        () => Math.floor(Math.random() * (MinHashDetector.LARGE_PRIME - 1)) + 1
    204      );
    205      this.b = Array.from({ length: m }, () =>
    
  • L206

    ts
    204      );
    205      this.b = Array.from({ length: m }, () =>
    206        Math.floor(Math.random() * MinHashDetector.LARGE_PRIME)
    207      );
    208    }
    

libs/neith/qa/src/code-quality/security.ts#

  • L172

    ts
    170    },
    171
    172    // ── Math.random() for security ───────────────────────────────────────────
    173    {
    174      id: 'S-007',
    
  • L177

    ts
    175      name: 'insecure-random',
    176      severity: 'medium',
    177      description: 'Math.random() used for security-sensitive operations',
    178      check(filePath, source) {
    179        // Look for Math.random() near security-sensitive keywords
    
  • L179

    ts
    177      description: 'Math.random() used for security-sensitive operations',
    178      check(filePath, source) {
    179        // Look for Math.random() near security-sensitive keywords
    180        const results: SecurityVulnerability[] = [];
    181        const lines = source.split('\n');
    
  • L192

    ts
    190              severity: 'medium',
    191              description:
    192                'Math.random() used in security-sensitive context — not cryptographically secure',
    193              file: filePath,
    194              line: idx + 1,
    

libs/neith/release/src/distribution/cdn.ts#

  • L190

    ts
    188
    189      const invalidation: InvalidationRequest = {
    190        id: `inv-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    191        paths,
    192        status: 'pending',
    

libs/neith/release/src/distribution/signature.ts#

  • L103

    ts
    101      const signature: SignatureRecord = {
    102        ...record,
    103        id: `sig-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    104        signedAt: new Date().toISOString(),
    105      };
    

libs/neith/release/src/distribution/trial-versions.ts#

  • L96

    ts
    94
    95      const trial: Trial = {
    96        id: `trial-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    97        userId: options.userId,
    98        productId: options.productId,
    

libs/neith/release/src/distribution/volume-licensing.ts#

  • L95

    ts
    93
    94      const assignment: VolumeLicenseAssignment = {
    95        id: `assign-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    96        poolId,
    97        userId,
    
  • L233

    ts
    231      const orgCode = pool.organizationId.slice(-4).toUpperCase();
    232      const userHash = userId.slice(-4).toUpperCase();
    233      const random = Math.random().toString(36).slice(2, 10).toUpperCase();
    234      return `${tierCode}-${orgCode}-${userHash}-${random}`;
    235    }
    

libs/neith/release/src/pipeline/beta-programs.ts#

  • L200

    ts
    198
    199      const feedbackItem: ProgramFeedback = {
    200        id: `fb-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    201        participantId: userId,
    202        programId,
    

libs/neith/release/src/pipeline/early-access.ts#

  • L332

    ts
    330      const userHash = userId.slice(-4).toUpperCase();
    331      const cohortHash = cohortId.slice(-4).toUpperCase();
    332      const random = Math.random().toString(36).slice(2, 10).toUpperCase();
    333      return `${prefix}-${tierCode}-${userHash}-${cohortHash}-${random}`;
    334    }
    

libs/neith/release/src/pipeline/hotfix.ts#

  • L65

    ts
    63
    64      const hotfix: Hotfix = {
    65        id: `hf-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    66        severity: options.severity,
    67        status: 'identified',
    

libs/neith/release/src/pipeline/lts-support.ts#

  • L116

    ts
    114      }
    115
    116      const id = `bp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    117      const backport: BackportRequest = {
    118        ...request,
    

libs/neith/release/src/pipeline/release-automation.ts#

  • L346

    ts
    344    createRun(config: ReleasePipelineConfig, version: string, triggeredBy: string): PipelineRun {
    345      const run: PipelineRun = {
    346        id: `run-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    347        pipelineConfig: config,
    348        version,
    

libs/neith/testing/src/e2e/load.ts#

  • L509

    ts
    507    private _weightedSelect(scenarios: LoadScenario[]): LoadScenario {
    508      const total = scenarios.reduce((acc, s) => acc + s.weight, 0);
    509      let rand = Math.random() * total;
    510      for (const s of scenarios) {
    511        rand -= s.weight;
    

libs/neith/testing/src/e2e/vr-xr.ts#

  • L270

    ts
    268
    269    createAnchor(pose: XrPose): string {
    270      const id = `anchor-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
    271      this.anchors.set(id, { id, pose, persistent: false, createdAt: Date.now() });
    272      return id;
    

libs/neith/testing/src/integration/isolation.ts#

  • L15

    ts
    13
    14    constructor(testId?: string) {
    15      this.namespace = testId ?? `test_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    16    }
    17
    

libs/neith/testing/src/integration/retry.ts#

  • L41

    ts
    39    delayMs(attempt: number): number {
    40      const exponential = this.baseMs * Math.pow(2, attempt - 1);
    41      const jitter = 1 + (Math.random() * 2 - 1) * this.jitterFactor;
    42      return Math.min(exponential * jitter, this.maxMs);
    43    }
    

libs/neith/testing/src/performance/latency.ts#

  • L161

    ts
    159    record(valueMs: number): void {
    160      this.sampleCount++;
    161      if (Math.random() <= this.samplingRate) {
    162        this.dist.record(valueMs);
    163      }
    

libs/neith/testing/src/unit/factories.ts#

  • L222

    ts
    220        'Jack',
    221      ];
    222      return names[Math.floor(Math.random() * names.length)]!;
    223    },
    224
    
  • L239

    ts
    237        'Taylor',
    238      ];
    239      return names[Math.floor(Math.random() * names.length)]!;
    240    },
    241
    
  • L247

    ts
    245    /** Generates a random email address */
    246    email: (domain = 'example.com'): string => {
    247      const local = `${fake.firstName().toLowerCase()}.${fake.lastName().toLowerCase()}${Math.floor(Math.random() * 100)}`;
    248      return `${local}@${domain}`;
    249    },
    
  • L255

    ts
    253
    254    /** Generates a random integer in range */
    255    integer: (min = 0, max = 1000): number => min + Math.floor(Math.random() * (max - min + 1)),
    256
    257    /** Generates a random float in range */
    
  • L258

    ts
    256
    257    /** Generates a random float in range */
    258    float: (min = 0, max = 1): number => min + Math.random() * (max - min),
    259
    260    /** Generates a random boolean */
    
  • L261

    ts
    259
    260    /** Generates a random boolean */
    261    boolean: (): boolean => Math.random() > 0.5,
    262
    263    /** Generates a random date in range */
    
  • L265

    ts
    263    /** Generates a random date in range */
    264    date: (start = new Date(2020, 0, 1), end = new Date()): Date => {
    265      return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
    266    },
    267
    
  • L275

    ts
    273      const domains = ['example.com', 'test.io', 'acme.org', 'sample.dev'];
    274      const paths = ['/', '/api', '/user', '/product', '/service'];
    275      return `${protocol}://${domains[Math.floor(Math.random() * domains.length)]}${paths[Math.floor(Math.random() * paths.length)]}`;
    276    },
    277
    
  • L280

    ts
    278    /** Generates a random IPv4 address */
    279    ipv4: (): string => {
    280      const octet = () => Math.floor(Math.random() * 256);
    281      return `${octet()}.${octet()}.${octet()}.${octet()}`;
    282    },
    
  • L286

    ts
    284    /** Generates a random hex color */
    285    color: (): string =>
    286      `#${Math.floor(Math.random() * 0xffffff)
    287        .toString(16)
    288        .padStart(6, '0')}`,
    
  • L291

    ts
    289
    290    /** Picks a random element from an array */
    291    pick: <T>(arr: T[]): T => arr[Math.floor(Math.random() * arr.length)]!,
    292
    293    /** Generates a random string of given length */
    
  • L295

    ts
    293    /** Generates a random string of given length */
    294    string: (length = 10, charset = 'abcdefghijklmnopqrstuvwxyz'): string =>
    295      Array.from({ length }, () => charset[Math.floor(Math.random() * charset.length)]).join(''),
    296
    297    /** Generates lorem ipsum words */
    
  • L315

    ts
    313
    314    /** Generates a phone number */
    315    phone: (): string => `+1${Math.floor(Math.random() * 9000000000 + 1000000000)}`,
    316
    317    /** Generates a US zip code */
    
  • L318

    ts
    316
    317    /** Generates a US zip code */
    318    zipCode: (): string => String(Math.floor(Math.random() * 90000 + 10000)),
    319
    320    /** Generates a credit card number (test values only) */
    

libs/neith/testing/src/unit/fixtures.ts#

  • L180

    ts
    178      factory: function* () {
    179        const files = new Map<string, string | Uint8Array>();
    180        const dirPath = `/tmp/${prefix}-${Math.random().toString(36).slice(2)}`;
    181
    182        const fixture: TempDirFixture = {
    
  • L223

    ts
    221      scope: 'suite',
    222      factory: async function* () {
    223        const serverPort = port ?? 3000 + Math.floor(Math.random() * 5000);
    224        const server = await serverFactory(serverPort);
    225
    

libs/neith/testing/src/unit/ts-infra.ts#

  • L439

    ts
    437  export function createVirtualFs(): TempDirHandle {
    438    const files = new Map<string, string>();
    439    const basePath = `/tmp/test-${Math.random().toString(36).slice(2)}`;
    440
    441    return {
    

libs/neith/training/src/user/community-forums.ts#

  • L101

    ts
    99
    100      const thread: ForumThread = {
    101        id: `thread-${Date.now()}-${Math.random().toString(36).slice(2)}`,
    102        categoryId,
    103        authorId,
    
  • L181

    ts
    179
    180      const reply: ForumReply = {
    181        id: `reply-${Date.now()}-${Math.random().toString(36).slice(2)}`,
    182        threadId,
    183        authorId,
    

libs/neith/training/src/user/webinars.ts#

  • L134

    ts
    132        attendeeName,
    133        issuedAt: new Date(),
    134        verificationCode: `NWB-${Math.random().toString(36).slice(2, 10).toUpperCase()}`,
    135      };
    136
    

libs/nisaba/annotations/src/annotation-exports.ts#

  • L64

    ts
    62  function generateExportId(prefix: string): string {
    63    const hex = (): string =>
    64      Math.floor(Math.random() * 0x10000)
    65        .toString(16)
    66        .padStart(4, '0');
    

libs/nisaba/annotations/src/collaborative-annotations.ts#

  • L25

    ts
    23    const timestamp = Date.now().toString(36);
    24    const counter = _idCounter.toString(36).padStart(6, '0');
    25    const random = Math.random().toString(36).substring(2, 8);
    26    return `${prefix}_${timestamp}_${counter}_${random}`;
    27  }
    

libs/nisaba/annotations/src/standoff-annotations.ts#

  • L49

    ts
    47  function generateAnnotationId(prefix: string): string {
    48    const hex = (): string =>
    49      Math.floor(Math.random() * 0x10000)
    50        .toString(16)
    51        .padStart(4, '0');
    

libs/nisaba/client/src/api-client.ts#

  • L1324

    ts
    1322    const exponential = Math.min(baseDelayMs * 2 ** attempt, maxDelayMs);
    1323    const jitterRange = exponential * jitter;
    1324    const randomOffset = (Math.random() * 2 - 1) * jitterRange;
    1325    return Math.max(0, Math.round(exponential + randomOffset));
    1326  }
    

libs/nisaba/criticism/src/stemmatic-analysis.ts#

  • L1714

    ts
    1712    const replicates = config.bootstrapReplicates;
    1713    const rng =
    1714      config.randomSeed !== undefined ? seededRandom(config.randomSeed) : () => Math.random();
    1715
    1716    const numChars = matrix.characters.length;
    

libs/nisaba/standards/src/reference-linked-data.ts#

  • L4053

    ts
    4051
    4052    return {
    4053      id: options?.id ?? `urn:annotation:${Date.now()}-${Math.random().toString(36).substring(2, 9)}`,
    4054      type: 'Annotation',
    4055      motivation: options?.motivation ?? 'commenting',
    

libs/nisaba/translations/src/alignment/manual-alignment.ts#

  • L268

    ts
    266      // Simple pseudo-UUID (not cryptographically secure, but sufficient)
    267      const hex = () =>
    268        Math.floor(Math.random() * 0x10000)
    269          .toString(16)
    270          .padStart(4, '0');
    

libs/nisaba/workspace/src/personal-library-export.ts#

  • L804

    ts
    802  function uniqueId(): string {
    803    const ts = Date.now().toString(36);
    804    const r = Math.random().toString(36).substring(2, 10);
    805    return `${ts}-${r}`;
    806  }
    

libs/nisaba/workspace/src/research-environment.ts#

  • L345

    ts
    343  function generateId(prefix: string): string {
    344    _idCounter += 1;
    345    const rand = Math.random().toString(36).slice(2, 8);
    346    return `${prefix}_${_idCounter}_${rand}`;
    347  }
    

libs/nous/audio/src/streaming-asr.ts#

  • L798

    ts
    796    private generateSessionId(): string {
    797      const now = this.now();
    798      const entropy = Math.floor(stableUnit(`streaming:${now}:${Math.random()}`) * 1e9)
    799        .toString(16)
    800        .padStart(8, '0');
    

libs/nous/core/src/temperature-sampling.ts#

  • L266

    ts
    264        this.random = () => generator.next();
    265      } else {
    266        this.random = () => Math.random();
    267      }
    268    }
    

libs/nous/image-control/src/concept-sliders-lora-directions.ts#

  • L584

    ts
    582    public constructor(options: ConceptSlidersLoraDirectionsOptions = {}) {
    583      this.now = options.now ?? (() => Date.now());
    584      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    585    }
    586
    

libs/nous/image-control/src/controlnet-plus-plus-training-pipeline.ts#

  • L370

    ts
    368    public constructor(options: ControlNetPlusPlusTrainingPipelineOptions = {}) {
    369      this.now = options.now ?? (() => Date.now());
    370      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    371      this.cycleConsistency =
    372        options.cycleConsistency ?? new ControlNetPlusPlusCycleConsistencyModule();
    

libs/nous/image-control/src/omini-control-training-pipeline.ts#

  • L384

    ts
    382    public constructor(options: OminiControlTrainingPipelineOptions = {}) {
    383      this.now = options.now ?? (() => Date.now());
    384      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    385      for (const conditionType of BUILTIN_CONDITION_TYPES) {
    386        this.conditionTypes.set(conditionType.id, normalizeConditionType(conditionType));
    

libs/nous/image-control/src/streamdiffusion-image-control-integration.ts#

  • L686

    ts
    684    public constructor(options: StreamDiffusionImageControlIntegrationOptions = {}) {
    685      this.now = options.now ?? Date.now;
    686      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    687      this.ominiSpatialPipeline = new OminiSpatialControlPipeline(
    688        options.ominiSpatialPipelineOptions
    

libs/nous/llm/src/action-selection.ts#

  • L297

    ts
    295    constructor(options: ActionSelectionModuleOptions = {}) {
    296      this.now = options.now ?? (() => Date.now());
    297      this.rng = options.rng ?? (() => Math.random());
    298      this.defaultPolicy = options.defaultPolicy ?? 'balanced';
    299      this.defaultTopK = Math.max(1, Math.floor(options.defaultTopK ?? 3));
    

libs/nous/llm/src/agent-communication.ts#

  • L263

    ts
    261      this.messageIdFactory =
    262        options.messageIdFactory ??
    263        (() => `msg-${this.now()}-${Math.random().toString(36).slice(2, 10)}`);
    264      this.subscriptionTokenFactory =
    265        options.subscriptionTokenFactory ??
    
  • L266

    ts
    264      this.subscriptionTokenFactory =
    265        options.subscriptionTokenFactory ??
    266        (() => `sub-${this.now()}-${Math.random().toString(36).slice(2, 10)}`);
    267      this.queueIdFactory =
    268        options.queueIdFactory ??
    
  • L269

    ts
    267      this.queueIdFactory =
    268        options.queueIdFactory ??
    269        (() => `q-${this.now()}-${Math.random().toString(36).slice(2, 10)}`);
    270      this.defaultType = options.defaultType ?? 'event';
    271      this.defaultPriority = options.defaultPriority ?? 'normal';
    

libs/nous/llm/src/agent-coordination.ts#

  • L296

    ts
    294      this.sessionIdFactory =
    295        options.sessionIdFactory ??
    296        (() => `coord-${this.now()}-${Math.random().toString(36).slice(2, 10)}`);
    297      this.actionIdFactory =
    298        options.actionIdFactory ??
    
  • L299

    ts
    297      this.actionIdFactory =
    298        options.actionIdFactory ??
    299        (() => `action-${this.now()}-${Math.random().toString(36).slice(2, 10)}`);
    300      this.decisionIdFactory =
    301        options.decisionIdFactory ??
    
  • L302

    ts
    300      this.decisionIdFactory =
    301        options.decisionIdFactory ??
    302        (() => `decision-${this.now()}-${Math.random().toString(36).slice(2, 10)}`);
    303      this.communicationHub =
    304        options.communicationHub ?? new AgentCommunicationHub({ now: this.now });
    

libs/nous/llm/src/agent-delegation.ts#

  • L329

    ts
    327      this.delegationIdFactory =
    328        options.delegationIdFactory ??
    329        (() => `delegation-${this.now()}-${Math.random().toString(36).slice(2, 10)}`);
    330      this.communicationHub =
    331        options.communicationHub ?? new AgentCommunicationHub({ now: this.now });
    
  • L1015

    ts
    1013      }
    1014      if (strategy === 'random') {
    1015        const index = Math.floor(Math.random() * ranked.length);
    1016        return ranked[index];
    1017      }
    

libs/nous/llm/src/agent-memory.ts#

  • L346

    ts
    344      this.now = options.now ?? (() => Date.now());
    345      this.idFactory =
    346        options.idFactory ?? (() => `memory-${this.now()}-${Math.random().toString(36).slice(2, 9)}`);
    347      this.defaultType = options.defaultType ?? 'working';
    348      this.defaultCategory = options.defaultCategory ?? 'observation';
    

libs/nous/llm/src/agent-supervision.ts#

  • L361

    ts
    359      this.signalIdFactory =
    360        options.signalIdFactory ??
    361        (() => `signal-${this.now()}-${Math.random().toString(36).slice(2, 10)}`);
    362      this.incidentIdFactory =
    363        options.incidentIdFactory ??
    
  • L364

    ts
    362      this.incidentIdFactory =
    363        options.incidentIdFactory ??
    364        (() => `incident-${this.now()}-${Math.random().toString(36).slice(2, 10)}`);
    365      this.communicationHub =
    366        options.communicationHub ?? new AgentCommunicationHub({ now: this.now });
    

libs/nous/llm/src/episodic-memory.ts#

  • L375

    ts
    373      this.idFactory =
    374        options.idFactory ??
    375        (() => `episode-${this.now()}-${Math.random().toString(36).slice(2, 9)}`);
    376      this.maxEpisodes = normalizePositive(options.maxEpisodes, 2_000, 'maxEpisodes');
    377      this.defaultImportance = normalizeProbability(
    

libs/nous/llm/src/error-recovery.ts#

  • L328

    ts
    326    constructor(options: ErrorRecoveryModuleOptions = {}) {
    327      this.now = options.now ?? (() => Date.now());
    328      this.rng = options.rng ?? (() => Math.random());
    329
    330      let counter = 0;
    

libs/nous/llm/src/long-term-memory.ts#

  • L427

    ts
    425      this.now = options.now ?? (() => Date.now());
    426      this.idFactory =
    427        options.idFactory ?? (() => `ltm-${this.now()}-${Math.random().toString(36).slice(2, 9)}`);
    428      this.maxEntries = normalizePositive(options.maxEntries, 5_000, 'maxEntries');
    429      this.maxTokens = normalizePositive(options.maxTokens, 250_000, 'maxTokens');
    

libs/nous/llm/src/multi-agent-systems.ts#

  • L292

    ts
    290      this.taskIdFactory =
    291        options.taskIdFactory ??
    292        (() => `multi-task-${this.now()}-${Math.random().toString(36).slice(2, 10)}`);
    293      this.communicationHub =
    294        options.communicationHub ??
    

libs/nous/llm/src/prompt-versioning.ts#

  • L263

    ts
    261      this.randomId =
    262        options.randomId ??
    263        (() => `${Math.random().toString(36).slice(2, 10)}${Math.random().toString(36).slice(2, 6)}`);
    264    }
    265
    

libs/nous/llm/src/semantic-memory.ts#

  • L440

    ts
    438      this.conceptIdFactory =
    439        options.conceptIdFactory ??
    440        (() => `concept-${this.now()}-${Math.random().toString(36).slice(2, 9)}`);
    441      this.relationIdFactory =
    442        options.relationIdFactory ??
    
  • L443

    ts
    441      this.relationIdFactory =
    442        options.relationIdFactory ??
    443        (() => `relation-${this.now()}-${Math.random().toString(36).slice(2, 9)}`);
    444      this.maxConcepts = normalizePositive(options.maxConcepts, 3_000, 'maxConcepts');
    445      this.maxRelations = normalizePositive(options.maxRelations, 12_000, 'maxRelations');
    

libs/nous/llm/src/short-term-memory.ts#

  • L315

    ts
    313      this.now = options.now ?? (() => Date.now());
    314      this.idFactory =
    315        options.idFactory ?? (() => `stm-${this.now()}-${Math.random().toString(36).slice(2, 9)}`);
    316      this.maxEntries = normalizePositive(options.maxEntries, 80, 'maxEntries');
    317      this.maxTokens = normalizePositive(options.maxTokens, 8192, 'maxTokens');
    

libs/nous/llm/src/tool-selection.ts#

  • L305

    ts
    303    constructor(options: ToolSelectionModuleOptions = {}) {
    304      this.now = options.now ?? (() => Date.now());
    305      this.rng = options.rng ?? (() => Math.random());
    306      this.defaultPolicy = options.defaultPolicy ?? 'balanced';
    307      this.defaultTopK = Math.max(1, Math.floor(options.defaultTopK ?? 3));
    

libs/nous/llm/src/working-memory.ts#

  • L350

    ts
    348      this.now = options.now ?? (() => Date.now());
    349      this.slotIdFactory =
    350        options.slotIdFactory ?? (() => `wm-${this.now()}-${Math.random().toString(36).slice(2, 9)}`);
    351      this.maxSlots = normalizePositive(options.maxSlots, 128, 'maxSlots');
    352      this.maxTokens = normalizePositive(options.maxTokens, 12_000, 'maxTokens');
    

libs/nous/training/src/adapter-tuning.ts#

  • L609

    ts
    607    constructor(options: AdapterTuningOptions = {}) {
    608      this.now = options.now ?? (() => Date.now());
    609      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    610      this.instructionTuning = new InstructionTuning({
    611        now: this.now,
    

libs/nous/training/src/best-of-n-sampling.ts#

  • L571

    ts
    569    constructor(options: BestOfNSamplingOptions = {}) {
    570      this.now = options.now ?? (() => Date.now());
    571      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    572    }
    573
    

libs/nous/training/src/bradley-terry-model.ts#

  • L191

    ts
    189    constructor(options: BradleyTerryModelOptions = {}) {
    190      this.now = options.now ?? (() => Date.now());
    191      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    192    }
    193
    

libs/nous/training/src/catastrophic-forgetting-prevention.ts#

  • L875

    ts
    873    constructor(options: CatastrophicForgettingPreventionOptions = {}) {
    874      this.now = options.now ?? (() => Date.now());
    875      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    876      this.instructionTuning = new InstructionTuning({
    877        now: this.now,
    

libs/nous/training/src/chat-fine-tuning.ts#

  • L442

    ts
    440    constructor(options: ChatFineTuningOptions = {}) {
    441      this.now = options.now ?? (() => Date.now());
    442      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    443      this.instructionTuning = new InstructionTuning({
    444        now: this.now,
    

libs/nous/training/src/checkpoint-management.ts#

  • L366

    ts
    364    constructor(options: CheckpointManagementOptions = {}) {
    365      this.now = options.now ?? (() => Date.now());
    366      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    367      this.defaultStorageBackend = normalizeStorage(options.defaultStorageBackend, 'local');
    368      this.defaultFormat = normalizeFormat(options.defaultFormat, 'safetensors');
    

libs/nous/training/src/combined-diffusion-acceleration-stack.ts#

  • L462

    ts
    460    public constructor(options: CombinedAccelerationOptions = {}) {
    461      this.now = options.now ?? (() => Date.now());
    462      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    463      this.deepCache = createDeepCacheTrainingFreeAcceleration({
    464        now: this.now,
    

libs/nous/training/src/comparison-data-collection.ts#

  • L324

    ts
    322    constructor(options: ComparisonDataCollectionOptions = {}) {
    323      this.now = options.now ?? (() => Date.now());
    324      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    325    }
    326
    

libs/nous/training/src/concept-sliders-training.ts#

  • L479

    ts
    477    public constructor(options: ConceptSliderTrainingOptions = {}) {
    478      this.now = options.now ?? Date.now;
    479      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    480      this.lora = new LoRAFineTuning({ now: this.now, randomId: this.randomId });
    481    }
    

libs/nous/training/src/consistency-model-inference.ts#

  • L399

    ts
    397    public constructor(options: ConsistencyModelInferenceOptions = {}) {
    398      this.now = options.now ?? Date.now;
    399      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    400    }
    401
    

libs/nous/training/src/consistency-model-training.ts#

  • L934

    ts
    932    constructor(options: ConsistencyModelTrainingOptions = {}) {
    933      this.now = options.now ?? (() => Date.now());
    934      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    935    }
    936
    

libs/nous/training/src/consistency-training-data-pipeline.ts#

  • L400

    ts
    398    constructor(options: ConsistencyTrainingDataPipelineOptions = {}) {
    399      this.now = options.now ?? (() => Date.now());
    400      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    401    }
    402
    

libs/nous/training/src/constitutional-ai.ts#

  • L600

    ts
    598    constructor(options: ConstitutionalTrainingOptions = {}) {
    599      this.now = options.now ?? (() => Date.now());
    600      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    601    }
    602
    

libs/nous/training/src/continual-learning.ts#

  • L510

    ts
    508    constructor(options: ContinualLearningOptions = {}) {
    509      this.now = options.now ?? (() => Date.now());
    510      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    511      this.instructionTuning = new InstructionTuning({
    512        now: this.now,
    

libs/nous/training/src/curriculum-learning.ts#

  • L677

    ts
    675    constructor(options: CurriculumLearningOptions = {}) {
    676      this.now = options.now ?? (() => Date.now());
    677      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    678      this.instructionTuning = new InstructionTuning({
    679        now: this.now,
    

libs/nous/training/src/deepcache-training-free-acceleration.ts#

  • L694

    ts
    692    public constructor(options: DeepCacheTrainingFreeAccelerationOptions = {}) {
    693      this.now = options.now ?? (() => Date.now());
    694      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    695    }
    696
    

libs/nous/training/src/demofusion-progressive-upscaling.ts#

  • L481

    ts
    479    public constructor(options: DemoFusionProgressiveUpscalingOptions = {}) {
    480      this.now = options.now ?? Date.now;
    481      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    482    }
    483
    

libs/nous/training/src/diffusion-acceleration-benchmark.ts#

  • L493

    ts
    491      this.now = options.now ?? (() => Date.now());
    492      this.randomId =
    493        options.randomId ?? (() => `accel-bench-${Math.random().toString(36).slice(2, 10)}`);
    494    }
    495
    

libs/nous/training/src/diffusion-boft-training.ts#

  • L1027

    ts
    1025    constructor(options: DiffusionBOFTOptions = {}) {
    1026      this.now = options.now ?? (() => Date.now());
    1027      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    1028      this.instructionTuning = new InstructionTuning({
    1029        now: this.now,
    

libs/nous/training/src/diffusion-curriculum-dpo.ts#

  • L956

    ts
    954    public constructor(options: DiffusionCurriculumDPOOptions = {}) {
    955      this.now = options.now ?? Date.now;
    956      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    957    }
    958
    

libs/nous/training/src/diffusion-dora-training.ts#

  • L1035

    ts
    1033    constructor(options: DiffusionDoRAOptions = {}) {
    1034      this.now = options.now ?? (() => Date.now());
    1035      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    1036      this.instructionTuning = new InstructionTuning({
    1037        now: this.now,
    

libs/nous/training/src/diffusion-dpo-training.ts#

  • L802

    ts
    800    public constructor(options: DiffusionDPOTrainingOptions = {}) {
    801      this.now = options.now ?? (() => Date.now());
    802      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    803    }
    804
    

libs/nous/training/src/diffusion-lokr-training.ts#

  • L1044

    ts
    1042    constructor(options: DiffusionLoKrOptions = {}) {
    1043      this.now = options.now ?? (() => Date.now());
    1044      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    1045      this.instructionTuning = new InstructionTuning({
    1046        now: this.now,
    

libs/nous/training/src/diffusion-oft-training.ts#

  • L1040

    ts
    1038    constructor(options: DiffusionOFTOptions = {}) {
    1039      this.now = options.now ?? (() => Date.now());
    1040      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    1041      this.instructionTuning = new InstructionTuning({
    1042        now: this.now,
    

libs/nous/training/src/diffusion-preference-dataset-preparation.ts#

  • L579

    ts
    577      this.now = options.now ?? (() => Date.now());
    578      this.randomId =
    579        options.randomId ?? (() => `diffusion-pref-${Math.random().toString(36).slice(2, 10)}`);
    580    }
    581
    

libs/nous/training/src/diffusion-rich-preference-optimization.ts#

  • L607

    ts
    605      this.now = options.now ?? (() => Date.now());
    606      this.randomId =
    607        options.randomId ?? (() => `diffusion-rpo-${Math.random().toString(36).slice(2, 10)}`);
    608    }
    609
    

libs/nous/training/src/diffusion-spo-training.ts#

  • L467

    ts
    465      this.now = options.now ?? (() => Date.now());
    466      this.randomId =
    467        options.randomId ?? (() => `diffusion-spo-${Math.random().toString(36).slice(2, 10)}`);
    468    }
    469
    

libs/nous/training/src/dora-tuning.ts#

  • L436

    ts
    434    constructor(options: DoRATuningOptions = {}) {
    435      this.now = options.now ?? (() => Date.now());
    436      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    437      this.loraTuning = new LoRAFineTuning({
    438        now: this.now,
    

libs/nous/training/src/dpo-training.ts#

  • L580

    ts
    578    constructor(options: DPOTrainingOptions = {}) {
    579      this.now = options.now ?? (() => Date.now());
    580      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    581    }
    582
    

libs/nous/training/src/fault-tolerance.ts#

  • L343

    ts
    341    constructor(options: FaultToleranceOptions = {}) {
    342      this.now = options.now ?? (() => Date.now());
    343      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    344      this.defaultMaxRetries = normalizeIntegerRange(
    345        options.defaultMaxRetries,
    

libs/nous/training/src/few-step-generation-quality-benchmark.ts#

  • L734

    ts
    732    constructor(options: FewStepGenerationQualityBenchmarkOptions = {}) {
    733      this.now = options.now ?? (() => Date.now());
    734      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    735    }
    736
    

libs/nous/training/src/flow-matching-lcm-lora.ts#

  • L1383

    ts
    1381    public constructor(options: FlowMatchingLCMLoRAOptions = {}) {
    1382      this.now = options.now ?? (() => Date.now());
    1383      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    1384    }
    1385
    

libs/nous/training/src/flow-matching-progressive-score-distillation.ts#

  • L962

    ts
    960    public constructor(options: FlowMatchingScoreDistillationOptions = {}) {
    961      this.now = options.now ?? Date.now;
    962      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    963    }
    964
    

libs/nous/training/src/flow-matching-scheduler-optimization.ts#

  • L705

    ts
    703      this.now = options.now ?? (() => Date.now());
    704      this.randomId =
    705        options.randomId ?? (() => `flow-solver-${Math.random().toString(36).slice(2, 10)}`);
    706    }
    707
    

libs/nous/training/src/flux-distilled-model-deployment.ts#

  • L959

    ts
    957      this.randomId =
    958        options.randomId ??
    959        (() => `flux-distilled-deploy-${Math.random().toString(36).slice(2, 10)}`);
    960    }
    961
    

libs/nous/training/src/flux-distilled-model-quality-comparison.ts#

  • L665

    ts
    663      this.now = options.now ?? (() => Date.now());
    664      this.randomId =
    665        options.randomId ?? (() => `flux-distill-${Math.random().toString(36).slice(2, 10)}`);
    666    }
    667
    

libs/nous/training/src/flux-dpo-training.ts#

  • L645

    ts
    643    public constructor(options: FluxDPOTrainingOptions = {}) {
    644      this.now = options.now ?? Date.now;
    645      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    646    }
    647
    

libs/nous/training/src/fora-attention-reuse-temporal-acceleration.ts#

  • L705

    ts
    703    public constructor(options: ForaTemporalOptions = {}) {
    704      this.now = options.now ?? (() => Date.now());
    705      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    706    }
    707
    

libs/nous/training/src/freefuse-multi-lora-routing.ts#

  • L367

    ts
    365    public constructor(options: FreeFuseMultiLoRARoutingOptions = {}) {
    366      this.now = options.now ?? Date.now;
    367      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    368      this.unifiedLoader = new UnifiedAdapterLoading({
    369        now: this.now,
    

libs/nous/training/src/freeu-skip-backbone-boosting.ts#

  • L384

    ts
    382    public constructor(options: FreeUOptions = {}) {
    383      this.now = options.now ?? (() => Date.now());
    384      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    385    }
    386
    

libs/nous/training/src/harmlessness-training.ts#

  • L567

    ts
    565    constructor(options: HarmlessnessTrainingOptions = {}) {
    566      this.now = options.now ?? (() => Date.now());
    567      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    568    }
    569
    

libs/nous/training/src/helpfulness-training.ts#

  • L592

    ts
    590    constructor(options: HelpfulnessTrainingOptions = {}) {
    591      this.now = options.now ?? (() => Date.now());
    592      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    593    }
    594
    

libs/nous/training/src/hidiffusion-training-free-high-resolution-generation.ts#

  • L583

    ts
    581    public constructor(options: HiDiffusionOptions = {}) {
    582      this.now = options.now ?? Date.now;
    583      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    584    }
    585
    

libs/nous/training/src/high-resolution-quality-validation.ts#

  • L351

    ts
    349
    350    public constructor(options: HighResolutionQualityValidationOptions = {}) {
    351      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    352    }
    353
    

libs/nous/training/src/honesty-training.ts#

  • L586

    ts
    584    constructor(options: HonestyTrainingOptions = {}) {
    585      this.now = options.now ?? (() => Date.now());
    586      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    587    }
    588
    

libs/nous/training/src/ia3-tuning.ts#

  • L507

    ts
    505    constructor(options: IA3TuningOptions = {}) {
    506      this.now = options.now ?? (() => Date.now());
    507      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    508      this.instructionTuning = new InstructionTuning({
    509        now: this.now,
    

libs/nous/training/src/instruction-tuning.ts#

  • L320

    ts
    318    constructor(options: InstructionTuningOptions = {}) {
    319      this.now = options.now ?? (() => Date.now());
    320      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    321      this.sft = new SupervisedFineTuning({
    322        now: this.now,
    

libs/nous/training/src/ipo-training.ts#

  • L546

    ts
    544    constructor(options: IPOTrainingOptions = {}) {
    545      this.now = options.now ?? (() => Date.now());
    546      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    547    }
    548
    

libs/nous/training/src/iterative-refinement.ts#

  • L490

    ts
    488    constructor(options: IterativeRefinementOptions = {}) {
    489      this.now = options.now ?? (() => Date.now());
    490      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    491    }
    492
    

libs/nous/training/src/knowledge-distillation.ts#

  • L614

    ts
    612    constructor(options: KnowledgeDistillationOptions = {}) {
    613      this.now = options.now ?? (() => Date.now());
    614      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    615      this.instructionTuning = new InstructionTuning({
    616        now: this.now,
    

libs/nous/training/src/kto-training.ts#

  • L581

    ts
    579    constructor(options: KTOTrainingOptions = {}) {
    580      this.now = options.now ?? (() => Date.now());
    581      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    582    }
    583
    

libs/nous/training/src/lcm-lora-training.ts#

  • L951

    ts
    949    public constructor(options: LCMLoRAOptions = {}) {
    950      this.now = options.now ?? (() => Date.now());
    951      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    952    }
    953
    

libs/nous/training/src/lora-composition-visualization.ts#

  • L632

    ts
    630    public constructor(options: LoRACompositionVisualizationOptions = {}) {
    631      this.now = options.now ?? Date.now;
    632      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    633      this.loader = new UnifiedAdapterLoading({ now: this.now, randomId: this.randomId });
    634      this.conflictDetection = new LoRAConflictDetection({ now: this.now, randomId: this.randomId });
    

libs/nous/training/src/lora-conflict-detection.ts#

  • L958

    ts
    956    public constructor(options: LoRAConflictDetectionOptions = {}) {
    957      this.now = options.now ?? Date.now;
    958      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    959      this.loader = new UnifiedAdapterLoading({ now: this.now, randomId: this.randomId });
    960    }
    

libs/nous/training/src/lora-fine-tuning.ts#

  • L550

    ts
    548    constructor(options: LoRAFineTuningOptions = {}) {
    549      this.now = options.now ?? (() => Date.now());
    550      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    551      this.instructionTuning = new InstructionTuning({
    552        now: this.now,
    

libs/nous/training/src/lora-semantic-registry.ts#

  • L489

    ts
    487    public constructor(options: LoRASemanticRegistryOptions = {}) {
    488      this.now = options.now ?? Date.now;
    489      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    490      this.loading = new UnifiedAdapterLoading({ now: this.now, randomId: this.randomId });
    491    }
    

libs/nous/training/src/lora-variant-comparison.ts#

  • L450

    ts
    448    constructor(options: LoRAVariantComparisonOptions = {}) {
    449      this.now = options.now ?? (() => Date.now());
    450      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    451    }
    452
    

libs/nous/training/src/lycoris-framework-integration.ts#

  • L1438

    ts
    1436    constructor(options: LyCORISFrameworkIntegrationOptions = {}) {
    1437      this.now = options.now ?? (() => Date.now());
    1438      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    1439      this.instructionTuning = new InstructionTuning({
    1440        now: this.now,
    

libs/nous/training/src/multi-lora-weight-interpolation.ts#

  • L288

    ts
    286    public constructor(options: MultiLoRAWeightInterpolationOptions = {}) {
    287      this.now = options.now ?? Date.now;
    288      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    289      this.loader = new UnifiedAdapterLoading({ now: this.now, randomId: this.randomId });
    290    }
    

libs/nous/training/src/multi-scale-generation-pipeline.ts#

  • L478

    ts
    476    public constructor(options: MultiScaleGenerationOptions = {}) {
    477      this.now = options.now ?? Date.now;
    478      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    479    }
    480
    

libs/nous/training/src/multi-task-fine-tuning.ts#

  • L518

    ts
    516    constructor(options: MultiTaskFineTuningOptions = {}) {
    517      this.now = options.now ?? (() => Date.now());
    518      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    519      this.instructionTuning = new InstructionTuning({
    520        now: this.now,
    

libs/nous/training/src/orpo-training.ts#

  • L567

    ts
    565    constructor(options: ORPOTrainingOptions = {}) {
    566      this.now = options.now ?? (() => Date.now());
    567      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    568    }
    569
    

libs/nous/training/src/p-tuning.ts#

  • L569

    ts
    567    constructor(options: PTuningOptions = {}) {
    568      this.now = options.now ?? (() => Date.now());
    569      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    570      this.instructionTuning = new InstructionTuning({
    571        now: this.now,
    

libs/nous/training/src/peft-integration.ts#

  • L155

    ts
    153    constructor(options: PeftIntegrationOptions = {}) {
    154      this.now = options.now ?? (() => Date.now());
    155      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    156      const sharedOptions = { now: this.now, randomId: this.randomId };
    157
    

libs/nous/training/src/ppo-training.ts#

  • L318

    ts
    316    constructor(options: PPOTrainingOptions = {}) {
    317      this.now = options.now ?? (() => Date.now());
    318      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    319    }
    320
    

libs/nous/training/src/preference-aligned-inference.ts#

  • L369

    ts
    367    public constructor(options: PreferenceAlignedInferenceOptions = {}) {
    368      this.now = options.now ?? Date.now;
    369      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    370    }
    371
    

libs/nous/training/src/preference-learning.ts#

  • L505

    ts
    503    constructor(options: PreferenceLearningOptions = {}) {
    504      this.now = options.now ?? (() => Date.now());
    505      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    506      this.rewardModeling = new RewardModeling({
    507        now: this.now,
    

libs/nous/training/src/prefix-tuning.ts#

  • L512

    ts
    510    constructor(options: PrefixTuningOptions = {}) {
    511      this.now = options.now ?? (() => Date.now());
    512      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    513      this.instructionTuning = new InstructionTuning({
    514        now: this.now,
    

libs/nous/training/src/progressive-few-step-refinement.ts#

  • L613

    ts
    611    constructor(options: ProgressiveFewStepRefinementOptions = {}) {
    612      this.now = options.now ?? (() => Date.now());
    613      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    614      this.backendUsage = new Map(
    615        PROGRESSIVE_FEW_STEP_REFINEMENT_BACKENDS.map((backend) => [backend, 0])
    

libs/nous/training/src/progressive-training.ts#

  • L623

    ts
    621    constructor(options: ProgressiveTrainingOptions = {}) {
    622      this.now = options.now ?? (() => Date.now());
    623      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    624      this.instructionTuning = new InstructionTuning({
    625        now: this.now,
    

libs/nous/training/src/prompt-tuning.ts#

  • L443

    ts
    441    constructor(options: PromptTuningOptions = {}) {
    442      this.now = options.now ?? (() => Date.now());
    443      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    444      this.instructionTuning = new InstructionTuning({
    445        now: this.now,
    

libs/nous/training/src/pyramid-attention-broadcast-video-acceleration.ts#

  • L632

    ts
    630    public constructor(options: PabVideoAccelerationOptions = {}) {
    631      this.now = options.now ?? (() => Date.now());
    632      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    633    }
    634
    

libs/nous/training/src/qlora-fine-tuning.ts#

  • L458

    ts
    456    constructor(options: QLoRAFineTuningOptions = {}) {
    457      this.now = options.now ?? (() => Date.now());
    458      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    459      this.loraFineTuning = new LoRAFineTuning({
    460        now: this.now,
    

libs/nous/training/src/red-teaming.ts#

  • L775

    ts
    773    constructor(options: RedTeamingOptions = {}) {
    774      this.now = options.now ?? (() => Date.now());
    775      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    776    }
    777
    

libs/nous/training/src/rejection-sampling.ts#

  • L593

    ts
    591    constructor(options: RejectionSamplingOptions = {}) {
    592      this.now = options.now ?? (() => Date.now());
    593      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    594    }
    595
    

libs/nous/training/src/resolution-adaptive-inference.ts#

  • L451

    ts
    449    public constructor(options: ResolutionAdaptiveInferenceOptions = {}) {
    450      this.now = options.now ?? Date.now;
    451      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    452    }
    453
    

libs/nous/training/src/reward-modeling.ts#

  • L539

    ts
    537    constructor(options: RewardModelingOptions = {}) {
    538      this.now = options.now ?? (() => Date.now());
    539      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    540      this.instructionTuning = new InstructionTuning({
    541        now: this.now,
    

libs/nous/training/src/rlaif.ts#

  • L513

    ts
    511    constructor(options: RlaifOptions = {}) {
    512      this.now = options.now ?? (() => Date.now());
    513      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    514    }
    515
    

libs/nous/training/src/safety-training.ts#

  • L557

    ts
    555    constructor(options: SafetyTrainingOptions = {}) {
    556      this.now = options.now ?? (() => Date.now());
    557      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    558    }
    559
    

libs/nous/training/src/sageattention-diffusion-integration.ts#

  • L526

    ts
    524    public constructor(options: SageAttentionOptions = {}) {
    525      this.now = options.now ?? (() => Date.now());
    526      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    527    }
    528
    

libs/nous/training/src/scot-training.ts#

  • L1350

    ts
    1348    public constructor(options: SCoTOptions = {}) {
    1349      this.now = options.now ?? (() => Date.now());
    1350      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    1351    }
    1352
    

libs/nous/training/src/self-distillation.ts#

  • L564

    ts
    562    constructor(options: SelfDistillationOptions = {}) {
    563      this.now = options.now ?? (() => Date.now());
    564      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    565      this.distillation = new KnowledgeDistillation({
    566        now: this.now,
    

libs/nous/training/src/self-play-training.ts#

  • L498

    ts
    496    constructor(options: SelfPlayTrainingOptions = {}) {
    497      this.now = options.now ?? (() => Date.now());
    498      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    499    }
    500
    

libs/nous/training/src/senseflow-flow-matching-distillation.ts#

  • L1061

    ts
    1059    public constructor(options: SenseFlowDistillationOptions = {}) {
    1060      this.now = options.now ?? Date.now;
    1061      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    1062    }
    1063
    

libs/nous/training/src/streamdiffusion-batch-of-one-optimization.ts#

  • L287

    ts
    285    public constructor(options: StreamDiffusionBatchOfOneOptimizationOptions = {}) {
    286      this.now = options.now ?? (() => Date.now());
    287      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    288      this.realtimePipeline = createStreamDiffusionRealtimeGenerationPipeline({
    289        now: this.now,
    

libs/nous/training/src/streamdiffusion-io-streaming.ts#

  • L306

    ts
    304    public constructor(options: StreamDiffusionIoStreamingOptions = {}) {
    305      this.now = options.now ?? (() => Date.now());
    306      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    307      this.realtimePipeline = createStreamDiffusionRealtimeGenerationPipeline({
    308        now: this.now,
    

libs/nous/training/src/streamdiffusion-realtime-controlnet.ts#

  • L671

    ts
    669    public constructor(options: StreamDiffusionRealtimeControlNetOptions = {}) {
    670      this.now = options.now ?? (() => Date.now());
    671      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    672      this.realtimePipeline = createStreamDiffusionRealtimeGenerationPipeline({
    673        now: this.now,
    

libs/nous/training/src/streamdiffusion-realtime-generation-pipeline.ts#

  • L561

    ts
    559    constructor(options: StreamDiffusionRealtimePipelineOptions = {}) {
    560      this.now = options.now ?? (() => Date.now());
    561      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    562    }
    563
    

libs/nous/training/src/streamdiffusion-realtime-style-transfer.ts#

  • L451

    ts
    449    public constructor(options: StreamDiffusionRealtimeStyleTransferOptions = {}) {
    450      this.now = options.now ?? (() => Date.now());
    451      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    452      this.realtimePipeline = createStreamDiffusionRealtimeGenerationPipeline({
    453        now: this.now,
    

libs/nous/training/src/streamdiffusion-residual-denoising.ts#

  • L320

    ts
    318    public constructor(options: StreamDiffusionResidualDenoisingOptions = {}) {
    319      this.now = options.now ?? (() => Date.now());
    320      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    321      this.realtimePipeline = createStreamDiffusionRealtimeGenerationPipeline({
    322        now: this.now,
    

libs/nous/training/src/streamdiffusion-vram-optimization.ts#

  • L483

    ts
    481    public constructor(options: StreamDiffusionVramOptimizationOptions = {}) {
    482      this.now = options.now ?? (() => Date.now());
    483      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    484      this.realtimePipeline = createStreamDiffusionRealtimeGenerationPipeline({
    485        now: this.now,
    

libs/nous/training/src/supervised-fine-tuning.ts#

  • L312

    ts
    310    constructor(options: SupervisedFineTuningOptions = {}) {
    311      this.now = options.now ?? (() => Date.now());
    312      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    313    }
    314
    

libs/nous/training/src/teacher-student-training.ts#

  • L528

    ts
    526    constructor(options: TeacherStudentTrainingOptions = {}) {
    527      this.now = options.now ?? (() => Date.now());
    528      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    529      this.distillation = new KnowledgeDistillation({
    530        now: this.now,
    

libs/nous/training/src/tiled-diffusion-overlap-blending.ts#

  • L484

    ts
    482    public constructor(options: TiledDiffusionOptions = {}) {
    483      this.now = options.now ?? Date.now;
    484      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    485    }
    486
    

libs/nous/training/src/token-merging-diffusion-acceleration.ts#

  • L397

    ts
    395    public constructor(options: TokenMergingOptions = {}) {
    396      this.now = options.now ?? (() => Date.now());
    397      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    398    }
    399
    

libs/nous/training/src/unified-adapter-loading.ts#

  • L526

    ts
    524    public constructor(options: UnifiedAdapterLoadingOptions = {}) {
    525      this.now = options.now ?? Date.now;
    526      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 10));
    527    }
    528
    

libs/nous/vision/src/dreambooth-training.ts#

  • L252

    ts
    250    constructor(options: DreamBoothTrainingOptions = {}) {
    251      this.now = options.now ?? (() => Date.now());
    252      this.randomId = options.randomId ?? (() => Math.random().toString(36).slice(2, 12));
    253      this.framework = options.framework ?? new DiffusionModelFramework({ now: this.now });
    254      this.defaultOutputCount = normalizePositiveInteger(
    

libs/nyx/audio/sonification/src/sonification.ts#

  • L586

    ts
    584    } else if (periodDays <= 0 || rhythm.waveformShape === 'irregular') {
    585      // Random period for irregular variables
    586      audioPeriod = 500 + Math.random() * 2000;
    587    } else {
    588      // Scale days to reasonable audio period (200ms to 5000ms)
    

libs/nyx/catalogs/deep-sky/messier/src/index.ts#

  • L631

    ts
    629     */
    630    getRandom(): MessierObject {
    631      const index = Math.floor(Math.random() * this.objects.length);
    632      return this.objects[index];
    633    }
    
  • L643

    ts
    641      }
    642
    643      const shuffled = [...this.objects].sort(() => Math.random() - 0.5);
    644      return shuffled.slice(0, count);
    645    }
    

libs/nyx/catalogs/deep-sky/pulsars/src/index.ts#

  • L210

    ts
    208     */
    209    getRandom(): Pulsar {
    210      const index = Math.floor(Math.random() * ALL_PULSARS.length);
    211      return ALL_PULSARS[index];
    212    }
    
  • L218

    ts
    216     */
    217    getRandomSample(count: number): readonly Pulsar[] {
    218      const shuffled = [...ALL_PULSARS].sort(() => Math.random() - 0.5);
    219      return shuffled.slice(0, Math.min(count, shuffled.length));
    220    }
    

libs/nyx/catalogs/deep-sky/snr/src/index.ts#

  • L690

    ts
    688     */
    689    getRandom(): SupernovaRemnant {
    690      const index = Math.floor(Math.random() * ALL_SNRS.length);
    691      return ALL_SNRS[index];
    692    }
    
  • L698

    ts
    696     */
    697    getRandomSample(count: number): SupernovaRemnant[] {
    698      const shuffled = [...ALL_SNRS].sort(() => Math.random() - 0.5);
    699      return shuffled.slice(0, Math.min(count, ALL_SNRS.length));
    700    }
    

libs/nyx/catalogs/star-query/src/deduplication.ts#

  • L591

    ts
    589
    590    // Generate random ID as fallback
    591    return `merged:${Date.now()}:${Math.random().toString(36).slice(2, 8)}`;
    592  }
    593
    

libs/nyx/catalogs/supernovae/src/historical.ts#

  • L2246

    ts
    2244     */
    2245    getRandom(): HistoricalSupernova {
    2246      const index = Math.floor(Math.random() * HISTORICAL_SUPERNOVAE.length);
    2247      return HISTORICAL_SUPERNOVAE[index];
    2248    }
    
  • L2254

    ts
    2252     */
    2253    getRandomSample(count: number): HistoricalSupernova[] {
    2254      const shuffled = [...HISTORICAL_SUPERNOVAE].sort(() => Math.random() - 0.5);
    2255      return shuffled.slice(0, Math.min(count, HISTORICAL_SUPERNOVAE.length));
    2256    }
    

libs/nyx/education/quiz-system/src/feedback.ts#

  • L483

    ts
    481          'Perfect! ',
    482        ];
    483        const prefix = encouragements[Math.floor(Math.random() * encouragements.length)];
    484        return prefix + feedback;
    485      } else {
    
  • L492

    ts
    490          'Keep at it! ',
    491        ];
    492        const prefix = softenings[Math.floor(Math.random() * softenings.length)];
    493        return prefix + feedback;
    494      }
    

libs/nyx/education/quiz-system/src/quiz-service.ts#

  • L760

    ts
    758      const result = [...array];
    759      for (let i = result.length - 1; i > 0; i--) {
    760        const j = Math.floor(Math.random() * (i + 1));
    761        [result[i], result[j]] = [result[j], result[i]];
    762      }
    

libs/nyx/education/quiz-system/src/state.ts#

  • L843

    ts
    841     */
    842    private generateAttemptId(): string {
    843      return `attempt-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    844    }
    845
    
  • L866

    ts
    864      const result = [...array];
    865      for (let i = result.length - 1; i > 0; i--) {
    866        const j = Math.floor(Math.random() * (i + 1));
    867        [result[i], result[j]] = [result[j], result[i]];
    868      }
    

libs/nyx/integrations/stellarium/src/utils.ts#

  • L382

    ts
    380    // Fallback implementation
    381    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    382      const r = (Math.random() * 16) | 0;
    383      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    384      return v.toString(16);
    

libs/nyx/integrations/telescope/src/alpaca-client.ts#

  • L247

    ts
    245        port: config.port ?? 11111,
    246        apiVersion: config.apiVersion ?? 1,
    247        clientId: config.clientId ?? Math.floor(Math.random() * 65536),
    248      };
    249      this.deviceNumber = deviceNumber;
    

libs/nyx/lilith-integration/src/lilith-integration.ts#

  • L847

    ts
    845   */
    846  export function getRandomVisualization(): CosmicVisualization {
    847    const index = Math.floor(Math.random() * COSMIC_VISUALIZATIONS.length);
    848    return COSMIC_VISUALIZATIONS[index];
    849  }
    
  • L895

    ts
    893   */
    894  export function getRandomParallel(): SpaceParallel {
    895    const index = Math.floor(Math.random() * SPACE_PARALLELS.length);
    896    return SPACE_PARALLELS[index];
    897  }
    
  • L986

    ts
    984      ...SPACE_PARALLELS.map((p) => p.scienceFact),
    985    ];
    986    const index = Math.floor(Math.random() * allFacts.length);
    987    return allFacts[index];
    988  }
    

libs/nyx/orbital/src/n-body.ts#

  • L1888

    ts
    1886      let x, y, z;
    1887      do {
    1888        x = (Math.random() * 2 - 1) * radius;
    1889        y = (Math.random() * 2 - 1) * radius;
    1890        z = (Math.random() * 2 - 1) * radius;
    
  • L1889

    ts
    1887      do {
    1888        x = (Math.random() * 2 - 1) * radius;
    1889        y = (Math.random() * 2 - 1) * radius;
    1890        z = (Math.random() * 2 - 1) * radius;
    1891      } while (x * x + y * y + z * z > radius * radius);
    
  • L1890

    ts
    1888        x = (Math.random() * 2 - 1) * radius;
    1889        y = (Math.random() * 2 - 1) * radius;
    1890        z = (Math.random() * 2 - 1) * radius;
    1891      } while (x * x + y * y + z * z > radius * radius);
    1892
    
  • L1918

    ts
    1916    // Assign random velocities
    1917    for (const body of bodies) {
    1918      const theta = Math.random() * 2 * Math.PI;
    1919      const phi = Math.acos(2 * Math.random() - 1);
    1920      const v = velocityScale * Math.random();
    
  • L1919

    ts
    1917    for (const body of bodies) {
    1918      const theta = Math.random() * 2 * Math.PI;
    1919      const phi = Math.acos(2 * Math.random() - 1);
    1920      const v = velocityScale * Math.random();
    1921
    
  • L1920

    ts
    1918      const theta = Math.random() * 2 * Math.PI;
    1919      const phi = Math.acos(2 * Math.random() - 1);
    1920      const v = velocityScale * Math.random();
    1921
    1922      body.velocity = {
    

libs/nyx/renderer/background/src/cmb.ts#

  • L1614

    ts
    1612
    1613      for (let i = 0; i < 1000; i++) {
    1614        const theta1 = Math.random() * PI;
    1615        const phi1 = Math.random() * TWO_PI - PI; // [-π, π]
    1616        const theta2 = theta1 + (Math.random() - 0.5) * angularScale;
    
  • L1615

    ts
    1613      for (let i = 0; i < 1000; i++) {
    1614        const theta1 = Math.random() * PI;
    1615        const phi1 = Math.random() * TWO_PI - PI; // [-π, π]
    1616        const theta2 = theta1 + (Math.random() - 0.5) * angularScale;
    1617        const phi2 = phi1 + (Math.random() - 0.5) * angularScale;
    
  • L1616

    ts
    1614        const theta1 = Math.random() * PI;
    1615        const phi1 = Math.random() * TWO_PI - PI; // [-π, π]
    1616        const theta2 = theta1 + (Math.random() - 0.5) * angularScale;
    1617        const phi2 = phi1 + (Math.random() - 0.5) * angularScale;
    1618
    
  • L1617

    ts
    1615        const phi1 = Math.random() * TWO_PI - PI; // [-π, π]
    1616        const theta2 = theta1 + (Math.random() - 0.5) * angularScale;
    1617        const phi2 = phi1 + (Math.random() - 0.5) * angularScale;
    1618
    1619        const pix1 = sphericalToPixel(theta1, phi1, map.width, map.height);
    

libs/nyx/renderer/hdr/src/tonemapping.ts#

  • L423

    ts
    421  export function applyDithering(color: HdrColor, bitDepth: number = 8): HdrColor {
    422    const levels = Math.pow(2, bitDepth) - 1;
    423    const noise = () => (Math.random() + Math.random() - 1) / levels;
    424
    425    return {
    

libs/nyx/renderer/post-processing/src/motion-blur.ts#

  • L299

    ts
    297
    298      for (let i = 1; i < samples.length - 1; i++) {
    299        const jitter = (Math.random() - 0.5) * jitterScale;
    300        samples[i].x += normPerpX * jitter;
    301        samples[i].y += normPerpY * jitter;
    

libs/nyx/renderer/stars/src/point-stars.ts#

  • L1106

    ts
    1104    for (let i = 0; i < count; i++) {
    1105      // Random position on celestial sphere
    1106      const ra = Math.random() * Math.PI * 2;
    1107      const dec = Math.asin(Math.random() * 2 - 1);
    1108
    
  • L1107

    ts
    1105      // Random position on celestial sphere
    1106      const ra = Math.random() * Math.PI * 2;
    1107      const dec = Math.asin(Math.random() * 2 - 1);
    1108
    1109      // Magnitude distribution (more faint stars)
    
  • L1111

    ts
    1109      // Magnitude distribution (more faint stars)
    1110      const magRange = maxMag - minMag;
    1111      const mag = minMag + Math.pow(Math.random(), 0.5) * magRange;
    1112
    1113      // Random temperature (hotter stars less common)
    
  • L1114

    ts
    1112
    1113      // Random temperature (hotter stars less common)
    1114      const temp = 3000 + Math.pow(Math.random(), 2) * 27000;
    1115
    1116      stars.push({
    

libs/oshun/analytics/src/client.ts#

  • L110

    ts
    108
    109  export function createEventId(): string {
    110    return `evt_${Math.random().toString(36).slice(2, 10)}`;
    111  }
    112
    

libs/oshun/auth/src/billing-store.ts#

  • L1512

    ts
    1510
    1511  function createBillingRequestId(): string {
    1512    return `${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
    1513  }
    

libs/oshun/auth/src/customer-support-history-store.ts#

  • L256

    ts
    254      const occurredAt = this.now().toISOString();
    255      const next: OshunCustomerSupportMessage = {
    256        id: `msg_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`,
    257        role: message.role,
    258        body: message.body.trim(),
    

libs/oshun/auth/src/data-rights-store.ts#

  • L315

    ts
    313
    314  export function createDataRightsRequestId(): string {
    315    return Math.random().toString(36).slice(2, 10);
    316  }
    317
    

libs/oshun/auth/src/privacy-store.ts#

  • L334

    ts
    332
    333  export function createConsentEventId(): string {
    334    return `consent_${Math.random().toString(36).slice(2, 10)}`;
    335  }
    336
    

libs/oshun/auth/src/sso-coordinator.ts#

  • L424

    ts
    422
    423  function createSsoSourceId(): string {
    424    return `sso-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
    425  }
    426
    

libs/oshun/domain-tara/src/ritual-completion-events.ts#

  • L185

    ts
    183      eventId:
    184        input.eventId ??
    185        `tara-ritual-completed-${ritualId}-${Date.parse(occurredAt).toString(36)}-${Math.random()
    186          .toString(36)
    187          .slice(2, 8)}`,
    

libs/oshun/domain-tara/src/ritual-scheduling.ts#

  • L491

    ts
    489
    490  function createPlanId(templateId: string): string {
    491    return `tara-ritual-plan-${templateId}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
    492  }
    493
    

libs/oshun/offline/src/queue.ts#

  • L16

    ts
    14      private readonly storage: OfflineStorage,
    15      private readonly now: () => Date = () => new Date(),
    16      private readonly randomId: () => string = () => Math.random().toString(36).slice(2, 10)
    17    ) {}
    18
    

libs/oshun/shell-assistant/src/iris-memory-bridge.ts#

  • L1343

    ts
    1341
    1342  function defaultIdFactory(kind: 'turn' | 'item'): string {
    1343    const rand = Math.random().toString(36).slice(2, 10);
    1344    return `${kind}_${Date.now().toString(36)}_${rand}`;
    1345  }
    

libs/oshun/shell-assistant/src/psyche-session-bridge.ts#

  • L560

    ts
    558
    559  function defaultIdFactory(kind: 'event'): string {
    560    const rand = Math.random().toString(36).slice(2, 10);
    561    return `${kind}_${Date.now().toString(36)}_${rand}`;
    562  }
    

libs/oshun/shell-assistant/src/types.ts#

  • L33

    ts
    31  export function createSessionId(): AssistantSessionId {
    32    const ts = Date.now().toString(36);
    33    const rand = Math.random().toString(36).substring(2, 10);
    34    return `asst_${ts}_${rand}` as AssistantSessionId;
    35  }
    
  • L149

    ts
    147  export function createTurnId(): AssistantTurnId {
    148    const ts = Date.now().toString(36);
    149    const rand = Math.random().toString(36).substring(2, 8);
    150    return `turn_${ts}_${rand}` as AssistantTurnId;
    151  }
    

libs/oshun/shell-desktop/src/types.ts#

  • L696

    ts
    694
    695  function nextId(prefix: string): string {
    696    return `${prefix}${Date.now().toString(36)}_${(idCounter++).toString(36)}_${Math.random().toString(36).slice(2, 6)}`;
    697  }
    698
    

libs/oshun/shell-routines/src/types.ts#

  • L421

    ts
    419  export function createRoutineId(): string {
    420    const ts = Date.now().toString(36);
    421    const rand = Math.random().toString(36).substring(2, 10);
    422    return `rtn_${ts}_${rand}`;
    423  }
    
  • L427

    ts
    425  export function createUserRoutineId(): string {
    426    const ts = Date.now().toString(36);
    427    const rand = Math.random().toString(36).substring(2, 10);
    428    return `urtn_${ts}_${rand}`;
    429  }
    
  • L433

    ts
    431  export function createExecutionId(): string {
    432    const ts = Date.now().toString(36);
    433    const rand = Math.random().toString(36).substring(2, 10);
    434    return `exec_${ts}_${rand}`;
    435  }
    
  • L439

    ts
    437  export function createStepId(): string {
    438    const ts = Date.now().toString(36);
    439    const rand = Math.random().toString(36).substring(2, 8);
    440    return `step_${ts}_${rand}`;
    441  }
    

libs/oya/core/src/advanced-pose-estimation.ts#

  • L3328

    ts
    3326      const alternatives = allActions
    3327        .filter((a) => a !== action)
    3328        .map((a) => ({ action: a, confidence: clamp(confidence * 0.3 * Math.random(), 0, 1) }))
    3329        .sort((a, b) => b.confidence - a.confidence)
    3330        .slice(0, 3);
    

libs/oya/core/src/advanced-slam-vio.ts#

  • L2928

    ts
    2926          this.activePoints = initialized.map((p) => ({
    2927            ...p,
    2928            patchDescriptor: Math.random(),
    2929          }));
    2930        }
    

libs/oya/core/src/airsim-integration.ts#

  • L298

    ts
    296    for (let i = 0; i < numPoints; i++) {
    297      const azimuth = (i / numPoints) * 2 * Math.PI;
    298      const elevation = -0.3 + 0.6 * Math.random();
    299      const range = maxRange * (0.3 + 0.7 * Math.random());
    300      const ce = Math.cos(elevation);
    
  • L299

    ts
    297      const azimuth = (i / numPoints) * 2 * Math.PI;
    298      const elevation = -0.3 + 0.6 * Math.random();
    299      const range = maxRange * (0.3 + 0.7 * Math.random());
    300      const ce = Math.cos(elevation);
    301      points.push({
    
  • L305

    ts
    303        y: range * ce * Math.sin(azimuth),
    304        z: range * Math.sin(elevation),
    305        intensity: Math.floor(Math.random() * 256),
    306      });
    307    }
    
  • L361

    ts
    359    const mPerDegLat = 111320;
    360    const mPerDegLon = 111320 * Math.cos((homeLatitude * Math.PI) / 180);
    361    const gpsNoise = () => (Math.random() - 0.5) * 3.0;
    362    const imuNoise = () => (Math.random() - 0.5) * 0.04;
    363    const gravBody = quatRotateVec3(
    
  • L362

    ts
    360    const mPerDegLon = 111320 * Math.cos((homeLatitude * Math.PI) / 180);
    361    const gpsNoise = () => (Math.random() - 0.5) * 3.0;
    362    const imuNoise = () => (Math.random() - 0.5) * 0.04;
    363    const gravBody = quatRotateVec3(
    364      { w: orientation.w, x: -orientation.x, y: -orientation.y, z: -orientation.z },
    
  • L371

    ts
    369      linearAcceleration
    370    );
    371    const baroAlt = homeAltitude - truePosition.z + (Math.random() - 0.5) * 0.5;
    372    const baroPressure = 101325 * Math.pow(1 - 2.25577e-5 * baroAlt, 5.25588);
    373    return {
    

libs/oya/core/src/body-reconstruction-3d.ts#

  • L211

    ts
    209      for (let i = 0; i < vertsPerJoint; i++) {
    210        const angle = (2 * Math.PI * i) / vertsPerJoint;
    211        const radius = 0.03 + Math.random() * 0.02;
    212        vertices.push(
    213          vec3(
    

libs/oya/core/src/camera-gimbal-api.ts#

  • L146

    ts
    144        filename: `IMG_${String(this.photoCount).padStart(4, '0')}.jpg`,
    145        type: 'photo',
    146        sizeBytes: 5_000_000 + Math.floor(Math.random() * 3_000_000),
    147        durationSec: 0,
    148        createdAt: isoNow(),
    
  • L844

    ts
    842      ];
    843      this.offsets = {
    844        rollDeg: 0.02 * (Math.random() - 0.5),
    845        pitchDeg: 0.03 * (Math.random() - 0.5),
    846        yawDeg: 0.01 * (Math.random() - 0.5),
    
  • L845

    ts
    843      this.offsets = {
    844        rollDeg: 0.02 * (Math.random() - 0.5),
    845        pitchDeg: 0.03 * (Math.random() - 0.5),
    846        yawDeg: 0.01 * (Math.random() - 0.5),
    847      };
    
  • L846

    ts
    844        rollDeg: 0.02 * (Math.random() - 0.5),
    845        pitchDeg: 0.03 * (Math.random() - 0.5),
    846        yawDeg: 0.01 * (Math.random() - 0.5),
    847      };
    848      this.lastResult = { steps, overall: 'passed', offsetsDeg: { ...this.offsets } };
    

libs/oya/core/src/consensus-algorithms.ts#

  • L1297

    ts
    1295      this.totalPacketsSent = 0;
    1296      this.totalPacketsLost = 0;
    1297      this.rng = rng ?? Math.random;
    1298
    1299      // Initialize last received values
    
  • L2519

    ts
    2517      this.round = 0;
    2518      this.totalMessages = 0;
    2519      this.rng = rng ?? Math.random;
    2520
    2521      for (const node of graph.nodes) {
    
  • L3186

    ts
    3184      this.round = 0;
    3185      this.lastAverageLoss = Infinity;
    3186      this.rng = rng ?? Math.random;
    3187
    3188      // Initialize global model with small random weights
    

libs/oya/core/src/depth-sensors.ts#

  • L2384

    ts
    2382      for (let iter = 0; iter < this._ransacIterations; iter++) {
    2383        // Random 3 points
    2384        const i0 = Math.floor(Math.random() * points.length);
    2385        let i1 = Math.floor(Math.random() * points.length);
    2386        let i2 = Math.floor(Math.random() * points.length);
    
  • L2385

    ts
    2383        // Random 3 points
    2384        const i0 = Math.floor(Math.random() * points.length);
    2385        let i1 = Math.floor(Math.random() * points.length);
    2386        let i2 = Math.floor(Math.random() * points.length);
    2387        if (i1 === i0) i1 = (i0 + 1) % points.length;
    
  • L2386

    ts
    2384        const i0 = Math.floor(Math.random() * points.length);
    2385        let i1 = Math.floor(Math.random() * points.length);
    2386        let i2 = Math.floor(Math.random() * points.length);
    2387        if (i1 === i0) i1 = (i0 + 1) % points.length;
    2388        if (i2 === i0 || i2 === i1) i2 = (i0 + 2) % points.length;
    
  • L2527

    ts
    2525
    2526      for (let iter = 0; iter < this._ransacIterations; iter++) {
    2527        const i0 = Math.floor(Math.random() * points.length);
    2528        const i1 = (i0 + 1 + Math.floor(Math.random() * (points.length - 1))) % points.length;
    2529        let i2 = (i0 + 2 + Math.floor(Math.random() * (points.length - 2))) % points.length;
    
  • L2528

    ts
    2526      for (let iter = 0; iter < this._ransacIterations; iter++) {
    2527        const i0 = Math.floor(Math.random() * points.length);
    2528        const i1 = (i0 + 1 + Math.floor(Math.random() * (points.length - 1))) % points.length;
    2529        let i2 = (i0 + 2 + Math.floor(Math.random() * (points.length - 2))) % points.length;
    2530        if (i2 === i1) i2 = (i1 + 1) % points.length;
    
  • L2529

    ts
    2527        const i0 = Math.floor(Math.random() * points.length);
    2528        const i1 = (i0 + 1 + Math.floor(Math.random() * (points.length - 1))) % points.length;
    2529        let i2 = (i0 + 2 + Math.floor(Math.random() * (points.length - 2))) % points.length;
    2530        if (i2 === i1) i2 = (i1 + 1) % points.length;
    2531
    
  • L2651

    ts
    2649
    2650        for (let iter = 0; iter < this._ransacIterations; iter++) {
    2651          const i0 = Math.floor(Math.random() * remainingPoints.length);
    2652          const i1 =
    2653            (i0 + 1 + Math.floor(Math.random() * (remainingPoints.length - 1))) %
    
  • L2653

    ts
    2651          const i0 = Math.floor(Math.random() * remainingPoints.length);
    2652          const i1 =
    2653            (i0 + 1 + Math.floor(Math.random() * (remainingPoints.length - 1))) %
    2654            remainingPoints.length;
    2655          let i2 =
    
  • L2656

    ts
    2654            remainingPoints.length;
    2655          let i2 =
    2656            (i0 + 2 + Math.floor(Math.random() * (remainingPoints.length - 2))) %
    2657            remainingPoints.length;
    2658          if (i2 === i1) i2 = (i1 + 1) % remainingPoints.length;
    

libs/oya/core/src/edge-deployment.ts#

  • L2327

    ts
    2325    routeRequest(): string {
    2326      if (!this.canaryModelId) return this.stableModelId;
    2327      return Math.random() * 100 < this.canaryPercentage ? this.canaryModelId : this.stableModelId;
    2328    }
    2329
    

libs/oya/core/src/enterprise-platform.ts#

  • L1708

    ts
    1706    const s = (n: number) => {
    1707      let r = '';
    1708      for (let i = 0; i < n; i++) r += hex[Math.floor(Math.random() * 16)];
    1709      return r;
    1710    };
    
  • L1711

    ts
    1709      return r;
    1710    };
    1711    return `${s(8)}-${s(4)}-4${s(3)}-${hex[8 + Math.floor(Math.random() * 4)]}${s(3)}-${s(12)}`;
    1712  }
    1713
    
  • L3761

    ts
    3759    ): BatterySwapResult {
    3760      const dock = this._docks.get(dockId);
    3761      const swapTimeMs = 45000 + Math.random() * 15000; // 45-60 seconds
    3762      const success = dock?.status === DockStatus.DronePresent && newBatteryPercent > 50;
    3763
    

libs/oya/core/src/faa-bvlos-compliance.ts#

  • L1093

    ts
    1091      validUntilMs: number
    1092    ): LAANCAuth {
    1093      const authId = `LAANC-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    1094
    1095      // Auto-approve for altitudes <= 200ft in LAANC grid areas (simplified)
    
  • L1152

    ts
    1150     */
    1151    fileFlightPlan(plan: Omit<UTMFlightPlan, 'planId' | 'status'>): UTMFlightPlan {
    1152      const planId = `UTM-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    1153      const fullPlan: UTMFlightPlan = {
    1154        ...plan,
    

libs/oya/core/src/gaussian-splatting-integration.ts#

  • L3185

    ts
    3183        const step = 0.001 * Math.exp(-iter * 0.2);
    3184        for (let j = 0; j < this.currentParams.pose.length; j++) {
    3185          this.currentParams.pose[j] += (Math.random() - 0.5) * step;
    3186        }
    3187
    

libs/oya/core/src/gazebo-integration.ts#

  • L201

    ts
    199   */
    200  export function applySensorNoise(value: number, noise: SensorNoiseConfig): number {
    201    const u1 = Math.random() || 1e-10;
    202    const u2 = Math.random();
    203    const gaussian = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L202

    ts
    200  export function applySensorNoise(value: number, noise: SensorNoiseConfig): number {
    201    const u1 = Math.random() || 1e-10;
    202    const u2 = Math.random();
    203    const gaussian = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    204    let noisy = value + noise.bias + noise.mean + noise.stddev * gaussian;
    
  • L385

    ts
    383    verticalAccuracy: number = 3.0
    384  ): SimulatedSensorReading {
    385    const u1 = Math.random() || 1e-10;
    386    const u2 = Math.random();
    387    const gN = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L386

    ts
    384  ): SimulatedSensorReading {
    385    const u1 = Math.random() || 1e-10;
    386    const u2 = Math.random();
    387    const gN = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    388    const gE = Math.sqrt(-2 * Math.log(u1)) * Math.sin(2 * Math.PI * u2);
    
  • L389

    ts
    387    const gN = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    388    const gE = Math.sqrt(-2 * Math.log(u1)) * Math.sin(2 * Math.PI * u2);
    389    const u3 = Math.random() || 1e-10;
    390    const u4 = Math.random();
    391    const gU = Math.sqrt(-2 * Math.log(u3)) * Math.cos(2 * Math.PI * u4);
    
  • L390

    ts
    388    const gE = Math.sqrt(-2 * Math.log(u1)) * Math.sin(2 * Math.PI * u2);
    389    const u3 = Math.random() || 1e-10;
    390    const u4 = Math.random();
    391    const gU = Math.sqrt(-2 * Math.log(u3)) * Math.cos(2 * Math.PI * u4);
    392    const mPerDegLat = 111320;
    
  • L562

    ts
    560          const br =
    561            heights[Math.min(samplesY - 1, y + step) * samplesX + Math.min(samplesX - 1, x + step)];
    562          heights[y * samplesX + x] = (tl + tr + bl + br) / 4 + (Math.random() - 0.5) * amplitude;
    563        }
    564      }
    
  • L585

    ts
    583            count++;
    584          }
    585          heights[y * samplesX + x] = sum / count + (Math.random() - 0.5) * amplitude;
    586        }
    587      }
    

libs/oya/core/src/gnn-swarm-intelligence.ts#

  • L3702

    ts
    3700          const oldLogProb = exp.logProbs[0] ?? -1;
    3701          // Simulate new log prob
    3702          const newLogProb = oldLogProb + (Math.random() - 0.5) * 0.01;
    3703          const ratio = Math.exp(newLogProb - oldLogProb);
    3704          const clippedRatio = clamp(ratio, 1 - this.config.clipEpsilon, 1 + this.config.clipEpsilon);
    
  • L3821

    ts
    3819
    3820      // Suggest perturbed hyperparameters
    3821      const perturbation = 1 + (Math.random() - 0.5) * 0.4; // +/- 20%
    3822      const suggestedParams: Partial<MAPPOConfig> = {
    3823        policyLR: this.config.policyLR * perturbation,
    
  • L3913

    ts
    3911
    3912      for (let ep = 0; ep < numEpisodes; ep++) {
    3913        const episodeLength = 50 + Math.floor(Math.random() * 150);
    3914        totalLength += episodeLength;
    3915
    
  • L3918

    ts
    3916        // Simulate episode based on training progress
    3917        const progressFactor = Math.min(1, this.episodeCount / 100);
    3918        const win = Math.random() < progressFactor * 0.7;
    3919        if (win) wins++;
    3920
    
  • L3921

    ts
    3919        if (win) wins++;
    3920
    3921        const epReturn = win ? 20 + Math.random() * 5 : -10 + Math.random() * 15;
    3922        totalReturn += epReturn;
    3923
    
  • L3925

    ts
    3923
    3924        // Death rate decreases with training
    3925        totalDeaths += Math.floor(this.config.numAgents * (1 - progressFactor * 0.6) * Math.random());
    3926      }
    3927
    
  • L4492

    ts
    4490
    4491      for (let i = 0; i < n; i++) {
    4492        const idx = Math.floor(Math.random() * available.length);
    4493        selected.push(available[idx]);
    4494        available.splice(idx, 1);
    

libs/oya/core/src/gps-navigation.ts#

  • L4873

    ts
    4871     */
    4872    private gaussianRandom(): number {
    4873      const u1 = Math.random();
    4874      const u2 = Math.random();
    4875      return Math.sqrt(-2 * Math.log(Math.max(u1, 1e-10))) * Math.cos(2 * Math.PI * u2);
    
  • L4874

    ts
    4872    private gaussianRandom(): number {
    4873      const u1 = Math.random();
    4874      const u2 = Math.random();
    4875      return Math.sqrt(-2 * Math.log(Math.max(u1, 1e-10))) * Math.cos(2 * Math.PI * u2);
    4876    }
    
  • L4973

    ts
    4971        for (let i = 0; i < n; i++) {
    4972          // Distribute satellites across sky
    4973          const elevDeg = 10 + Math.random() * 70;
    4974          const azDeg = (i / n) * 360 + Math.random() * 30;
    4975          // C/N0 depends on elevation
    
  • L4974

    ts
    4972          // Distribute satellites across sky
    4973          const elevDeg = 10 + Math.random() * 70;
    4974          const azDeg = (i / n) * 360 + Math.random() * 30;
    4975          // C/N0 depends on elevation
    4976          const cnoDB = 25 + elevDeg * 0.3 + Math.random() * 10;
    
  • L4976

    ts
    4974          const azDeg = (i / n) * 360 + Math.random() * 30;
    4975          // C/N0 depends on elevation
    4976          const cnoDB = 25 + elevDeg * 0.3 + Math.random() * 10;
    4977
    4978          sats.push({
    

libs/oya/core/src/inter-drone-communication.ts#

  • L1315

    ts
    1313      this.localPort = localPort;
    1314      this.state = 'closed';
    1315      this.sendSequenceNum = Math.floor(Math.random() * 65536);
    1316      this.recvSequenceNum = 0;
    1317      this.sendBuffer = [];
    

libs/oya/core/src/jmavsim-integration.ts#

  • L411

    ts
    409    };
    410    const gravBody = quatRotateVec3(qConj, gravWorld);
    411    const noiseSmall = () => (Math.random() - 0.5) * 0.02;
    412    const accel = vec3Add(gravBody, vec3(noiseSmall(), noiseSmall(), noiseSmall()));
    413    const gyro = vec3Add(
    
  • L424

    ts
    422    const mPerDegLat = 111320;
    423    const mPerDegLon = 111320 * Math.cos((homeLat * Math.PI) / 180);
    424    const gpsNoise = () => (Math.random() - 0.5) * 2.0;
    425    return {
    426      timestampUs,
    
  • L536

    ts
    534    for (let j = 0; j < res; j++) {
    535      for (let i = 0; i < res; i++) {
    536        elevations[j * res + i] = baseElevation + (Math.random() - 0.5) * 2 * noiseAmplitude;
    537      }
    538    }
    

libs/oya/core/src/kinematics.ts#

  • L1624

    ts
    1622    let v = 0;
    1623    // Ensure u is not zero (log(0) is -Infinity)
    1624    while (u === 0) u = Math.random();
    1625    while (v === 0) v = Math.random();
    1626    return Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v);
    
  • L1625

    ts
    1623    // Ensure u is not zero (log(0) is -Infinity)
    1624    while (u === 0) u = Math.random();
    1625    while (v === 0) v = Math.random();
    1626    return Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v);
    1627  }
    

libs/oya/core/src/mission-execution.ts#

  • L138

    ts
    136  function generateId(): string {
    137    const hex = (n: number) =>
    138      Math.floor(Math.random() * 16 ** n)
    139        .toString(16)
    140        .padStart(n, '0');
    
  • L141

    ts
    139        .toString(16)
    140        .padStart(n, '0');
    141    return `${hex(8)}-${hex(4)}-4${hex(3)}-${(8 + Math.floor(Math.random() * 4)).toString(16)}${hex(3)}-${hex(12)}`;
    142  }
    143
    

libs/oya/core/src/model-inference.ts#

  • L275

    ts
    273      }
    274
    275      this.cudaStreamId = Math.floor(Math.random() * 65536);
    276      this.status = 'ready';
    277    }
    
  • L320

    ts
    318        // Initialize with small random values simulating model outputs
    319        for (let i = 0; i < elementCount; i++) {
    320          data[i] = (Math.random() - 0.5) * 0.1;
    321        }
    322
    
  • L473

    ts
    471        // Simulate network output activations
    472        for (let i = 0; i < elementCount; i++) {
    473          data[i] = (Math.random() - 0.5) * 2.0;
    474        }
    475
    
  • L641

    ts
    639        const data = new Float32Array(elements);
    640        for (let i = 0; i < elements; i++) {
    641          data[i] = Math.random() * 0.5;
    642        }
    643        return {
    
  • L770

    ts
    768        const data = new Float32Array(elements);
    769        for (let i = 0; i < elements; i++) {
    770          data[i] = Math.random() * 0.3;
    771        }
    772        outputs.set(name, { name, dtype: info.dtype, shape: [...info.shape], data });
    
  • L813

    ts
    811        const data = new Float32Array(elements);
    812        for (let i = 0; i < elements; i++) {
    813          data[i] = Math.random() * 0.3;
    814        }
    815        outputs.set(name, { name, dtype: info.dtype, shape: [...info.shape], data });
    
  • L1741

    ts
    1739        case 'uint8':
    1740          data = new Uint8Array(elements);
    1741          for (let i = 0; i < elements; i++) data[i] = Math.floor(Math.random() * 256);
    1742          break;
    1743        case 'int8':
    
  • L1745

    ts
    1743        case 'int8':
    1744          data = new Int8Array(elements);
    1745          for (let i = 0; i < elements; i++) data[i] = Math.floor(Math.random() * 256) - 128;
    1746          break;
    1747        default:
    
  • L1749

    ts
    1747        default:
    1748          data = new Float32Array(elements);
    1749          for (let i = 0; i < elements; i++) data[i] = Math.random() * 2 - 1;
    1750      }
    1751
    
  • L3155

    ts
    3153        for (let i = 0; i < this.projectionMatrix.length; i++) {
    3154          // Box-Muller transform for Gaussian random numbers
    3155          const u1 = Math.random();
    3156          const u2 = Math.random();
    3157          this.projectionMatrix[i] =
    
  • L3156

    ts
    3154          // Box-Muller transform for Gaussian random numbers
    3155          const u1 = Math.random();
    3156          const u2 = Math.random();
    3157          this.projectionMatrix[i] =
    3158            Math.sqrt(-2 * Math.log(Math.max(u1, 1e-10))) * Math.cos(2 * Math.PI * u2) * scale;
    

libs/oya/core/src/model-optimization.ts#

  • L985

    ts
    983      for (let s = 0; s < numStages; s++) {
    984        stages.push({
    985          kernelSize: ss.kernelSizes[Math.floor(Math.random() * ss.kernelSizes.length)],
    986          expansion: ss.expansionRatios[Math.floor(Math.random() * ss.expansionRatios.length)],
    987          channels: ss.channelMultipliers[Math.floor(Math.random() * ss.channelMultipliers.length)],
    
  • L986

    ts
    984        stages.push({
    985          kernelSize: ss.kernelSizes[Math.floor(Math.random() * ss.kernelSizes.length)],
    986          expansion: ss.expansionRatios[Math.floor(Math.random() * ss.expansionRatios.length)],
    987          channels: ss.channelMultipliers[Math.floor(Math.random() * ss.channelMultipliers.length)],
    988          depth: ss.depthOptions[Math.floor(Math.random() * ss.depthOptions.length)],
    
  • L987

    ts
    985          kernelSize: ss.kernelSizes[Math.floor(Math.random() * ss.kernelSizes.length)],
    986          expansion: ss.expansionRatios[Math.floor(Math.random() * ss.expansionRatios.length)],
    987          channels: ss.channelMultipliers[Math.floor(Math.random() * ss.channelMultipliers.length)],
    988          depth: ss.depthOptions[Math.floor(Math.random() * ss.depthOptions.length)],
    989          useSE: ss.includeSeBlock && Math.random() > 0.5,
    
  • L988

    ts
    986          expansion: ss.expansionRatios[Math.floor(Math.random() * ss.expansionRatios.length)],
    987          channels: ss.channelMultipliers[Math.floor(Math.random() * ss.channelMultipliers.length)],
    988          depth: ss.depthOptions[Math.floor(Math.random() * ss.depthOptions.length)],
    989          useSE: ss.includeSeBlock && Math.random() > 0.5,
    990          useSkip: ss.includeSkipConnections && Math.random() > 0.3,
    
  • L989

    ts
    987          channels: ss.channelMultipliers[Math.floor(Math.random() * ss.channelMultipliers.length)],
    988          depth: ss.depthOptions[Math.floor(Math.random() * ss.depthOptions.length)],
    989          useSE: ss.includeSeBlock && Math.random() > 0.5,
    990          useSkip: ss.includeSkipConnections && Math.random() > 0.3,
    991        });
    
  • L990

    ts
    988          depth: ss.depthOptions[Math.floor(Math.random() * ss.depthOptions.length)],
    989          useSE: ss.includeSeBlock && Math.random() > 0.5,
    990          useSkip: ss.includeSkipConnections && Math.random() > 0.3,
    991        });
    992      }
    
  • L1013

    ts
    1011      let best: NASCandidate | null = null;
    1012      for (let i = 0; i < k; i++) {
    1013        const idx = Math.floor(Math.random() * this.population.length);
    1014        if (!best || this.population[idx].fitness > best.fitness) {
    1015          best = this.population[idx];
    
  • L1025

    ts
    1023      const stages = parent.stages.map((stage) => {
    1024        const mutated = { ...stage };
    1025        const r = Math.random();
    1026
    1027        if (r < 0.2) {
    
  • L1028

    ts
    1026
    1027        if (r < 0.2) {
    1028          mutated.kernelSize = ss.kernelSizes[Math.floor(Math.random() * ss.kernelSizes.length)];
    1029        } else if (r < 0.4) {
    1030          mutated.expansion =
    
  • L1031

    ts
    1029        } else if (r < 0.4) {
    1030          mutated.expansion =
    1031            ss.expansionRatios[Math.floor(Math.random() * ss.expansionRatios.length)];
    1032        } else if (r < 0.6) {
    1033          mutated.channels =
    
  • L1034

    ts
    1032        } else if (r < 0.6) {
    1033          mutated.channels =
    1034            ss.channelMultipliers[Math.floor(Math.random() * ss.channelMultipliers.length)];
    1035        } else if (r < 0.8) {
    1036          mutated.depth = ss.depthOptions[Math.floor(Math.random() * ss.depthOptions.length)];
    
  • L1036

    ts
    1034            ss.channelMultipliers[Math.floor(Math.random() * ss.channelMultipliers.length)];
    1035        } else if (r < 0.8) {
    1036          mutated.depth = ss.depthOptions[Math.floor(Math.random() * ss.depthOptions.length)];
    1037        } else {
    1038          mutated.useSE = !mutated.useSE;
    

libs/oya/core/src/modern-simulation-platforms.ts#

  • L530

    ts
    528      if (!this.ros2Bridge?.active) return false;
    529      this.ros2Bridge.messageCount++;
    530      this.ros2Bridge.latencyMs = 0.1 + Math.random() * 0.5;
    531      return (
    532        this.ros2Bridge.publishedTopics.includes(topic) ||
    
  • L2567

    ts
    2565      for (const entity of this.crowdEntities) {
    2566        if (entity.behavior === 'random_walk') {
    2567          entity.heading += (Math.random() - 0.5) * 0.5;
    2568          const maxSpeed = entity.type === 'pedestrian' ? 1.4 : entity.type === 'bicycle' ? 5 : 10;
    2569          const targetSpeed = maxSpeed * (0.5 + Math.random() * 0.5);
    
  • L2569

    ts
    2567          entity.heading += (Math.random() - 0.5) * 0.5;
    2568          const maxSpeed = entity.type === 'pedestrian' ? 1.4 : entity.type === 'bicycle' ? 5 : 10;
    2569          const targetSpeed = maxSpeed * (0.5 + Math.random() * 0.5);
    2570          entity.velocity = vec3(
    2571            targetSpeed * Math.cos(entity.heading),
    

libs/oya/core/src/multi-camera-coordination.ts#

  • L698

    ts
    696    registerSlave(droneId: CamDroneId, initialPhaseOffset?: number): void {
    697      this.states.set(droneId, {
    698        phaseOffset: initialPhaseOffset ?? Math.random() * 0.5 - 0.25,
    699        phaseVelocity: 0,
    700        locked: false,
    

libs/oya/core/src/natural-language-control.ts#

  • L105

    ts
    103
    104  function uid(): string {
    105    return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
    106  }
    107
    
  • L1085

    ts
    1083        const perturbScale = Math.max(0.1, 2.0 / Math.sqrt(iter));
    1084        const candidatePos = vec3(
    1085          bestPos.x + (Math.random() - 0.5) * perturbScale * 10,
    1086          bestPos.y + (Math.random() - 0.5) * perturbScale * 10,
    1087          bestPos.z + (Math.random() - 0.5) * perturbScale * 5
    
  • L1086

    ts
    1084        const candidatePos = vec3(
    1085          bestPos.x + (Math.random() - 0.5) * perturbScale * 10,
    1086          bestPos.y + (Math.random() - 0.5) * perturbScale * 10,
    1087          bestPos.z + (Math.random() - 0.5) * perturbScale * 5
    1088        );
    
  • L1087

    ts
    1085          bestPos.x + (Math.random() - 0.5) * perturbScale * 10,
    1086          bestPos.y + (Math.random() - 0.5) * perturbScale * 10,
    1087          bestPos.z + (Math.random() - 0.5) * perturbScale * 5
    1088        );
    1089        const candidateYaw = normalizeAngle(bestYaw + (Math.random() - 0.5) * perturbScale);
    
  • L1089

    ts
    1087          bestPos.z + (Math.random() - 0.5) * perturbScale * 5
    1088        );
    1089        const candidateYaw = normalizeAngle(bestYaw + (Math.random() - 0.5) * perturbScale);
    1090        const candidatePitch = clamp(
    1091          bestPitch + (Math.random() - 0.5) * perturbScale * 0.5,
    
  • L1091

    ts
    1089        const candidateYaw = normalizeAngle(bestYaw + (Math.random() - 0.5) * perturbScale);
    1090        const candidatePitch = clamp(
    1091          bestPitch + (Math.random() - 0.5) * perturbScale * 0.5,
    1092          -Math.PI / 2,
    1093          0
    

libs/oya/core/src/observability.ts#

  • L210

    ts
    208    const bytes = new Uint8Array(byteLength);
    209    for (let i = 0; i < byteLength; i++) {
    210      bytes[i] = Math.floor(Math.random() * 256);
    211    }
    212    return Array.from(bytes)
    
  • L876

    ts
    874
    875      // Determine if this span should be sampled
    876      const sampled = parentContext?.sampled ?? Math.random() < this.config.sampleRate;
    877
    878      const traceId = parentContext?.traceId ?? generateTraceId();
    

libs/oya/core/src/obstacle-avoidance.ts#

  • L2443

    ts
    2441
    2442    private randomUnused(used: Uint8Array, len: number, exclude = -1): number {
    2443      const startIdx = Math.floor(Math.random() * len);
    2444      for (let i = 0; i < len; i++) {
    2445        const idx = (startIdx + i) % len;
    

libs/oya/core/src/path-planning.ts#

  • L794

    ts
    792    protected sampleRandom(): Vec3 {
    793      return vec3(
    794        this.bounds.min.x + Math.random() * (this.bounds.max.x - this.bounds.min.x),
    795        this.bounds.min.y + Math.random() * (this.bounds.max.y - this.bounds.min.y),
    796        this.bounds.min.z + Math.random() * (this.bounds.max.z - this.bounds.min.z)
    
  • L795

    ts
    793      return vec3(
    794        this.bounds.min.x + Math.random() * (this.bounds.max.x - this.bounds.min.x),
    795        this.bounds.min.y + Math.random() * (this.bounds.max.y - this.bounds.min.y),
    796        this.bounds.min.z + Math.random() * (this.bounds.max.z - this.bounds.min.z)
    797      );
    
  • L796

    ts
    794        this.bounds.min.x + Math.random() * (this.bounds.max.x - this.bounds.min.x),
    795        this.bounds.min.y + Math.random() * (this.bounds.max.y - this.bounds.min.y),
    796        this.bounds.min.z + Math.random() * (this.bounds.max.z - this.bounds.min.z)
    797      );
    798    }
    
  • L848

    ts
    846        if (this.config.timeoutMs > 0 && now() - t0 > this.config.timeoutMs) break;
    847
    848        const sample = Math.random() < this.goalBias ? goal : this.sampleRandom();
    849        const nearIdx = this.nearestNode(sample);
    850        const nearNode = this.tree[nearIdx];
    
  • L923

    ts
    921        if (this.config.timeoutMs > 0 && now() - t0 > this.config.timeoutMs) break;
    922
    923        const sample = Math.random() < this.goalBias ? goal : this.sampleRandom();
    924        const nearIdx = this.nearestNode(sample);
    925        const nearNode = this.tree[nearIdx];
    
  • L1013

    ts
    1011    private sampleRandom(): Vec3 {
    1012      return vec3(
    1013        this.bounds.min.x + Math.random() * (this.bounds.max.x - this.bounds.min.x),
    1014        this.bounds.min.y + Math.random() * (this.bounds.max.y - this.bounds.min.y),
    1015        this.bounds.min.z + Math.random() * (this.bounds.max.z - this.bounds.min.z)
    
  • L1014

    ts
    1012      return vec3(
    1013        this.bounds.min.x + Math.random() * (this.bounds.max.x - this.bounds.min.x),
    1014        this.bounds.min.y + Math.random() * (this.bounds.max.y - this.bounds.min.y),
    1015        this.bounds.min.z + Math.random() * (this.bounds.max.z - this.bounds.min.z)
    1016      );
    
  • L1015

    ts
    1013        this.bounds.min.x + Math.random() * (this.bounds.max.x - this.bounds.min.x),
    1014        this.bounds.min.y + Math.random() * (this.bounds.max.y - this.bounds.min.y),
    1015        this.bounds.min.z + Math.random() * (this.bounds.max.z - this.bounds.min.z)
    1016      );
    1017    }
    
  • L1191

    ts
    1189      let bx: number, by: number, bz: number;
    1190      do {
    1191        bx = 2 * Math.random() - 1;
    1192        by = 2 * Math.random() - 1;
    1193        bz = 2 * Math.random() - 1;
    
  • L1192

    ts
    1190      do {
    1191        bx = 2 * Math.random() - 1;
    1192        by = 2 * Math.random() - 1;
    1193        bz = 2 * Math.random() - 1;
    1194      } while (bx * bx + by * by + bz * bz > 1);
    
  • L1193

    ts
    1191        bx = 2 * Math.random() - 1;
    1192        by = 2 * Math.random() - 1;
    1193        bz = 2 * Math.random() - 1;
    1194      } while (bx * bx + by * by + bz * bz > 1);
    1195
    
  • L1226

    ts
    1224        // Use informed sampling once a solution is found
    1225        let sample: Vec3;
    1226        if (Math.random() < this.goalBias) {
    1227          sample = goal;
    1228        } else if (isFinite(this.bestCost)) {
    
  • L1344

    ts
    1342        attempts++;
    1343        const pos = vec3(
    1344          this.bounds.min.x + Math.random() * (this.bounds.max.x - this.bounds.min.x),
    1345          this.bounds.min.y + Math.random() * (this.bounds.max.y - this.bounds.min.y),
    1346          this.bounds.min.z + Math.random() * (this.bounds.max.z - this.bounds.min.z)
    
  • L1345

    ts
    1343        const pos = vec3(
    1344          this.bounds.min.x + Math.random() * (this.bounds.max.x - this.bounds.min.x),
    1345          this.bounds.min.y + Math.random() * (this.bounds.max.y - this.bounds.min.y),
    1346          this.bounds.min.z + Math.random() * (this.bounds.max.z - this.bounds.min.z)
    1347        );
    
  • L1346

    ts
    1344          this.bounds.min.x + Math.random() * (this.bounds.max.x - this.bounds.min.x),
    1345          this.bounds.min.y + Math.random() * (this.bounds.max.y - this.bounds.min.y),
    1346          this.bounds.min.z + Math.random() * (this.bounds.max.z - this.bounds.min.z)
    1347        );
    1348        if (!this.checker.isPointFree(pos)) continue;
    
  • L1768

    ts
    1766        z: toGoal.x * perp1.y - toGoal.y * perp1.x,
    1767      });
    1768      const angle = Math.random() * 2 * Math.PI;
    1769      const escape = vec3Add(
    1770        vec3Scale(perp1, Math.cos(angle) * this.randomEscapeForce),
    
  • L2006

    ts
    2004        let vx: number, vy: number, vz: number;
    2005        do {
    2006          vx = (2 * Math.random() - 1) * maxSpeed;
    2007          vy = (2 * Math.random() - 1) * maxSpeed;
    2008          vz = (2 * Math.random() - 1) * maxSpeed;
    
  • L2007

    ts
    2005        do {
    2006          vx = (2 * Math.random() - 1) * maxSpeed;
    2007          vy = (2 * Math.random() - 1) * maxSpeed;
    2008          vz = (2 * Math.random() - 1) * maxSpeed;
    2009        } while (vx * vx + vy * vy + vz * vz > maxSpeed * maxSpeed);
    
  • L2008

    ts
    2006          vx = (2 * Math.random() - 1) * maxSpeed;
    2007          vy = (2 * Math.random() - 1) * maxSpeed;
    2008          vz = (2 * Math.random() - 1) * maxSpeed;
    2009        } while (vx * vx + vy * vy + vz * vz > maxSpeed * maxSpeed);
    2010
    
  • L2075

    ts
    2073        let vx: number, vy: number, vz: number;
    2074        do {
    2075          vx = (2 * Math.random() - 1) * agent.maxSpeed;
    2076          vy = (2 * Math.random() - 1) * agent.maxSpeed;
    2077          vz = (2 * Math.random() - 1) * agent.maxSpeed;
    
  • L2076

    ts
    2074        do {
    2075          vx = (2 * Math.random() - 1) * agent.maxSpeed;
    2076          vy = (2 * Math.random() - 1) * agent.maxSpeed;
    2077          vz = (2 * Math.random() - 1) * agent.maxSpeed;
    2078        } while (vx * vx + vy * vy + vz * vz > agent.maxSpeed * agent.maxSpeed);
    
  • L2077

    ts
    2075          vx = (2 * Math.random() - 1) * agent.maxSpeed;
    2076          vy = (2 * Math.random() - 1) * agent.maxSpeed;
    2077          vz = (2 * Math.random() - 1) * agent.maxSpeed;
    2078        } while (vx * vx + vy * vy + vz * vz > agent.maxSpeed * agent.maxSpeed);
    2079
    
  • L2803

    ts
    2801      return {
    2802        position: vec3(
    2803          this.bounds.min.x + Math.random() * (this.bounds.max.x - this.bounds.min.x),
    2804          this.bounds.min.y + Math.random() * (this.bounds.max.y - this.bounds.min.y),
    2805          this.bounds.min.z + Math.random() * (this.bounds.max.z - this.bounds.min.z)
    
  • L2804

    ts
    2802        position: vec3(
    2803          this.bounds.min.x + Math.random() * (this.bounds.max.x - this.bounds.min.x),
    2804          this.bounds.min.y + Math.random() * (this.bounds.max.y - this.bounds.min.y),
    2805          this.bounds.min.z + Math.random() * (this.bounds.max.z - this.bounds.min.z)
    2806        ),
    
  • L2805

    ts
    2803          this.bounds.min.x + Math.random() * (this.bounds.max.x - this.bounds.min.x),
    2804          this.bounds.min.y + Math.random() * (this.bounds.max.y - this.bounds.min.y),
    2805          this.bounds.min.z + Math.random() * (this.bounds.max.z - this.bounds.min.z)
    2806        ),
    2807        velocity: vec3Zero(),
    
  • L2884

    ts
    2882        if (this.config.timeoutMs > 0 && now() - t0 > this.config.timeoutMs) break;
    2883
    2884        const sample = Math.random() < 0.1 ? goalState : this.sampleRandomState();
    2885        const nearIdx = this.nearestNode(sample);
    2886        const nearNode = this.tree[nearIdx];
    
  • L3161

    ts
    3159    /** Generate Gaussian random number using Box-Muller */
    3160    private gaussian(): number {
    3161      const u1 = Math.random();
    3162      const u2 = Math.random();
    3163      return Math.sqrt(-2 * Math.log(Math.max(u1, 1e-15))) * Math.cos(2 * Math.PI * u2);
    
  • L3162

    ts
    3160    private gaussian(): number {
    3161      const u1 = Math.random();
    3162      const u2 = Math.random();
    3163      return Math.sqrt(-2 * Math.log(Math.max(u1, 1e-15))) * Math.cos(2 * Math.PI * u2);
    3164    }
    

libs/oya/core/src/physics-simulation.ts#

  • L323

    ts
    321    const noiseScale = state.rmsAmplitude * Math.sqrt(1 - alpha * alpha);
    322    const gaussianRandom = (): number => {
    323      const u = Math.random() || 1e-10;
    324      const v = Math.random();
    325      return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v);
    
  • L324

    ts
    322    const gaussianRandom = (): number => {
    323      const u = Math.random() || 1e-10;
    324      const v = Math.random();
    325      return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v);
    326    };
    
  • L600

    ts
    598    dt: number
    599  ): number {
    600    const u1 = Math.random() || 1e-10;
    601    const u2 = Math.random();
    602    const gaussian = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L601

    ts
    599  ): number {
    600    const u1 = Math.random() || 1e-10;
    601    const u2 = Math.random();
    602    const gaussian = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    603    const walkGaussian =
    
  • L604

    ts
    602    const gaussian = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    603    const walkGaussian =
    604      Math.sqrt(-2 * Math.log(Math.random() || 1e-10)) * Math.cos(2 * Math.PI * Math.random());
    605    noiseState.walkBias += params.randomWalk * Math.sqrt(dt) * walkGaussian;
    606    let result =
    
  • L657

    ts
    655    const alpha = Math.exp(-dt / 5.0);
    656    const gaussianRandom = (): number => {
    657      const u = Math.random() || 1e-10;
    658      const v = Math.random();
    659      return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v);
    
  • L658

    ts
    656    const gaussianRandom = (): number => {
    657      const u = Math.random() || 1e-10;
    658      const v = Math.random();
    659      return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v);
    660    };
    
  • L728

    ts
    726  ): { accel: Vec3; gyro: Vec3 } {
    727    const gaussianRandom = (): number => {
    728      const u = Math.random() || 1e-10;
    729      const v = Math.random();
    730      return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v);
    
  • L729

    ts
    727    const gaussianRandom = (): number => {
    728      const u = Math.random() || 1e-10;
    729      const v = Math.random();
    730      return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v);
    731    };
    
  • L828

    ts
    826        break;
    827      case 'intermittent':
    828        if (Math.random() < failure.intermittentProbability) result[idx] = 0;
    829        break;
    830    }
    
  • L874

    ts
    872    currentTimeMs: number
    873  ): DelayedMessage<T> {
    874    const dropped = Math.random() < channel.packetLossProbability;
    875    const u1 = Math.random() || 1e-10;
    876    const u2 = Math.random();
    
  • L875

    ts
    873  ): DelayedMessage<T> {
    874    const dropped = Math.random() < channel.packetLossProbability;
    875    const u1 = Math.random() || 1e-10;
    876    const u2 = Math.random();
    877    const jitter = channel.jitterMs * Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L876

    ts
    874    const dropped = Math.random() < channel.packetLossProbability;
    875    const u1 = Math.random() || 1e-10;
    876    const u2 = Math.random();
    877    const jitter = channel.jitterMs * Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    878    const latency = Math.max(0, channel.baseLatencyMs + jitter);
    
  • L1125

    ts
    1123      battery: { ...battery },
    1124      turbulence: { ...turbulence, prevOutput: { ...turbulence.prevOutput } },
    1125      randomSeed: Math.floor(Math.random() * 2147483647),
    1126    };
    1127  }
    
  • L1178

    ts
    1176    const conditions: Record<string, number> = {};
    1177    for (const [name, [min, max]] of Object.entries(config.parameterRanges)) {
    1178      conditions[name] = min + Math.random() * (max - min);
    1179    }
    1180    conditions['_trialIndex'] = trialIndex;
    

libs/oya/core/src/sam-integration.ts#

  • L3444

    ts
    3442      for (let i = alternatives.length; i < this.config.numMultimasks; i++) {
    3443        // Perturb the point slightly to get alternative masks
    3444        const px = clamp(point[0] + (Math.random() - 0.5) * 0.05, 0, 1);
    3445        const py = clamp(point[1] + (Math.random() - 0.5) * 0.05, 0, 1);
    3446
    
  • L3445

    ts
    3443        // Perturb the point slightly to get alternative masks
    3444        const px = clamp(point[0] + (Math.random() - 0.5) * 0.05, 0, 1);
    3445        const py = clamp(point[1] + (Math.random() - 0.5) * 0.05, 0, 1);
    3446
    3447        const altResult = this.model.segment(
    
  • L4076

    ts
    4074        const confMap = new Float32Array(w * h);
    4075        for (let i = 0; i < classMap.length; i++) {
    4076          confMap[i] = classMap[i] === cls ? 0.85 + Math.random() * 0.15 : Math.random() * 0.05;
    4077        }
    4078        confidenceMaps.set(cls, confMap);
    
  • L4321

    ts
    4319          className: stuffClass.name,
    4320          area,
    4321          confidence: 0.85 + Math.random() * 0.1,
    4322          bbox: null,
    4323          isInstance: false,
    
  • L4606

    ts
    4604      for (let i = 0; i < totalLayers; i++) {
    4605        const layerName = `layer_${i}`;
    4606        const range: [number, number] = [-(2 + Math.random()), 2 + Math.random()];
    4607        ranges.set(layerName, range);
    4608      }
    

libs/oya/core/src/sapiens-integration.ts#

  • L1138

    ts
    1136      // Create a curved path for the region
    1137      const angle = t * Math.PI * 0.5;
    1138      const x = clamp(offsetX + spread * Math.sin(angle) * (0.8 + Math.random() * 0.4), 0, 1);
    1139      const y = clamp(offsetY + spread * t * (0.9 + Math.random() * 0.2), 0, 1);
    1140      const conf = clamp(baseConf * (0.85 + Math.random() * 0.15), 0, 1);
    
  • L1139

    ts
    1137      const angle = t * Math.PI * 0.5;
    1138      const x = clamp(offsetX + spread * Math.sin(angle) * (0.8 + Math.random() * 0.4), 0, 1);
    1139      const y = clamp(offsetY + spread * t * (0.9 + Math.random() * 0.2), 0, 1);
    1140      const conf = clamp(baseConf * (0.85 + Math.random() * 0.15), 0, 1);
    1141      keypoints.push({
    
  • L1140

    ts
    1138      const x = clamp(offsetX + spread * Math.sin(angle) * (0.8 + Math.random() * 0.4), 0, 1);
    1139      const y = clamp(offsetY + spread * t * (0.9 + Math.random() * 0.2), 0, 1);
    1140      const conf = clamp(baseConf * (0.85 + Math.random() * 0.15), 0, 1);
    1141      keypoints.push({
    1142        index: 0, // Will be set by caller
    
  • L1284

    ts
    1282        const x = clamp(faceX + radiusX * Math.cos(angle), 0, 1);
    1283        const y = clamp(faceY + radiusY * Math.sin(angle), 0, 1);
    1284        const conf = clamp(baseConf * (0.88 + Math.random() * 0.12), 0, 1);
    1285        allLandmarks.push({
    1286          index: globalIdx++,
    
  • L2289

    ts
    2287
    2288          // Set confidence for the assigned part
    2289          const conf = clamp(0.7 + Math.random() * 0.25, 0, 1);
    2290          const partMap = confidenceMaps.get(part)!;
    2291          partMap[idx] = conf;
    
  • L2330

    ts
    2328          const baseDepth = 2.0 + dist * 3.0;
    2329          // Add some noise for realism
    2330          const noise = (Math.random() - 0.5) * 0.1;
    2331          const depth = Math.max(0.1, baseDepth + noise);
    2332
    
  • L2632

    ts
    2630
    2631      // Simulate multi-person detection: number of detections depends on model capacity
    2632      const personCount = Math.min(maxPersons, 1 + Math.floor(Math.random() * 3));
    2633
    2634      for (let p = 0; p < personCount; p++) {
    
  • L2777

    ts
    2775      const results: SapiensFacialLandmarkResult[] = [];
    2776
    2777      const faceCount = Math.min(maxFaces, 1 + Math.floor(Math.random() * 2));
    2778
    2779      for (let f = 0; f < faceCount; f++) {
    
  • L3310

    ts
    3308        // Simulate loss decay with warm restarts
    3309        const progress = epoch / this.config.epochs;
    3310        const trainLoss = 2.5 * Math.exp(-3 * progress) + 0.1 + Math.random() * 0.05;
    3311        const valLoss = trainLoss * (1.1 + Math.random() * 0.1);
    3312
    
  • L3311

    ts
    3309        const progress = epoch / this.config.epochs;
    3310        const trainLoss = 2.5 * Math.exp(-3 * progress) + 0.1 + Math.random() * 0.05;
    3311        const valLoss = trainLoss * (1.1 + Math.random() * 0.1);
    3312
    3313        // Metric improves as loss decreases (AP for pose, mIoU for segmentation)
    
  • L3320

    ts
    3318          case SapiensTaskType.Pose:
    3319            metricName = 'AP';
    3320            valMetric = clamp(0.4 + progress * 0.45 + Math.random() * 0.03, 0, 1);
    3321            break;
    3322          case SapiensTaskType.Face:
    
  • L3324

    ts
    3322          case SapiensTaskType.Face:
    3323            metricName = 'NME';
    3324            valMetric = clamp(3.5 - progress * 2.5 + Math.random() * 0.2, 0.5, 5);
    3325            break;
    3326          case SapiensTaskType.Segmentation:
    
  • L3328

    ts
    3326          case SapiensTaskType.Segmentation:
    3327            metricName = 'mIoU';
    3328            valMetric = clamp(0.35 + progress * 0.4 + Math.random() * 0.02, 0, 1);
    3329            break;
    3330          case SapiensTaskType.Depth:
    
  • L3332

    ts
    3330          case SapiensTaskType.Depth:
    3331            metricName = 'AbsRel';
    3332            valMetric = clamp(0.25 - progress * 0.18 + Math.random() * 0.01, 0.05, 0.5);
    3333            break;
    3334          case SapiensTaskType.Normal:
    
  • L3336

    ts
    3334          case SapiensTaskType.Normal:
    3335            metricName = 'AngularError';
    3336            valMetric = clamp(25 - progress * 18 + Math.random(), 5, 30);
    3337            break;
    3338          default:
    
  • L3398

    ts
    3396      const aug = this.config.augmentation;
    3397      return {
    3398        rotation: (Math.random() * 2 - 1) * aug.rotationRange,
    3399        scale: aug.scaleRange[0] + Math.random() * (aug.scaleRange[1] - aug.scaleRange[0]),
    3400        perspectiveWarp: Math.random() * aug.perspectiveStrength,
    
  • L3399

    ts
    3397      return {
    3398        rotation: (Math.random() * 2 - 1) * aug.rotationRange,
    3399        scale: aug.scaleRange[0] + Math.random() * (aug.scaleRange[1] - aug.scaleRange[0]),
    3400        perspectiveWarp: Math.random() * aug.perspectiveStrength,
    3401        horizontalFlip: Math.random() < aug.horizontalFlipProb,
    
  • L3400

    ts
    3398        rotation: (Math.random() * 2 - 1) * aug.rotationRange,
    3399        scale: aug.scaleRange[0] + Math.random() * (aug.scaleRange[1] - aug.scaleRange[0]),
    3400        perspectiveWarp: Math.random() * aug.perspectiveStrength,
    3401        horizontalFlip: Math.random() < aug.horizontalFlipProb,
    3402        colorJitter: Math.random() * aug.colorJitter,
    
  • L3401

    ts
    3399        scale: aug.scaleRange[0] + Math.random() * (aug.scaleRange[1] - aug.scaleRange[0]),
    3400        perspectiveWarp: Math.random() * aug.perspectiveStrength,
    3401        horizontalFlip: Math.random() < aug.horizontalFlipProb,
    3402        colorJitter: Math.random() * aug.colorJitter,
    3403        blur: Math.random() < aug.blurProb,
    
  • L3402

    ts
    3400        perspectiveWarp: Math.random() * aug.perspectiveStrength,
    3401        horizontalFlip: Math.random() < aug.horizontalFlipProb,
    3402        colorJitter: Math.random() * aug.colorJitter,
    3403        blur: Math.random() < aug.blurProb,
    3404        simulatedAltitude:
    
  • L3403

    ts
    3401        horizontalFlip: Math.random() < aug.horizontalFlipProb,
    3402        colorJitter: Math.random() * aug.colorJitter,
    3403        blur: Math.random() < aug.blurProb,
    3404        simulatedAltitude:
    3405          aug.altitudeRange[0] + Math.random() * (aug.altitudeRange[1] - aug.altitudeRange[0]),
    
  • L3405

    ts
    3403        blur: Math.random() < aug.blurProb,
    3404        simulatedAltitude:
    3405          aug.altitudeRange[0] + Math.random() * (aug.altitudeRange[1] - aug.altitudeRange[0]),
    3406        motionBlur: Math.random() < aug.motionBlurProb,
    3407        lensDistortion: (Math.random() * 2 - 1) * aug.lensDistortion,
    
  • L3406

    ts
    3404        simulatedAltitude:
    3405          aug.altitudeRange[0] + Math.random() * (aug.altitudeRange[1] - aug.altitudeRange[0]),
    3406        motionBlur: Math.random() < aug.motionBlurProb,
    3407        lensDistortion: (Math.random() * 2 - 1) * aug.lensDistortion,
    3408      };
    
  • L3407

    ts
    3405          aug.altitudeRange[0] + Math.random() * (aug.altitudeRange[1] - aug.altitudeRange[0]),
    3406        motionBlur: Math.random() < aug.motionBlurProb,
    3407        lensDistortion: (Math.random() * 2 - 1) * aug.lensDistortion,
    3408      };
    3409    }
    
  • L4045

    ts
    4043
    4044      // Simulate build time (proportional to model size)
    4045      const buildTimeMs = Math.round(spec.parametersBillions * 30000 + Math.random() * 5000);
    4046
    4047      this.builtEngines.set(engineId, {
    

libs/oya/core/src/sdk-core.ts#

  • L197

    ts
    195    for (let i = 0; i < 32; i++) {
    196      if (i === 8 || i === 12 || i === 16 || i === 20) id += '-';
    197      id += h[Math.floor(Math.random() * 16)];
    198    }
    199    return id;
    
  • L205

    ts
    203  function backoffMs(base: number, attempt: number): number {
    204    const exp = base * Math.pow(2, attempt);
    205    const jitter = exp * 0.2 * Math.random();
    206    return Math.min(exp + jitter, 30000);
    207  }
    
  • L625

    ts
    623    delayForAttempt(attempt: number): number {
    624      const raw = this.policy.baseDelayMs * Math.pow(this.policy.backoffMultiplier, attempt);
    625      const jittered = raw + raw * 0.1 * Math.random();
    626      return Math.min(jittered, this.policy.maxDelayMs);
    627    }
    

libs/oya/core/src/sitl-integration-framework.ts#

  • L335

    ts
    333        uuid += '4';
    334      } else if (i === 19) {
    335        uuid += hex[(Math.random() * 4) | 8];
    336      } else {
    337        uuid += hex[(Math.random() * 16) | 0];
    
  • L337

    ts
    335        uuid += hex[(Math.random() * 4) | 8];
    336      } else {
    337        uuid += hex[(Math.random() * 16) | 0];
    338      }
    339    }
    
  • L355

    ts
    353  /** Simple gaussian noise with Box-Muller transform */
    354  function gaussianNoise(stddev: number): number {
    355    const u1 = Math.random();
    356    const u2 = Math.random();
    357    return stddev * Math.sqrt(-2 * Math.log(u1 || 1e-10)) * Math.cos(2 * Math.PI * u2);
    
  • L356

    ts
    354  function gaussianNoise(stddev: number): number {
    355    const u1 = Math.random();
    356    const u2 = Math.random();
    357    return stddev * Math.sqrt(-2 * Math.log(u1 || 1e-10)) * Math.cos(2 * Math.PI * u2);
    358  }
    
  • L1303

    ts
    1301    sendMessage(msg: Omit<MAVLinkMessage, 'timestampMs' | 'direction'>): boolean {
    1302      // Apply packet loss
    1303      if (this.packetLossRate > 0 && Math.random() < this.packetLossRate) {
    1304        return false; // Packet lost
    1305      }
    
  • L1319

    ts
    1317    receiveMessage(msg: MAVLinkMessage): void {
    1318      // Apply packet loss
    1319      if (this.packetLossRate > 0 && Math.random() < this.packetLossRate) {
    1320        return; // Packet lost
    1321      }
    

libs/oya/core/src/swarm-collision-avoidance.ts#

  • L1436

    ts
    1434      this.perturbationScale = perturbationScale;
    1435      this.maxHistoryLength = maxHistoryLength;
    1436      this.rng = rngSeed ?? Math.random;
    1437    }
    1438
    
  • L2743

    ts
    2741    /**
    2742     * @param monteCarloSamples - Number of samples for Monte Carlo estimation. Default 1000
    2743     * @param rng - Random number generator function. Default Math.random
    2744     */
    2745    constructor(monteCarloSamples: number = 1000, rng?: () => number) {
    
  • L2747

    ts
    2745    constructor(monteCarloSamples: number = 1000, rng?: () => number) {
    2746      this.monteCarloSamples = monteCarloSamples;
    2747      this.rng = rng ?? Math.random;
    2748    }
    2749
    

libs/oya/core/src/task-allocation.ts#

  • L1087

    ts
    1085    /** Create a random chromosome */
    1086    private randomChromosome(): Chromosome {
    1087      const genes = this.tasks.map(() => Math.floor(Math.random() * this.drones.length));
    1088      return { genes, fitness: 0 };
    1089    }
    
  • L1123

    ts
    1121    /** Single-point crossover */
    1122    private crossover(parent1: Chromosome, parent2: Chromosome): Chromosome {
    1123      const point = Math.floor(Math.random() * this.tasks.length);
    1124      const genes = [...parent1.genes.slice(0, point), ...parent2.genes.slice(point)];
    1125      return { genes, fitness: 0 };
    
  • L1131

    ts
    1129    private mutate(chrom: Chromosome): void {
    1130      for (let i = 0; i < chrom.genes.length; i++) {
    1131        if (Math.random() < this.mutationRate) {
    1132          chrom.genes[i] = Math.floor(Math.random() * this.drones.length);
    1133        }
    
  • L1132

    ts
    1130      for (let i = 0; i < chrom.genes.length; i++) {
    1131        if (Math.random() < this.mutationRate) {
    1132          chrom.genes[i] = Math.floor(Math.random() * this.drones.length);
    1133        }
    1134      }
    
  • L1141

    ts
    1139      let best: Chromosome | null = null;
    1140      for (let i = 0; i < size; i++) {
    1141        const idx = Math.floor(Math.random() * population.length);
    1142        if (!best || population[idx].fitness > best.fitness) {
    1143          best = population[idx];
    
  • L1300

    ts
    1298
    1299      for (let i = 0; i < this.swarmSize; i++) {
    1300        const position = Array.from({ length: dim }, () => Math.random() * maxVal);
    1301        const velocity = Array.from({ length: dim }, () => (Math.random() - 0.5) * 2);
    1302        const fitness = this.evaluateFitness(position);
    
  • L1301

    ts
    1299      for (let i = 0; i < this.swarmSize; i++) {
    1300        const position = Array.from({ length: dim }, () => Math.random() * maxVal);
    1301        const velocity = Array.from({ length: dim }, () => (Math.random() - 0.5) * 2);
    1302        const fitness = this.evaluateFitness(position);
    1303        particles.push({
    
  • L1320

    ts
    1318          // Update velocity
    1319          for (let d = 0; d < dim; d++) {
    1320            const r1 = Math.random();
    1321            const r2 = Math.random();
    1322            p.velocity[d] =
    
  • L1321

    ts
    1319          for (let d = 0; d < dim; d++) {
    1320            const r1 = Math.random();
    1321            const r2 = Math.random();
    1322            p.velocity[d] =
    1323              this.inertia * p.velocity[d] +
    
  • L1442

    ts
    1440      ) {
    1441        this.weights = Array.from({ length: Math.max(1, stateSize) }, () =>
    1442          Array.from({ length: Math.max(1, actionSize) }, () => (Math.random() - 0.5) * 0.1)
    1443        );
    1444      }
    
  • L1463

    ts
    1461    private selectAction(state: number[]): number[] {
    1462      const action = new Array<number>(this.tasks.length);
    1463      if (Math.random() < this.epsilon) {
    1464        // Explore: random assignment
    1465        for (let t = 0; t < this.tasks.length; t++) {
    
  • L1466

    ts
    1464        // Explore: random assignment
    1465        for (let t = 0; t < this.tasks.length; t++) {
    1466          action[t] = Math.floor(Math.random() * this.drones.length);
    1467        }
    1468      } else {
    
  • L1524

    ts
    1522      const batch: Experience[] = [];
    1523      for (let i = 0; i < this.batchSize; i++) {
    1524        const idx = Math.floor(Math.random() * this.replayBuffer.length);
    1525        batch.push(this.replayBuffer[idx]);
    1526      }
    

libs/oya/core/src/video-streaming.ts#

  • L1059

    ts
    1057    connect(timestamp: number): { success: boolean; latencyMs: number } {
    1058      // Model connection with simulated handshake latency
    1059      const handshakeLatency = 50 + Math.random() * 150;
    1060      this.connected = true;
    1061      this.connectTime = timestamp;
    
  • L1210

    ts
    1208    /** Create a new session. */
    1209    createSession(clientIp: string, transport: 'udp' | 'tcp', timestamp: number): string {
    1210      const id = `session_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    1211      this.sessions.set(id, {
    1212        id,
    
  • L1521

    ts
    1519
    1520      // Simulate packet loss and retransmission
    1521      const lossRate = 0.001 + Math.random() * 0.01;
    1522      const lostPackets = Math.round(packets * lossRate);
    1523      const retransmissions = lostPackets; // ARQ retransmits
    
  • L1529

    ts
    1527      this.packetsTotal += packets;
    1528      this.packetsLost += lostPackets;
    1529      this.rttMs = 10 + Math.random() * 40;
    1530
    1531      return { sent: true, packetsUsed: packets + retransmissions, retransmissions };
    
  • L3467

    ts
    3465    connect(): { success: boolean; sessionId: string } {
    3466      this.connected = true;
    3467      const sessionId = `aph_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
    3468      return { success: true, sessionId };
    3469    }
    

libs/oya/core/src/visual-slam.ts#

  • L1734

    ts
    1732   *
    1733   * This is honest CPU code: every output is computed from the inputs;
    1734   * no Math.random, no fixed return literals. Real CUDA backends should
    1735   * implement {@link VisualSLAMBackend} and slot in via config.
    1736   */
    
  • L3087

    ts
    3085      let bestInliers = 0;
    3086      for (let iter = 0; iter < this.config.ransacIterations; iter++) {
    3087        const sample = matches[Math.floor(Math.random() * matches.length)];
    3088        const du = current[sample.ci].u - reference[sample.ri].u;
    3089        const dv = current[sample.ci].v - reference[sample.ri].v;
    

libs/oya/core/src/yolov12-integration.ts#

  • L2428

    ts
    2426      for (const cat of categories) {
    2427        const difficulty = categoryDifficulty[cat] ?? 0.7;
    2428        const ap = this.bestMAP50 * difficulty * (0.9 + Math.random() * 0.2);
    2429        perCategoryAP.set(cat, clamp(ap, 0, 1));
    2430        totalAP += ap;
    

libs/psyche/accessibility/src/visual-alerts.ts#

  • L354

    ts
    352      // Create event
    353      const event: VisualAlertEvent = {
    354        id: `alert-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`,
    355        timestamp: new Date(),
    356        audioEvent: eventType,
    

libs/psyche/action-safety/src/confirmation.ts#

  • L57

    ts
    55      const now = Date.now();
    56      const request: ConfirmationRequest = {
    57        id: `confirm-${now}-${Math.random().toString(36).slice(2, 9)}`,
    58        action,
    59        safetyResult,
    

libs/psyche/action-safety/src/safety-checker.ts#

  • L285

    ts
    283
    284      const event: SafetyAuditEvent = {
    285        id: `audit-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    286        type,
    287        action,
    

libs/psyche/aiops-anomaly/src/statistical-detection.ts#

  • L81

    ts
    79  export function generateAnomalyId(prefix: string = 'anom'): string {
    80    const ts = Date.now().toString(36);
    81    const rand = Math.random().toString(36).slice(2, 8);
    82    return `${prefix}_${ts}_${rand}`;
    83  }
    

libs/psyche/attention-tracker/src/heatmap-generator.ts#

  • L25

    ts
    23   */
    24  function generateId(): string {
    25    return `heatmap_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    26  }
    27
    

libs/psyche/attention-tracker/src/lapse-detector.ts#

  • L25

    ts
    23   */
    24  function generateId(prefix: string): string {
    25    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    26  }
    27
    

libs/psyche/attention-tracker/src/shift-detector.ts#

  • L25

    ts
    23   */
    24  function generateId(): string {
    25    return `shift_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    26  }
    27
    

libs/psyche/attention-tracker/src/tracker.ts#

  • L45

    ts
    43   */
    44  function generateId(prefix: string): string {
    45    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    46  }
    47
    

libs/psyche/avatar-expressions/src/blendshapes.ts#

  • L368

    ts
    366    const result = cloneWeights(weights);
    367
    368    const addVariation = () => (Math.random() - 0.5) * 2 * randomVariation;
    369
    370    for (const name of LEFT_SIDE_BLENDSHAPES) {
    

libs/psyche/avatar-expressions/src/micro-expressions.ts#

  • L131

    ts
    129      // Random duration within range
    130      const [minDuration, maxDuration] = profile.durationRange;
    131      const duration = minDuration + Math.random() * (maxDuration - minDuration);
    132
    133      this.activeExpression = {
    
  • L283

    ts
    281   */
    282  export function shouldLeak(probability: number): boolean {
    283    return Math.random() < probability;
    284  }
    285
    
  • L344

    ts
    342        if (shouldLeak(leakageProbability)) {
    343          // Trigger leaked micro-expression
    344          this.generator.trigger(this.suppressedEmotion, 0.5 + Math.random() * 0.3);
    345        }
    346      }
    
  • L470

    ts
    468    const profile = MICRO_EXPRESSION_PROFILES[type];
    469    const [min, max] = profile.durationRange;
    470    return min + Math.random() * (max - min);
    471  }
    472
    

libs/psyche/avatar-expressions/src/presets.ts#

  • L289

    ts
    287      if (result[key] > 0) {
    288        // Add random variation scaled by current value
    289        const randomOffset = (Math.random() - 0.5) * 2 * variation;
    290        result[key] = Math.max(0, Math.min(1, result[key] + result[key] * randomOffset));
    291      }
    

libs/psyche/avatar-isis-integration/src/mesh-to-gaussian.ts#

  • L271

    ts
    269    for (let i = 0; i < vertexCount; i++) {
    270      // Distribute vertices in a sphere for placeholder
    271      const phi = Math.acos(2 * Math.random() - 1);
    272      const theta = 2 * Math.PI * Math.random();
    273      const r = 0.5; // Radius
    
  • L272

    ts
    270      // Distribute vertices in a sphere for placeholder
    271      const phi = Math.acos(2 * Math.random() - 1);
    272      const theta = 2 * Math.PI * Math.random();
    273      const r = 0.5; // Radius
    274
    
  • L305

    ts
    303    if (colors) {
    304      for (let i = 0; i < vertexCount * 3; i++) {
    305        colors[i] = 0.5 + Math.random() * 0.5; // Random colors
    306      }
    307    }
    
  • L369

    ts
    367    // If we don't have enough points, add interpolated ones
    368    while (points.length < adjustedTarget) {
    369      const idx1 = Math.floor(Math.random() * points.length);
    370      const idx2 = Math.floor(Math.random() * points.length);
    371      const p1 = points[idx1];
    
  • L370

    ts
    368    while (points.length < adjustedTarget) {
    369      const idx1 = Math.floor(Math.random() * points.length);
    370      const idx2 = Math.floor(Math.random() * points.length);
    371      const p1 = points[idx1];
    372      const p2 = points[idx2];
    
  • L375

    ts
    373
    374      if (p1 && p2) {
    375        const t = Math.random();
    376        points.push({
    377          position: [
    

libs/psyche/avatar-training/src/backend.ts#

  • L100

    ts
    98          this.metrics = {
    99            ...this.metrics!,
    100            gaussianCount: this.metrics!.gaussianCount + Math.floor(Math.random() * 1000),
    101          };
    102          this.emitEvent({
    
  • L226

    ts
    224      const config = this.config!;
    225      const progress = this.currentIteration / config.iterations;
    226      const noise = () => (Math.random() - 0.5) * 0.02;
    227
    228      // Simulate improving metrics
    

libs/psyche/avatar-training/src/preprocessing.ts#

  • L706

    ts
    704          ? Array(100)
    705              .fill(0)
    706              .map(() => Math.random() * 0.1)
    707          : null,
    708      };
    
  • L721

    ts
    719    ): ProcessedFrame {
    720      const timestamp = index / config.targetFps;
    721      const isValid = Math.random() > 0.05; // 95% valid frames
    722
    723      return {
    
  • L727

    ts
    725        timestamp,
    726        faceDetection: {
    727          confidence: 0.95 + Math.random() * 0.05,
    728          boundingBox: {
    729            x: 200 + Math.random() * 50,
    
  • L729

    ts
    727          confidence: 0.95 + Math.random() * 0.05,
    728          boundingBox: {
    729            x: 200 + Math.random() * 50,
    730            y: 100 + Math.random() * 30,
    731            width: 400,
    
  • L730

    ts
    728          boundingBox: {
    729            x: 200 + Math.random() * 50,
    730            y: 100 + Math.random() * 30,
    731            width: 400,
    732            height: 400,
    
  • L745

    ts
    743          landmarks2d: Array(68)
    744            .fill(null)
    745            .map(() => [300 + Math.random() * 100, 300 + Math.random() * 100]) as [number, number][],
    746          confidence: 0.9 + Math.random() * 0.1,
    747        },
    
  • L746

    ts
    744            .fill(null)
    745            .map(() => [300 + Math.random() * 100, 300 + Math.random() * 100]) as [number, number][],
    746          confidence: 0.9 + Math.random() * 0.1,
    747        },
    748        alignment: {
    
  • L766

    ts
    764              shape: Array(100)
    765                .fill(0)
    766                .map(() => Math.random() * 0.1),
    767              expression: Array(50)
    768                .fill(0)
    
  • L769

    ts
    767              expression: Array(50)
    768                .fill(0)
    769                .map(() => (Math.random() - 0.5) * 0.5 * Math.sin(index / 10)),
    770              pose: [0, 0, 0, Math.sin(index / 20) * 0.1, 0, 0],
    771              translation: [0, 0, 2.5],
    
  • L773

    ts
    771              translation: [0, 0, 2.5],
    772              scale: 1.0,
    773              loss: 0.001 + Math.random() * 0.001,
    774              reprojectionError: 1 + Math.random() * 0.5,
    775            }
    
  • L774

    ts
    772              scale: 1.0,
    773              loss: 0.001 + Math.random() * 0.001,
    774              reprojectionError: 1 + Math.random() * 0.5,
    775            }
    776          : null,
    
  • L789

    ts
    787          : [],
    788        quality: {
    789          sharpness: 80 + Math.random() * 40,
    790          brightness: 100 + Math.random() * 50,
    791          contrast: 50 + Math.random() * 20,
    
  • L790

    ts
    788        quality: {
    789          sharpness: 80 + Math.random() * 40,
    790          brightness: 100 + Math.random() * 50,
    791          contrast: 50 + Math.random() * 20,
    792          isValid,
    
  • L791

    ts
    789          sharpness: 80 + Math.random() * 40,
    790          brightness: 100 + Math.random() * 50,
    791          contrast: 50 + Math.random() * 20,
    792          isValid,
    793          rejectionReason: isValid ? null : 'Motion blur detected',
    

libs/psyche/behavior-anomaly-detector/src/conflict-detector.ts#

  • L27

    ts
    25   */
    26  function generateId(): string {
    27    return `conflict-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    28  }
    29
    

libs/psyche/behavior-anomaly-detector/src/erratic-behavior-detector.ts#

  • L25

    ts
    23   */
    24  function generateId(): string {
    25    return `erratic-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    26  }
    27
    

libs/psyche/behavior-anomaly-detector/src/inactivity-detector.ts#

  • L25

    ts
    23   */
    24  function generateId(): string {
    25    return `inact-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    26  }
    27
    

libs/psyche/behavior-prediction/src/behavior-modeler.ts#

  • L157

    ts
    155  export function generateId(prefix: string): string {
    156    const ts = Date.now().toString(36);
    157    const rand = Math.random().toString(36).slice(2, 8);
    158    return `${prefix}_${ts}_${rand}`;
    159  }
    

libs/psyche/browser-automation/src/utils.ts#

  • L654

    ts
    652   */
    653  export function randomDelay(min: number, max: number): number {
    654    return Math.floor(Math.random() * (max - min + 1)) + min;
    655  }
    656
    
  • L662

    ts
    660  export function randomPointInBox(box: BoundingBox): { x: number; y: number } {
    661    return {
    662      x: box.x + Math.random() * box.width,
    663      y: box.y + Math.random() * box.height,
    664    };
    
  • L663

    ts
    661    return {
    662      x: box.x + Math.random() * box.width,
    663      y: box.y + Math.random() * box.height,
    664    };
    665  }
    
  • L672

    ts
    670  export function addJitter(value: number, jitterPercent: number): number {
    671    const jitter = value * (jitterPercent / 100);
    672    return value + (Math.random() * 2 - 1) * jitter;
    673  }
    

libs/psyche/conferencing-core/src/conference-session.ts#

  • L39

    ts
    37   */
    38  function generateId(): string {
    39    return Math.random().toString(36).substring(2, 11);
    40  }
    41
    

libs/psyche/conferencing-core/src/multi-language-audio.ts#

  • L557

    ts
    555  function generateId(prefix: string): string {
    556    const ts = Date.now().toString(36);
    557    const rand = Math.random().toString(36).substring(2, 10);
    558    return `${prefix}_${ts}_${rand}`;
    559  }
    

libs/psyche/conferencing-core/src/stream-recording.ts#

  • L746

    ts
    744    _idCounter += 1;
    745    const ts = Date.now().toString(36);
    746    const rnd = Math.random().toString(36).substring(2, 8);
    747    return `${prefix}_${ts}_${rnd}_${_idCounter}`;
    748  }
    

libs/psyche/conferencing-core/src/virtual-camera-switching.ts#

  • L1989

    ts
    1987        layers: sourceScene.layers.map((layer) => ({
    1988          ...layer,
    1989          id: `${layer.id}-copy-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
    1990          source: { ...layer.source },
    1991          position: { ...layer.position },
    

libs/psyche/database-sharding/src/shard-routing.ts#

  • L176

    ts
    174  export function generateShardId(prefix: string): string {
    175    const ts = Date.now().toString(36);
    176    const rand = Math.random().toString(36).substring(2, 8);
    177    idCounter = (idCounter + 1) % 1000000;
    178    return `${prefix}_${ts}_${rand}_${idCounter.toString(36)}`;
    

libs/psyche/dialogue-manager/src/conversation-state.ts#

  • L187

    ts
    185   */
    186  function generateId(): string {
    187    return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
    188  }
    189
    

libs/psyche/dialogue-manager/src/need-prediction.ts#

  • L1029

    ts
    1027  function generateId(prefix: string): string {
    1028    idCounter++;
    1029    return `${prefix}-${Date.now()}-${idCounter}-${Math.random().toString(36).slice(2, 8)}`;
    1030  }
    1031
    

libs/psyche/disaster-recovery/src/backup-management.ts#

  • L92

    ts
    90  export function generateDRId(prefix: string = 'dr'): string {
    91    const ts = Date.now().toString(36);
    92    const rand = Math.random().toString(36).slice(2, 8);
    93    return `${prefix}_${ts}_${rand}`;
    94  }
    

libs/psyche/emotion-recognition/src/learned-fusion.ts#

  • L708

    ts
    706   */
    707  function gaussianRandom(mean: number = 0, stddev: number = 1): number {
    708    const u1 = Math.random();
    709    const u2 = Math.random();
    710    const z = Math.sqrt(-2 * Math.log(u1 + EPSILON)) * Math.cos(2 * Math.PI * u2);
    
  • L709

    ts
    707  function gaussianRandom(mean: number = 0, stddev: number = 1): number {
    708    const u1 = Math.random();
    709    const u2 = Math.random();
    710    const z = Math.sqrt(-2 * Math.log(u1 + EPSILON)) * Math.cos(2 * Math.PI * u2);
    711    return mean + stddev * z;
    
  • L2403

    ts
    2401  function shuffleArrayInPlace<T>(arr: T[]): void {
    2402    for (let i = arr.length - 1; i > 0; i--) {
    2403      const j = Math.floor(Math.random() * (i + 1));
    2404      const temp = arr[i]!;
    2405      arr[i] = arr[j]!;
    
  • L2414

    ts
    2412   */
    2413  function generateId(): string {
    2414    return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    2415  }
    2416
    

libs/psyche/engagement-detector/src/detector.ts#

  • L37

    ts
    35   */
    36  function generateId(): string {
    37    return `eng_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    38  }
    39
    

libs/psyche/gaze-control/src/conversation.ts#

  • L194

    ts
    192        this.ratios.speakerListenerRatio * (1 - this.authorityEyeContactSuppression * authority);
    193
    194      if (Math.random() < threshold) {
    195        this.currentGazeAtUser = true;
    196        this.lastGazeSwitchMs = currentTimeMs;
    
  • L203

    ts
    201
    202        // Authority may cause downward gaze
    203        if (authority > 0 && Math.random() < this.authorityDownwardAversionRatio * authority) {
    204          return { shouldLookAtUser: false, targetHint: 'down' };
    205        }
    
  • L217

    ts
    215        this.ratios.listenerSpeakerRatio * (1 - this.authorityEyeContactSuppression * authority);
    216
    217      if (Math.random() < threshold) {
    218        this.currentGazeAtUser = true;
    219        this.lastGazeSwitchMs = currentTimeMs;
    
  • L225

    ts
    223        mouthRatio = Math.max(0, Math.min(1, mouthRatio + this.authorityMouthFocusBoost * authority));
    224
    225        if (Math.random() < mouthRatio) {
    226          return { shouldLookAtUser: true, targetHint: 'mouth' };
    227        }
    
  • L233

    ts
    231        this.lastGazeSwitchMs = currentTimeMs;
    232
    233        if (authority > 0 && Math.random() < this.authorityDownwardAversionRatio * authority) {
    234          return { shouldLookAtUser: false, targetHint: 'down' };
    235        }
    
  • L246

    ts
    244      const threshold = 1 - this.ratios.thinkingAversionRatio;
    245
    246      if (Math.random() < threshold) {
    247        this.currentGazeAtUser = true;
    248        this.lastGazeSwitchMs = currentTimeMs;
    
  • L261

    ts
    259     */
    260    private handleIdleGaze(currentTimeMs: number): GazeDirectionResult {
    261      if (Math.random() < 0.5) {
    262        this.currentGazeAtUser = true;
    263        this.lastGazeSwitchMs = currentTimeMs;
    

libs/psyche/gaze-control/src/fixation.ts#

  • L122

    ts
    120      // Get duration range for context
    121      const range = this.currentDurations[context] ?? this.currentDurations.baseline;
    122      let baseDuration = range[0] + Math.random() * (range[1] - range[0]);
    123
    124      // Use target's duration hint if provided
    
  • L263

    ts
    261    generateDuration(context: FixationContext, cognitiveLoad = 0.5): number {
    262      const range = this.getDurationRange(context);
    263      const baseDuration = range[0] + Math.random() * (range[1] - range[0]);
    264      return baseDuration * (1.0 + 0.3 * cognitiveLoad);
    265    }
    

libs/psyche/gaze-control/src/microsaccade.ts#

  • L84

    ts
    82    private scheduleNextMicrosaccade(currentTimeMs: number): number {
    83      const [minFreq, maxFreq] = this.params.frequencyRange;
    84      const freq = minFreq + Math.random() * (maxFreq - minFreq);
    85      let interval = 1000 / freq; // Convert to ms
    86
    
  • L88

    ts
    86
    87      // Add some randomness (±30%)
    88      interval *= 0.7 + Math.random() * 0.6;
    89
    90      return currentTimeMs + interval;
    
  • L100

    ts
    98      const amplitude =
    99        this.params.minAmplitude +
    100        Math.random() * (this.params.maxAmplitude - this.params.minAmplitude);
    101
    102      // Random direction
    
  • L103

    ts
    101
    102      // Random direction
    103      const angle = Math.random() * 2 * Math.PI;
    104
    105      this.state.targetOffset = {
    
  • L113

    ts
    111      this.state.duration =
    112        this.params.durationRange[0] +
    113        Math.random() * (this.params.durationRange[1] - this.params.durationRange[0]);
    114      this.state.inProgress = true;
    115    }
    
  • L171

    ts
    169    private generateDrift(): GazeVector {
    170      // Box-Muller transform for Gaussian noise
    171      const u1 = Math.random();
    172      const u2 = Math.random();
    173      const gauss = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L172

    ts
    170      // Box-Muller transform for Gaussian noise
    171      const u1 = Math.random();
    172      const u2 = Math.random();
    173      const gauss = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    174
    
  • L175

    ts
    173      const gauss = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    174
    175      const u3 = Math.random();
    176      const u4 = Math.random();
    177      const gauss2 = Math.sqrt(-2 * Math.log(u3)) * Math.cos(2 * Math.PI * u4);
    
  • L176

    ts
    174
    175      const u3 = Math.random();
    176      const u4 = Math.random();
    177      const gauss2 = Math.sqrt(-2 * Math.log(u3)) * Math.cos(2 * Math.PI * u4);
    178
    
  • L290

    ts
    288    params: MicrosaccadeParams = DEFAULT_MICROSACCADE_PARAMS
    289  ): number {
    290    return params.minAmplitude + Math.random() * (params.maxAmplitude - params.minAmplitude);
    291  }
    292
    
  • L297

    ts
    295   */
    296  export function generateMicrosaccadeDirection(): number {
    297    return Math.random() * 2 * Math.PI;
    298  }
    299
    

libs/psyche/gaze-control/src/saccade.ts#

  • L88

    ts
    86     */
    87    private gaussianRandom(): number {
    88      const u1 = Math.random();
    89      const u2 = Math.random();
    90      return Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L89

    ts
    87    private gaussianRandom(): number {
    88      const u1 = Math.random();
    89      const u2 = Math.random();
    90      return Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    91    }
    

libs/psyche/gaze-control/src/targets.ts#

  • L113

    ts
    111
    112    if (direction === 'random') {
    113      direction = (['left', 'right', 'up'] as const)[Math.floor(Math.random() * 3)];
    114    }
    115
    
  • L118

    ts
    116    switch (direction) {
    117      case 'left':
    118        yaw = -0.5 - Math.random() * 0.3; // -0.5 to -0.8 (30-45 degrees left)
    119        pitch = (Math.random() - 0.5) * 0.4; // -0.2 to 0.2
    120        type = 'off_camera_left';
    
  • L119

    ts
    117      case 'left':
    118        yaw = -0.5 - Math.random() * 0.3; // -0.5 to -0.8 (30-45 degrees left)
    119        pitch = (Math.random() - 0.5) * 0.4; // -0.2 to 0.2
    120        type = 'off_camera_left';
    121        break;
    
  • L123

    ts
    121        break;
    122      case 'right':
    123        yaw = 0.5 + Math.random() * 0.3; // 0.5 to 0.8 (30-45 degrees right)
    124        pitch = (Math.random() - 0.5) * 0.4;
    125        type = 'off_camera_right';
    
  • L124

    ts
    122      case 'right':
    123        yaw = 0.5 + Math.random() * 0.3; // 0.5 to 0.8 (30-45 degrees right)
    124        pitch = (Math.random() - 0.5) * 0.4;
    125        type = 'off_camera_right';
    126        break;
    
  • L128

    ts
    126        break;
    127      case 'up':
    128        yaw = (Math.random() - 0.5) * 0.6; // -0.3 to 0.3
    129        pitch = 0.4 + Math.random() * 0.3; // 0.4 to 0.7
    130        type = 'off_camera_up';
    
  • L129

    ts
    127      case 'up':
    128        yaw = (Math.random() - 0.5) * 0.6; // -0.3 to 0.3
    129        pitch = 0.4 + Math.random() * 0.3; // 0.4 to 0.7
    130        type = 'off_camera_up';
    131        break;
    
  • L133

    ts
    131        break;
    132      case 'down':
    133        yaw = (Math.random() - 0.5) * 0.6;
    134        pitch = -0.3 - Math.random() * 0.2; // -0.3 to -0.5
    135        type = 'off_camera_down';
    
  • L134

    ts
    132      case 'down':
    133        yaw = (Math.random() - 0.5) * 0.6;
    134        pitch = -0.3 - Math.random() * 0.2; // -0.3 to -0.5
    135        type = 'off_camera_down';
    136        break;
    
  • L154

    ts
    152  ): GazeTarget {
    153    const direction =
    154      preferDirection === 'auto' ? (Math.random() < 0.5 ? 'left' : 'right') : preferDirection;
    155
    156    const yaw = direction === 'left' ? -0.3 - Math.random() * 0.2 : 0.3 + Math.random() * 0.2;
    
  • L156

    ts
    154      preferDirection === 'auto' ? (Math.random() < 0.5 ? 'left' : 'right') : preferDirection;
    155
    156    const yaw = direction === 'left' ? -0.3 - Math.random() * 0.2 : 0.3 + Math.random() * 0.2;
    157    const pitch = 0.2 + Math.random() * 0.2; // Looking up
    158
    
  • L157

    ts
    155
    156    const yaw = direction === 'left' ? -0.3 - Math.random() * 0.2 : 0.3 + Math.random() * 0.2;
    157    const pitch = 0.2 + Math.random() * 0.2; // Looking up
    158
    159    return {
    
  • L163

    ts
    161      position: createGazeVector(yaw, pitch),
    162      priority: 0.6,
    163      durationHint: 0.6 + Math.random() * 0.6, // Longer for thinking
    164      distanceM: 1.2,
    165    };
    
  • L388

    ts
    386    private sampleTransition(transitions: GazeTransition[]): GazeTargetType {
    387      const total = transitions.reduce((sum, t) => sum + t.probability, 0);
    388      let random = Math.random() * total;
    389
    390      for (const { targetType, probability } of transitions) {
    
  • L413

    ts
    411
    412      if (total <= 0) {
    413        return Math.random() < 0.5 ? 'left' : 'right';
    414      }
    415
    
  • L416

    ts
    414      }
    415
    416      let random = Math.random() * total;
    417      const directions: Array<'left' | 'right' | 'up' | 'down'> = ['left', 'right', 'up', 'down'];
    418
    

libs/psyche/gesture-system/src/controller.ts#

  • L268

    ts
    266
    267      // Pick random
    268      const gesture = available[Math.floor(Math.random() * available.length)];
    269      return this.triggerGesture(gesture.type, currentTimeMs);
    270    }
    

libs/psyche/gesture-system/src/variation.ts#

  • L178

    ts
    176     */
    177    private randomJitter(maxJitter: number): number {
    178      return (Math.random() - 0.5) * 2 * maxJitter;
    179    }
    180
    
  • L236

    ts
    234    if (handedness === 'ambidextrous') {
    235      // Randomly choose
    236      if (Math.random() < 0.5) {
    237        return type;
    238      }
    

libs/psyche/head-movement/src/environmental.ts#

  • L92

    ts
    90
    91      // Check if response probability passes
    92      if (Math.random() > this.getResponseProbability()) {
    93        return;
    94      }
    

libs/psyche/head-movement/src/idle.ts#

  • L85

    ts
    83        timeSinceRecenter: 0,
    84        isSettling: false,
    85        swayPhase: Math.random() * Math.PI * 2,
    86      };
    87    }
    
  • L94

    ts
    92    private generateDriftDirection(): HeadPose {
    93      return createHeadPose(
    94        (Math.random() - 0.5) * 0.01,
    95        (Math.random() - 0.5) * 0.01,
    96        (Math.random() - 0.5) * 0.005
    
  • L95

    ts
    93      return createHeadPose(
    94        (Math.random() - 0.5) * 0.01,
    95        (Math.random() - 0.5) * 0.01,
    96        (Math.random() - 0.5) * 0.005
    97      );
    
  • L96

    ts
    94        (Math.random() - 0.5) * 0.01,
    95        (Math.random() - 0.5) * 0.01,
    96        (Math.random() - 0.5) * 0.005
    97      );
    98    }
    

libs/psyche/head-movement/src/nods.ts#

  • L184

    ts
    182
    183      // Roll the dice
    184      return Math.random() < probability;
    185    }
    186
    

libs/psyche/head-movement/src/tilts.ts#

  • L105

    ts
    103
    104      // Randomize preferred direction
    105      this.preferredDirection = Math.random() < 0.5 ? -1 : 1;
    106    }
    107
    
  • L361

    ts
    359        if (elapsedSinceLast >= this.nextPauseMs) {
    360          // Maybe switch direction
    361          if (Math.random() < this.directionSwitchProbability) {
    362            this.tiltController.alternateDirection();
    363          }
    
  • L379

    ts
    377     */
    378    private scheduleNextPause(): void {
    379      this.nextPauseMs = this.minPauseMs + Math.random() * (this.maxPauseMs - this.minPauseMs);
    380    }
    381
    
  • L386

    ts
    384     */
    385    private applyJitter(pose: HeadPose): HeadPose {
    386      const jitterScale = 1 + (Math.random() - 0.5) * 2 * this.poseJitter;
    387      return {
    388        pitch: pose.pitch * jitterScale,
    

libs/psyche/human-evaluation/src/session-manager.ts#

  • L555

    ts
    553    private shuffleArray<T>(array: T[]): T[] {
    554      for (let i = array.length - 1; i > 0; i--) {
    555        const j = Math.floor(Math.random() * (i + 1));
    556        [array[i], array[j]] = [array[j], array[i]];
    557      }
    

libs/psyche/k8s-federation/src/cluster-management.ts#

  • L124

    ts
    122  export function generateFederationId(prefix: string = 'fed'): string {
    123    const ts = Date.now().toString(36);
    124    const rand = Math.random().toString(36).slice(2, 8);
    125    return `${prefix}_${ts}_${rand}`;
    126  }
    

libs/psyche/k8s-security/src/irsa.ts#

  • L655

    ts
    653    }): void {
    654      const event: SecurityAuditEvent = {
    655        id: `audit_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    656        timestamp: new Date(),
    657        eventType: params.eventType,
    

libs/psyche/k8s-security/src/pod-security.ts#

  • L740

    ts
    738    }): void {
    739      const event: SecurityAuditEvent = {
    740        id: `audit_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    741        timestamp: new Date(),
    742        eventType: params.eventType,
    

libs/psyche/latency-analysis/src/alerting.ts#

  • L65

    ts
    63      const rule: AlertRule = {
    64        ...params,
    65        id: `rule_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as AlertId,
    66        createdAt: new Date(),
    67        updatedAt: new Date(),
    
  • L217

    ts
    215        // Create or update alert
    216        const alert: Alert = {
    217          id: existingAlert?.id ?? `alert_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    218          ruleId: rule.id,
    219          ruleName: rule.name,
    
  • L324

    ts
    322
    323        const alert: Alert = {
    324          id: `alert_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    325          ruleId: rule.id,
    326          ruleName: rule.name,
    

libs/psyche/latency-analysis/src/components.ts#

  • L44

    ts
    42      const component: Component = {
    43        ...params,
    44        id: `comp_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as ComponentId,
    45        createdAt: new Date(),
    46        updatedAt: new Date(),
    
  • L395

    ts
    393
    394    constructor(service: string, operation: string) {
    395      this.traceId = `trace_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as TraceId;
    396      this.service = service;
    397      this.operation = operation;
    
  • L405

    ts
    403     */
    404    startSpan(componentId: ComponentId, operation: string): SpanId {
    405      const spanId = `span_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as SpanId;
    406      const parentSpanId =
    407        this.spanStack.length > 0 ? this.spanStack[this.spanStack.length - 1] : undefined;
    

libs/psyche/latency-analysis/src/histogram.ts#

  • L86

    ts
    84      } else {
    85        // Reservoir sampling for memory efficiency
    86        const idx = Math.floor(Math.random() * this.count);
    87        if (idx < this.maxSamples) {
    88          this.samples[idx] = {
    
  • L244

    ts
    242        // Shuffle and take first maxSamples
    243        for (let i = combinedSamples.length - 1; i > 0; i--) {
    244          const j = Math.floor(Math.random() * (i + 1));
    245          [combinedSamples[i], combinedSamples[j]] = [combinedSamples[j], combinedSamples[i]];
    246        }
    

libs/psyche/latency-analysis/src/regression.ts#

  • L532

    ts
    530
    531      return {
    532        id: `reg_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as RegressionId,
    533        componentId,
    534        operation,
    

libs/psyche/meet-integration/src/api.ts#

  • L265

    ts
    263        conferenceData: {
    264          createRequest: {
    265            requestId: `meet-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    266            conferenceSolutionKey: {
    267              type: options.conferenceSolutionType ?? 'hangoutsMeet',
    

libs/psyche/meeting-summarizer/src/summarizer.ts#

  • L50

    ts
    48  function uid(prefix: string): string {
    49    const ts = Date.now().toString(36);
    50    const rand = Math.random().toString(36).slice(2, 8);
    51    return `${prefix}_${ts}_${rand}`;
    52  }
    

libs/psyche/memory-archival/src/types.ts#

  • L473

    ts
    471  export function generateArchivalId(): string {
    472    const timestamp = Date.now().toString(36);
    473    const random = Math.random().toString(36).slice(2, 10);
    474    return `arch_${timestamp}_${random}`;
    475  }
    

libs/psyche/memory-core/src/types.ts#

  • L515

    ts
    513  export function generateBlockId(): string {
    514    const timestamp = Date.now().toString(36);
    515    const random = Math.random().toString(36).slice(2, 10);
    516    return `blk_${timestamp}_${random}`;
    517  }
    

libs/psyche/memory-in-context/src/types.ts#

  • L344

    ts
    342  export function generateId(prefix: string = 'id'): string {
    343    const timestamp = Date.now().toString(36);
    344    const random = Math.random().toString(36).slice(2, 10);
    345    return `${prefix}_${timestamp}_${random}`;
    346  }
    

libs/psyche/memory-persistence/src/persistence-manager.ts#

  • L712

    ts
    710    private generateSessionId(): string {
    711      const timestamp = Date.now().toString(36);
    712      const random = Math.random().toString(36).slice(2, 10);
    713      return `session_${timestamp}_${random}`;
    714    }
    

libs/psyche/memory-tools/src/types.ts#

  • L325

    ts
    323  export function generateToolCallId(): string {
    324    const timestamp = Date.now().toString(36);
    325    const random = Math.random().toString(36).slice(2, 8);
    326    return `tc_${timestamp}_${random}`;
    327  }
    

libs/psyche/memory-working/src/types.ts#

  • L213

    ts
    211  export function generateEntryId(): string {
    212    const timestamp = Date.now().toString(36);
    213    const random = Math.random().toString(36).slice(2, 10);
    214    return `wm_${timestamp}_${random}`;
    215  }
    
  • L382

    ts
    380      const minMultiplier = 1 - variability;
    381      const maxMultiplier = 1 + variability;
    382      const multiplier = minMultiplier + Math.random() * (maxMultiplier - minMultiplier);
    383
    384      let interval = avgIntervalMs * multiplier;
    
  • L443

    ts
    441      const isIncomplete =
    442        this.config.incompleteBlinkProbability > 0 &&
    443        Math.random() < this.config.incompleteBlinkProbability;
    444
    445      // Determine if this should be a double blink
    
  • L447

    ts
    445      // Determine if this should be a double blink
    446      const isDouble =
    447        this.config.allowDoubleBlinks && Math.random() < this.config.doubleBlinkProbability;
    448
    449      // Add slight natural asymmetry
    
  • L450

    ts
    448
    449      // Add slight natural asymmetry
    450      const asymmetry = (Math.random() - 0.5) * 0.15;
    451
    452      this.generator.trigger('spontaneous', {
    

libs/psyche/micro-expressions/src/eye-moisture.ts#

  • L109

    ts
    107
    108      // Apply slight asymmetry
    109      const asymmetry = (Math.random() - 0.5) * 0.1;
    110      this.stateData.leftMoisture = Math.min(
    111        this.config.maxMoisture,
    
  • L180

    ts
    178
    179      // Apply to each eye with slight variation
    180      const variance = (Math.random() - 0.5) * 0.02;
    181      this.stateData.leftMoisture = Math.max(0, this.stateData.leftMoisture - decay * (1 + variance));
    182      this.stateData.rightMoisture = Math.max(
    

libs/psyche/micro-expressions/src/micro-expressions.ts#

  • L193

    ts
    191      // Random duration within range
    192      const [minDuration, maxDuration] = profile.durationRange;
    193      const duration = minDuration + Math.random() * (maxDuration - minDuration);
    194
    195      this.activeExpression = {
    
  • L354

    ts
    352   */
    353  export function shouldLeak(probability: number): boolean {
    354    return Math.random() < probability;
    355  }
    356
    
  • L476

    ts
    474        if (shouldLeak(scaledProbability)) {
    475          // Calculate leaked intensity (50-80% of full expression)
    476          const leakIntensity = 0.5 + Math.random() * 0.3;
    477
    478          // Trigger leaked micro-expression
    
  • L553

    ts
    551    const profile = MICRO_EXPRESSION_PROFILES[type];
    552    const [min, max] = profile.durationRange;
    553    return min + Math.random() * (max - min);
    554  }
    555
    

libs/psyche/micro-expressions/src/subtle-movements.ts#

  • L248

    ts
    246      // Random duration and intensity within ranges
    247      const [minDur, maxDur] = profile.durationRange;
    248      const duration = minDur + Math.random() * (maxDur - minDur);
    249
    250      const [minInt, maxInt] = profile.intensityRange;
    
  • L251

    ts
    249
    250      const [minInt, maxInt] = profile.intensityRange;
    251      const intensity = options.intensityOverride ?? minInt + Math.random() * (maxInt - minInt);
    252
    253      const state: SubtleMovementState = {
    
  • L431

    ts
    429
    430      const directions = Object.keys(SACCADE_PATTERNS) as SaccadeDirection[];
    431      const direction = directions[Math.floor(Math.random() * directions.length)];
    432      const id = this.generator.triggerSaccade(direction);
    433      this.movementCounts.saccade++;
    
  • L475

    ts
    473
    474        // Roll for triggering
    475        if (Math.random() < probability) {
    476          this.generator.trigger(type);
    477          this.movementCounts[type]++;
    

libs/psyche/ml-log-analysis/src/log-clustering.ts#

  • L165

    ts
    163  export function generateMLLogId(prefix: string): string {
    164    const ts = Date.now().toString(36);
    165    const rand = Math.random().toString(36).substring(2, 8);
    166    idCounter = (idCounter + 1) % 1000000;
    167    return `${prefix}_${ts}_${rand}_${idCounter.toString(36)}`;
    

libs/psyche/mobile-sdk/src/cross-platform.ts#

  • L148

    ts
    146    callNativeMethod(method: BridgeMethod, args: unknown[] = []): BridgeMessage {
    147      const msg: BridgeMessage = {
    148        id: `rn_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    149        method,
    150        args,
    

libs/psyche/mobile-sdk/src/edge-offline.ts#

  • L215

    ts
    213        text: `[Edge inference response for: ${prompt.slice(0, 50)}...]`,
    214        tokensGenerated: tokens,
    215        latencyMs: 50 + Math.random() * 100,
    216      };
    217    }
    
  • L429

    ts
    427      const now = Date.now();
    428      const entry: OfflineCache = {
    429        id: `cache_${now}_${Math.random().toString(36).slice(2, 8)}`,
    430        key,
    431        data,
    

libs/psyche/mobile-sdk/src/multi-agent.ts#

  • L169

    ts
    167          const withExpertise = agentList.filter((a) => a.expertise.length > 0);
    168          if (withExpertise.length === 0) return agentList[0]!.agentId;
    169          return withExpertise[Math.floor(Math.random() * withExpertise.length)]!.agentId;
    170        }
    171        default: {
    
  • L172

    ts
    170        }
    171        default: {
    172          return agentList[Math.floor(Math.random() * agentList.length)]!.agentId;
    173        }
    174      }
    
  • L270

    ts
    268    ): AgentMessage {
    269      return {
    270        id: `msg_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    271        fromAgentId,
    272        toAgentId,
    
  • L396

    ts
    394    createSession(mode: CollaborationMode, agents: AgentConfig[]): CollaborationSession {
    395      const session: CollaborationSession = {
    396        sessionId: `session_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    397        mode,
    398        agents,
    

libs/psyche/noise-handling/src/echo-canceller.ts#

  • L656

    ts
    654
    655        // Generate simple white noise
    656        const noise = (Math.random() * 2 - 1) * this.comfortNoiseLevel;
    657        output[i] = samples[i] + noise;
    658      }
    

libs/psyche/nps/src/calculator.ts#

  • L214

    ts
    212      const sample: NPSScore[] = [];
    213      for (let j = 0; j < scores.length; j++) {
    214        const randomIndex = Math.floor(Math.random() * scores.length);
    215        sample.push(scores[randomIndex]);
    216      }
    

libs/psyche/nps/src/segmentation.ts#

  • L523

    ts
    521
    522    private generateId(): string {
    523      return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    524    }
    525  }
    

libs/psyche/nps/src/survey-manager.ts#

  • L590

    ts
    588
    589    private generateId(): string {
    590      return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    591    }
    592  }
    

libs/psyche/participant-manager/src/body-emotion-correlation.ts#

  • L488

    ts
    486    }
    487    const timestamp = Date.now().toString(36);
    488    const random = Math.random().toString(36).substring(2, 10);
    489    const counter = Math.random().toString(36).substring(2, 6);
    490    return `cor-${timestamp}-${random}-${counter}`;
    
  • L489

    ts
    487    const timestamp = Date.now().toString(36);
    488    const random = Math.random().toString(36).substring(2, 10);
    489    const counter = Math.random().toString(36).substring(2, 6);
    490    return `cor-${timestamp}-${random}-${counter}`;
    491  }
    

libs/psyche/participant-manager/src/body-language-mirror.ts#

  • L685

    ts
    683    }
    684    const timestamp = Date.now().toString(36);
    685    const random = Math.random().toString(36).substring(2, 10);
    686    const counter = Math.random().toString(36).substring(2, 6);
    687    return `mir-${timestamp}-${random}-${counter}`;
    
  • L686

    ts
    684    const timestamp = Date.now().toString(36);
    685    const random = Math.random().toString(36).substring(2, 10);
    686    const counter = Math.random().toString(36).substring(2, 6);
    687    return `mir-${timestamp}-${random}-${counter}`;
    688  }
    

libs/psyche/participant-manager/src/body-language-trends.ts#

  • L523

    ts
    521    }
    522    const timestamp = Date.now().toString(36);
    523    const random = Math.random().toString(36).substring(2, 10);
    524    const counter = Math.random().toString(36).substring(2, 6);
    525    return `trd-${timestamp}-${random}-${counter}`;
    
  • L524

    ts
    522    const timestamp = Date.now().toString(36);
    523    const random = Math.random().toString(36).substring(2, 10);
    524    const counter = Math.random().toString(36).substring(2, 6);
    525    return `trd-${timestamp}-${random}-${counter}`;
    526  }
    

libs/psyche/participant-manager/src/confusion-detector.ts#

  • L505

    ts
    503    }
    504    const timestamp = Date.now().toString(36);
    505    const random = Math.random().toString(36).substring(2, 10);
    506    const counter = Math.random().toString(36).substring(2, 6);
    507    return `${timestamp}-${random}-${counter}`;
    
  • L506

    ts
    504    const timestamp = Date.now().toString(36);
    505    const random = Math.random().toString(36).substring(2, 10);
    506    const counter = Math.random().toString(36).substring(2, 6);
    507    return `${timestamp}-${random}-${counter}`;
    508  }
    

libs/psyche/participant-manager/src/distributed-processing.ts#

  • L609

    ts
    607    const timestamp = Date.now().toString(36);
    608    const counter = distributedIdCounter.toString(36).padStart(4, '0');
    609    const random = Math.random().toString(36).substring(2, 8);
    610    return `dp-${timestamp}-${counter}-${random}`;
    611  }
    

libs/psyche/participant-manager/src/eating-drinking-detector.ts#

  • L605

    ts
    603    }
    604    const timestamp = Date.now().toString(36);
    605    const random = Math.random().toString(36).substring(2, 10);
    606    const counter = Math.random().toString(36).substring(2, 6);
    607    return `${timestamp}-${random}-${counter}`;
    
  • L606

    ts
    604    const timestamp = Date.now().toString(36);
    605    const random = Math.random().toString(36).substring(2, 10);
    606    const counter = Math.random().toString(36).substring(2, 6);
    607    return `${timestamp}-${random}-${counter}`;
    608  }
    

libs/psyche/participant-manager/src/engagement-scorer.ts#

  • L650

    ts
    648    }
    649    const timestamp = Date.now().toString(36);
    650    const random = Math.random().toString(36).substring(2, 10);
    651    const counter = Math.random().toString(36).substring(2, 6);
    652    return `${timestamp}-${random}-${counter}`;
    
  • L651

    ts
    649    const timestamp = Date.now().toString(36);
    650    const random = Math.random().toString(36).substring(2, 10);
    651    const counter = Math.random().toString(36).substring(2, 6);
    652    return `${timestamp}-${random}-${counter}`;
    653  }
    

libs/psyche/participant-manager/src/fatigue-detector.ts#

  • L485

    ts
    483    }
    484    const timestamp = Date.now().toString(36);
    485    const random = Math.random().toString(36).substring(2, 10);
    486    const counter = Math.random().toString(36).substring(2, 6);
    487    return `${timestamp}-${random}-${counter}`;
    
  • L486

    ts
    484    const timestamp = Date.now().toString(36);
    485    const random = Math.random().toString(36).substring(2, 10);
    486    const counter = Math.random().toString(36).substring(2, 6);
    487    return `${timestamp}-${random}-${counter}`;
    488  }
    

libs/psyche/participant-manager/src/gpu-parallel-processor.ts#

  • L930

    ts
    928      // Simulate processing
    929      const jobResults = batch.jobs.map((job) => {
    930        const processingTime = job.estimatedComputeMs * (0.8 + Math.random() * 0.4);
    931        return {
    932          jobId: job.id,
    

libs/psyche/participant-manager/src/informal-leader-detector.ts#

  • L510

    ts
    508    idCounter++;
    509    const timestamp = Date.now().toString(36);
    510    const random = Math.random().toString(36).substring(2, 10);
    511    return `ld-${timestamp}-${random}-${idCounter}`;
    512  }
    

libs/psyche/participant-manager/src/intervention-trigger.ts#

  • L1038

    ts
    1036    }
    1037    const timestamp = Date.now().toString(36);
    1038    const random = Math.random().toString(36).substring(2, 10);
    1039    const counter = Math.random().toString(36).substring(2, 6);
    1040    return `itv-${timestamp}-${random}-${counter}`;
    
  • L1039

    ts
    1037    const timestamp = Date.now().toString(36);
    1038    const random = Math.random().toString(36).substring(2, 10);
    1039    const counter = Math.random().toString(36).substring(2, 6);
    1040    return `itv-${timestamp}-${random}-${counter}`;
    1041  }
    

libs/psyche/participant-manager/src/meeting-history-context.ts#

  • L585

    ts
    583    }
    584    const timestamp = Date.now().toString(36);
    585    const random = Math.random().toString(36).substring(2, 10);
    586    const counter = Math.random().toString(36).substring(2, 6);
    587    return `mhist-${timestamp}-${random}-${counter}`;
    
  • L586

    ts
    584    const timestamp = Date.now().toString(36);
    585    const random = Math.random().toString(36).substring(2, 10);
    586    const counter = Math.random().toString(36).substring(2, 6);
    587    return `mhist-${timestamp}-${random}-${counter}`;
    588  }
    

libs/psyche/participant-manager/src/micro-movement-detector.ts#

  • L561

    ts
    559    }
    560    const timestamp = Date.now().toString(36);
    561    const random = Math.random().toString(36).substring(2, 10);
    562    const counter = Math.random().toString(36).substring(2, 6);
    563    return `${timestamp}-${random}-${counter}`;
    
  • L562

    ts
    560    const timestamp = Date.now().toString(36);
    561    const random = Math.random().toString(36).substring(2, 10);
    562    const counter = Math.random().toString(36).substring(2, 6);
    563    return `${timestamp}-${random}-${counter}`;
    564  }
    

libs/psyche/participant-manager/src/off-camera-talking-detector.ts#

  • L742

    ts
    740    }
    741    const timestamp = Date.now().toString(36);
    742    const random = Math.random().toString(36).substring(2, 10);
    743    const counter = Math.random().toString(36).substring(2, 6);
    744    return `${timestamp}-${random}-${counter}`;
    
  • L743

    ts
    741    const timestamp = Date.now().toString(36);
    742    const random = Math.random().toString(36).substring(2, 10);
    743    const counter = Math.random().toString(36).substring(2, 6);
    744    return `${timestamp}-${random}-${counter}`;
    745  }
    

libs/psyche/participant-manager/src/participant-state-prediction.ts#

  • L475

    ts
    473  export function generatePredictionId(): string {
    474    const timestamp = Date.now().toString(36);
    475    const random = Math.random().toString(36).substring(2, 10);
    476    return `pred_${timestamp}_${random}`;
    477  }
    

libs/psyche/participant-manager/src/processing-latency-monitor.ts#

  • L605

    ts
    603    }
    604    const timestamp = Date.now().toString(36);
    605    const random = Math.random().toString(36).substring(2, 10);
    606    const counter = Math.random().toString(36).substring(2, 6);
    607    return `${timestamp}-${random}-${counter}`;
    
  • L606

    ts
    604    const timestamp = Date.now().toString(36);
    605    const random = Math.random().toString(36).substring(2, 10);
    606    const counter = Math.random().toString(36).substring(2, 6);
    607    return `${timestamp}-${random}-${counter}`;
    608  }
    

libs/psyche/participant-manager/src/recording-manager.ts#

  • L409

    ts
    407    }
    408    const timestamp = Date.now().toString(36);
    409    const random = Math.random().toString(36).substring(2, 10);
    410    const counter = Math.random().toString(36).substring(2, 6);
    411    return `${timestamp}-${random}-${counter}`;
    
  • L410

    ts
    408    const timestamp = Date.now().toString(36);
    409    const random = Math.random().toString(36).substring(2, 10);
    410    const counter = Math.random().toString(36).substring(2, 6);
    411    return `${timestamp}-${random}-${counter}`;
    412  }
    

libs/psyche/participant-manager/src/relationship-inference.ts#

  • L628

    ts
    626    }
    627    const timestamp = Date.now().toString(36);
    628    const random = Math.random().toString(36).substring(2, 10);
    629    const counter = Math.random().toString(36).substring(2, 6);
    630    return `rel-${timestamp}-${random}-${counter}`;
    
  • L629

    ts
    627    const timestamp = Date.now().toString(36);
    628    const random = Math.random().toString(36).substring(2, 10);
    629    const counter = Math.random().toString(36).substring(2, 6);
    630    return `rel-${timestamp}-${random}-${counter}`;
    631  }
    

libs/psyche/participant-manager/src/social-network-mapper.ts#

  • L687

    ts
    685      const shuffled = [...nodes];
    686      for (let i = shuffled.length - 1; i > 0; i--) {
    687        const j = Math.floor(Math.random() * (i + 1));
    688        [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
    689      }
    

libs/psyche/participant-manager/src/stepped-away-detector.ts#

  • L545

    ts
    543    }
    544    const timestamp = Date.now().toString(36);
    545    const random = Math.random().toString(36).substring(2, 10);
    546    const counter = Math.random().toString(36).substring(2, 6);
    547    return `${timestamp}-${random}-${counter}`;
    
  • L546

    ts
    544    const timestamp = Date.now().toString(36);
    545    const random = Math.random().toString(36).substring(2, 10);
    546    const counter = Math.random().toString(36).substring(2, 6);
    547    return `${timestamp}-${random}-${counter}`;
    548  }
    

libs/psyche/participant-manager/src/subtle-emotion-detector.ts#

  • L515

    ts
    513    }
    514    const timestamp = Date.now().toString(36);
    515    const random = Math.random().toString(36).substring(2, 10);
    516    const counter = Math.random().toString(36).substring(2, 6);
    517    return `${timestamp}-${random}-${counter}`;
    
  • L516

    ts
    514    const timestamp = Date.now().toString(36);
    515    const random = Math.random().toString(36).substring(2, 10);
    516    const counter = Math.random().toString(36).substring(2, 6);
    517    return `${timestamp}-${random}-${counter}`;
    518  }
    

libs/psyche/participation-tracker/src/tracker.ts#

  • L49

    ts
    47   */
    48  function generateId(): string {
    49    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    50  }
    51
    

libs/psyche/proactive-suggestions/src/signal-analyzer.ts#

  • L208

    ts
    206  export function generateId(prefix: string): string {
    207    const ts = Date.now().toString(36);
    208    const rand = Math.random().toString(36).slice(2, 8);
    209    return `${prefix}_${ts}_${rand}`;
    210  }
    

libs/psyche/sandbox/src/types.ts#

  • L690

    ts
    688   */
    689  export function generateSandboxId(): string {
    690    return `sandbox_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
    691  }
    

libs/psyche/satisfaction/src/survey-manager.ts#

  • L1034

    ts
    1032
    1033    private generateId(): string {
    1034      return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    1035    }
    1036  }
    

libs/psyche/screen-analysis/src/aria-complex-widget-optimizer.ts#

  • L357

    ts
    355  export function generateWidgetId(): string {
    356    const ts = Date.now().toString(36);
    357    const rand = Math.random().toString(36).substring(2, 8);
    358    return `wgt_${ts}_${rand}`;
    359  }
    
  • L364

    ts
    362  export function generateWidgetIssueId(): string {
    363    const ts = Date.now().toString(36);
    364    const rand = Math.random().toString(36).substring(2, 8);
    365    return `wgi_${ts}_${rand}`;
    366  }
    

libs/psyche/screen-analysis/src/aria-live-region-optimizer.ts#

  • L338

    ts
    336   */
    337  export function generateRegionId(): string {
    338    return `lr_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    339  }
    340
    
  • L345

    ts
    343   */
    344  export function generateLiveRegionIssueId(): string {
    345    return `lri_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    346  }
    347
    

libs/psyche/screen-analysis/src/asl-fingerspelling-generation.ts#

  • L573

    ts
    571  export function generateFingerspellingId(): string {
    572    const ts = Date.now();
    573    const rand = Math.random().toString(36).slice(2, 8);
    574    return `fs_${ts}_${rand}`;
    575  }
    

libs/psyche/screen-analysis/src/asl-sign-library.ts#

  • L4445

    ts
    4443  /** Generate a unique ASL sign ID */
    4444  export function generateASLSignId(): string {
    4445    return `asl_sign_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    4446  }
    4447
    
  • L4672

    ts
    4670
    4671    const numQ = Math.min(count ?? 10, pool.length);
    4672    const shuffled = pool.sort(() => Math.random() - 0.5);
    4673    const questions: ASLSignQuizQuestion[] = [];
    4674
    
  • L4679

    ts
    4677      const distractors = pool
    4678        .filter((s) => s.gloss !== correct.gloss)
    4679        .sort(() => Math.random() - 0.5)
    4680        .slice(0, 3);
    4681
    
  • L4683

    ts
    4681
    4682      const options = [...distractors.map((d) => d.gloss), correct.gloss].sort(
    4683        () => Math.random() - 0.5
    4684      );
    4685
    

libs/psyche/screen-analysis/src/bsl-sign-support.ts#

  • L3091

    ts
    3089  /** Generate a unique BSL sign ID */
    3090  export function generateBSLSignId(): string {
    3091    return `bsl_sign_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    3092  }
    3093
    

libs/psyche/screen-analysis/src/caption-position-memory.ts#

  • L390

    ts
    388  export function generatePositionMemoryId(): string {
    389    const ts = Date.now().toString(36);
    390    const rand = Math.random().toString(36).substring(2, 8);
    391    return `cpm_${ts}_${rand}`;
    392  }
    

libs/psyche/screen-analysis/src/content-change-tracker.ts#

  • L352

    ts
    350    snapshotCounter += 1;
    351    const ts = Date.now().toString(36);
    352    const rand = Math.random().toString(36).substring(2, 8);
    353    return `snap_${ts}_${rand}_${snapshotCounter}`;
    354  }
    
  • L362

    ts
    360    changeCounter += 1;
    361    const ts = Date.now().toString(36);
    362    const rand = Math.random().toString(36).substring(2, 8);
    363    return `chg_${ts}_${rand}_${changeCounter}`;
    364  }
    

libs/psyche/screen-analysis/src/content-relevance-scorer.ts#

  • L453

    ts
    451    const ts = Date.now().toString(36);
    452    const seq = idCounter.toString(36).padStart(4, '0');
    453    const rand = Math.random().toString(36).slice(2, 8);
    454    return `ci_${ts}_${seq}_${rand}`;
    455  }
    
  • L464

    ts
    462    const ts = Date.now().toString(36);
    463    const seq = idCounter.toString(36).padStart(4, '0');
    464    const rand = Math.random().toString(36).slice(2, 8);
    465    return `ct_${ts}_${seq}_${rand}`;
    466  }
    

libs/psyche/screen-analysis/src/crowdsourced-evaluation.ts#

  • L533

    ts
    531  export function generateCrowdEvalId(prefix: string = 'crowd'): string {
    532    const ts = Date.now().toString(36);
    533    const rand = Math.random().toString(36).slice(2, 8);
    534    return `${prefix}_${ts}_${rand}`;
    535  }
    

libs/psyche/screen-analysis/src/cultural-sign-variation.ts#

  • L363

    ts
    361  export function generateVariationId(prefix: string = 'var'): string {
    362    const ts = Date.now().toString(36);
    363    const rand = Math.random().toString(36).slice(2, 8);
    364    return `${prefix}_${ts}_${rand}`;
    365  }
    

libs/psyche/screen-analysis/src/deaf-community-testing.ts#

  • L697

    ts
    695  export function generateCommunityTestingId(prefix: string = 'ct'): string {
    696    const ts = Date.now().toString(36);
    697    const rand = Math.random().toString(36).slice(2, 8);
    698    return `${prefix}_${ts}_${rand}`;
    699  }
    

libs/psyche/screen-analysis/src/haptic-feedback-option.ts#

  • L1129

    ts
    1127        case 'noise':
    1128          // V1-P2-1050: deterministic value-noise instead of
    1129          // Math.random() — same input (waveform, frequency,
    1130          // duration) always produces the same haptic output, so
    1131          // upstream consumers (haptic playback engine, A/B test
    

libs/psyche/screen-analysis/src/human-evaluation.ts#

  • L397

    ts
    395  export function generateEvalId(prefix: string = 'eval'): string {
    396    const ts = Date.now().toString(36);
    397    const rand = Math.random().toString(36).slice(2, 8);
    398    return `${prefix}_${ts}_${rand}`;
    399  }
    

libs/psyche/screen-analysis/src/input-purpose-identifier.ts#

  • L672

    ts
    670   */
    671  export function generatePurposeResultId(): string {
    672    return `ipr_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    673  }
    674
    

libs/psyche/screen-analysis/src/pip-sign-overlay.ts#

  • L379

    ts
    377    pipIdCounter += 1;
    378    const timestamp = Date.now().toString(36);
    379    const random = Math.random().toString(36).substring(2, 8);
    380    return `${prefix}_${timestamp}_${random}_${pipIdCounter}`;
    381  }
    

libs/psyche/screen-analysis/src/pm-tool-detector.ts#

  • L765

    ts
    763    taskIdCounter += 1;
    764    const timestamp = Date.now().toString(36);
    765    const random = Math.random().toString(36).substring(2, 8);
    766    return `task_${timestamp}_${random}_${taskIdCounter}`;
    767  }
    

libs/psyche/screen-analysis/src/screen-reader-user-testing.ts#

  • L309

    ts
    307  export function generateScreenReaderIssueId(): string {
    308    const ts = Date.now().toString(36);
    309    const rand = Math.random().toString(36).substring(2, 8);
    310    return `sri_${ts}_${rand}`;
    311  }
    

libs/psyche/screen-analysis/src/sign-accuracy-validation.ts#

  • L308

    ts
    306    validationIdCounter += 1;
    307    const timestamp = Date.now().toString(36);
    308    const random = Math.random().toString(36).substring(2, 8);
    309    return `${prefix}_${timestamp}_${random}_${validationIdCounter}`;
    310  }
    

libs/psyche/screen-analysis/src/sign-avatar-positioning.ts#

  • L346

    ts
    344    posIdCounter += 1;
    345    const timestamp = Date.now().toString(36);
    346    const random = Math.random().toString(36).substring(2, 8);
    347    return `${prefix}_${timestamp}_${random}_${posIdCounter}`;
    348  }
    

libs/psyche/screen-analysis/src/sign-avatar-size-config.ts#

  • L397

    ts
    395    sizeIdCounter += 1;
    396    const timestamp = Date.now().toString(36);
    397    const random = Math.random().toString(36).substring(2, 8);
    398    return `${prefix}_${timestamp}_${random}_${sizeIdCounter}`;
    399  }
    

libs/psyche/screen-analysis/src/sign-language-avatar-model.ts#

  • L602

    ts
    600    avatarIdCounter += 1;
    601    const timestamp = Date.now().toString(36);
    602    const random = Math.random().toString(36).substring(2, 8);
    603    return `${prefix}_${timestamp}_${random}_${avatarIdCounter}`;
    604  }
    

libs/psyche/screen-analysis/src/sign-language-synthesis.ts#

  • L844

    ts
    842  export function generateSignId(): string {
    843    const ts = Date.now();
    844    const rand = Math.random().toString(36).slice(2, 8);
    845    return `sgn_${ts}_${rand}`;
    846  }
    
  • L853

    ts
    851  export function generateSequenceId(): string {
    852    const ts = Date.now();
    853    const rand = Math.random().toString(36).slice(2, 8);
    854    return `seq_${ts}_${rand}`;
    855  }
    

libs/psyche/screen-analysis/src/sign-language-toggle.ts#

  • L332

    ts
    330    toggleIdCounter += 1;
    331    const timestamp = Date.now().toString(36);
    332    const random = Math.random().toString(36).substring(2, 8);
    333    return `${prefix}_${timestamp}_${random}_${toggleIdCounter}`;
    334  }
    

libs/psyche/screen-analysis/src/sign-recognition-feedback.ts#

  • L358

    ts
    356  export function generateFeedbackId(prefix: string = 'rfb'): string {
    357    const ts = Date.now().toString(36);
    358    const rand = Math.random().toString(36).slice(2, 8);
    359    return `${prefix}_${ts}_${rand}`;
    360  }
    

libs/psyche/screen-analysis/src/sign-timing-synchronization.ts#

  • L428

    ts
    426    idCounter += 1;
    427    const timestamp = Date.now().toString(36);
    428    const random = Math.random().toString(36).substring(2, 8);
    429    return `${prefix}_${timestamp}_${random}_${idCounter}`;
    430  }
    

libs/psyche/screen-analysis/src/slide-annotation-detector.ts#

  • L300

    ts
    298    const ts = Date.now().toString(36);
    299    const seq = annotationIdCounter.toString(36).padStart(4, '0');
    300    const rand = Math.random().toString(36).slice(2, 6);
    301    return `ann_${ts}_${seq}_${rand}`;
    302  }
    
  • L849

    ts
    847
    848      clusters.push({
    849        id: `cluster_${clusterIdCounter.toString(36)}_${Math.random().toString(36).slice(2, 6)}`,
    850        annotations: groupAnnotations,
    851        semanticMeaning,
    

libs/psyche/screen-analysis/src/transcript-translation.ts#

  • L1125

    ts
    1123  export function generateTranslationId(): string {
    1124    const timestamp = Date.now();
    1125    const random = Math.random().toString(36).substring(2, 10);
    1126    return `tr_${timestamp}_${random}`;
    1127  }
    
  • L1134

    ts
    1132  export function generateBatchId(): string {
    1133    const timestamp = Date.now();
    1134    const random = Math.random().toString(36).substring(2, 10);
    1135    return `tb_${timestamp}_${random}`;
    1136  }
    

libs/psyche/screen-analysis/src/whiteboard-analyzer.ts#

  • L398

    ts
    396    const ts = Date.now().toString(36);
    397    const seq = boardElementIdCounter.toString(36).padStart(4, '0');
    398    const rand = Math.random().toString(36).slice(2, 6);
    399    return `be_${ts}_${seq}_${rand}`;
    400  }
    
  • L409

    ts
    407    const ts = Date.now().toString(36);
    408    const seq = boardRegionIdCounter.toString(36).padStart(4, '0');
    409    const rand = Math.random().toString(36).slice(2, 6);
    410    return `br_${ts}_${seq}_${rand}`;
    411  }
    

libs/psyche/screen-analysis/src/zoom-reflow-analyzer.ts#

  • L347

    ts
    345   */
    346  export function generateIssueId(): string {
    347    return `rfi_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    348  }
    349
    

libs/psyche/slo-alerting/src/burn-rate.ts#

  • L280

    ts
    278      const rule: SLOAlertRule = {
    279        ...params,
    280        id: `rule_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as AlertRuleId,
    281        enabled: params.enabled ?? true,
    282        createdAt: new Date(),
    
  • L386

    ts
    384        const alert: BurnRateAlert = {
    385          id: (existingAlert?.id ??
    386            `alert_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`) as AlertRuleId,
    387          sloId: slo.id,
    388          severity: rule.severity,
    

libs/psyche/slo-alerting/src/sli.ts#

  • L297

    ts
    295      const sli: SLI = {
    296        ...params,
    297        id: `sli_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as SLIId,
    298        createdAt: new Date(),
    299        updatedAt: new Date(),
    

libs/psyche/slo-alerting/src/slo.ts#

  • L59

    ts
    57      const slo: SLO = {
    58        ...params,
    59        id: `slo_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as SLOId,
    60        createdAt: new Date(),
    61        updatedAt: new Date(),
    

libs/psyche/sophia-integration/src/adapter.ts#

  • L556

    ts
    554      const baseDelay =
    555        this.retryConfig.initialDelayMs * Math.pow(this.retryConfig.backoffMultiplier, attempt);
    556      const jitter = baseDelay * this.retryConfig.jitterFactor * Math.random();
    557      return Math.min(baseDelay + jitter, this.retryConfig.maxDelayMs);
    558    }
    

libs/psyche/sophia-integration/src/embedding-adapter.ts#

  • L415

    ts
    413      const embedding: number[] = [];
    414      for (let i = 0; i < this.dimensions; i++) {
    415        embedding.push(Math.random() * 2 - 1);
    416      }
    417      // Normalize
    

libs/psyche/sophia-search-integration/src/search-adapter.ts#

  • L691

    ts
    689        totalResults: results.length,
    690        hasMore: false,
    691        processingTimeMs: Math.random() * 100 + 50,
    692      };
    693    }
    

libs/psyche/tavus-bridge/src/bridge-failover.ts#

  • L1350

    ts
    1348    ): Promise<FailoverRecord> {
    1349      const failoverId = createFailoverId(
    1350        `fo_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`
    1351      );
    1352
    

libs/psyche/tavus-bridge/src/bridge.ts#

  • L92

    ts
    90
    91      this.id =
    92        config.id ?? createBridgeId(`bridge_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    93    }
    94
    
  • L433

    ts
    431            break;
    432          case 'random': {
    433            const idx = Math.floor(Math.random() * this.videoBuffer.length);
    434            this.videoBuffer.splice(idx, 1);
    435            break;
    
  • L452

    ts
    450            break;
    451          case 'random': {
    452            const idx = Math.floor(Math.random() * this.audioBuffer.length);
    453            this.audioBuffer.splice(idx, 1);
    454            break;
    

libs/psyche/tavus-bridge/src/conference.ts#

  • L425

    ts
    423      this.conferenceId =
    424        config.conferenceId ??
    425        createConferenceId(`conf_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    426    }
    427
    
  • L1875

    ts
    1873
    1874      const message: MeetChatMessage = {
    1875        id: `meet_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    1876        senderId,
    1877        senderName,
    
  • L1980

    ts
    1978      // Create bot message record
    1979      const message: MeetChatMessage = {
    1980        id: `meet_bot_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    1981        senderId: this.botParticipantId ?? 'bot',
    1982        senderName: this.chatConfig.botName,
    
  • L2850

    ts
    2848
    2849      const message: TeamsChatMessage = {
    2850        id: `teams_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    2851        senderId,
    2852        senderName,
    
  • L2973

    ts
    2971      // Create bot message record
    2972      const message: TeamsChatMessage = {
    2973        id: `teams_bot_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    2974        senderId: this.botParticipantId ?? 'bot',
    2975        senderName: this.chatConfig.botName,
    

libs/psyche/tavus-bridge/src/frame-drop-strategy.ts#

  • L817

    ts
    815      }
    816
    817      const selectedIndex = eligible[Math.floor(Math.random() * eligible.length)];
    818
    819      return {
    

libs/psyche/tavus-bridge/src/meet-captions.ts#

  • L23

    ts
    21
    22  export function createCaptionId(id?: string): CaptionId {
    23    return (id ?? `cap_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as CaptionId;
    24  }
    25
    
  • L34

    ts
    32  export function createCaptionManagerId(id?: string): CaptionManagerId {
    33    return (id ??
    34      `cmgr_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as CaptionManagerId;
    35  }
    36
    

libs/psyche/tavus-bridge/src/meet-recording.ts#

  • L23

    ts
    21
    22  export function createMeetRecordingId(id?: string): MeetRecordingId {
    23    return (id ?? `mrec_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as MeetRecordingId;
    24  }
    25
    
  • L34

    ts
    32  export function createMeetRecordingFileId(id?: string): MeetRecordingFileId {
    33    return (id ??
    34      `mrf_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as MeetRecordingFileId;
    35  }
    36
    
  • L45

    ts
    43  export function createMeetRecordingManagerId(id?: string): MeetRecordingManagerId {
    44    return (id ??
    45      `mrmgr_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as MeetRecordingManagerId;
    46  }
    47
    

libs/psyche/tavus-bridge/src/multi-output.ts#

  • L1530

    ts
    1528    ): Promise<DistributionResult> {
    1529      const distributionId = createDistributionId(
    1530        `dist_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`
    1531      );
    1532      const startTime = Date.now();
    

libs/psyche/tavus-bridge/src/multi-platform-camera.ts#

  • L649

    ts
    647
    648      this.deviceId = createDeviceId(
    649        `vcam_${this.platform}_${Date.now()}_${Math.random().toString(36).slice(2)}`
    650      );
    651
    

libs/psyche/tavus-bridge/src/screen-share-receiver.ts#

  • L1309

    ts
    1307
    1308      this.config = { ...DEFAULT_SCREEN_SHARE_RECEIVER_CONFIG, ...config };
    1309      this.id = createStreamId(`screenshare_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    1310
    1311      // Initialize components
    

libs/psyche/tavus-bridge/src/teams-chat.ts#

  • L40

    ts
    38   */
    39  export function createTeamsChatId(id?: string): TeamsChatId {
    40    return (id || `tcm_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as TeamsChatId;
    41  }
    42
    
  • L48

    ts
    46  export function createTeamsChatManagerId(id?: string): TeamsChatManagerId {
    47    return (id ||
    48      `tcmgr_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as TeamsChatManagerId;
    49  }
    50
    
  • L56

    ts
    54  export function createTeamsChatThreadId(id?: string): TeamsChatThreadId {
    55    return (id ||
    56      `tct_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as TeamsChatThreadId;
    57  }
    58
    

libs/psyche/tavus-bridge/src/teams-recording.ts#

  • L22

    ts
    20  export function createTeamsRecordingId(id?: string): TeamsRecordingId {
    21    return (id ??
    22      `trec_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as TeamsRecordingId;
    23  }
    24
    
  • L31

    ts
    29  export function createTeamsRecordingFileId(id?: string): TeamsRecordingFileId {
    30    return (id ??
    31      `trf_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as TeamsRecordingFileId;
    32  }
    33
    
  • L42

    ts
    40  export function createTeamsRecordingManagerId(id?: string): TeamsRecordingManagerId {
    41    return (id ??
    42      `trmgr_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as TeamsRecordingManagerId;
    43  }
    44
    

libs/psyche/tavus-bridge/src/teams-screen-share.ts#

  • L51

    ts
    49  export function createTeamsScreenShareId(id?: string): TeamsScreenShareId {
    50    return (id ||
    51      `tss_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as TeamsScreenShareId;
    52  }
    53
    
  • L59

    ts
    57  export function createTeamsScreenShareManagerId(id?: string): TeamsScreenShareManagerId {
    58    return (id ||
    59      `tssm_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as TeamsScreenShareManagerId;
    60  }
    61
    

libs/psyche/tavus-bridge/src/virtual-audio.ts#

  • L105

    ts
    103      this.deviceId =
    104        config.deviceId ??
    105        createDeviceId(`vaud_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    106      this.audioConfig = config.audio ?? DEFAULT_AUDIO_CONFIG;
    107      this.bufferFrames = config.bufferFrames ?? 4;
    

libs/psyche/tavus-bridge/src/virtual-camera.ts#

  • L95

    ts
    93      this.deviceId =
    94        config.deviceId ??
    95        createDeviceId(`vcam_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    96      this.videoConfig = config.video ?? DEFAULT_VIDEO_CONFIG;
    97      this.devicePath = config.devicePath ?? this.generateDevicePath();
    

libs/psyche/tavus-bridge/src/webrtc-receiver.ts#

  • L94

    ts
    92
    93      this.id =
    94        options.id ?? createStreamId(`webrtc_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    95      this.videoConfig = options.video ?? DEFAULT_VIDEO_CONFIG;
    96      this.audioConfig = options.audio ?? DEFAULT_AUDIO_CONFIG;
    

libs/psyche/tavus-bridge/src/zoom-breakout-rooms.ts#

  • L22

    ts
    20
    21  export function createBreakoutRoomId(id?: string): BreakoutRoomId {
    22    return (id ?? `br_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as BreakoutRoomId;
    23  }
    24
    
  • L32

    ts
    30
    31  export function createBreakoutSessionId(id?: string): BreakoutSessionId {
    32    return (id ?? `bs_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as BreakoutSessionId;
    33  }
    34
    
  • L43

    ts
    41  export function createBreakoutManagerId(id?: string): BreakoutManagerId {
    42    return (id ??
    43      `bmgr_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as BreakoutManagerId;
    44  }
    45
    
  • L408

    ts
    406    const shuffled = [...participantIds];
    407    for (let i = shuffled.length - 1; i > 0; i--) {
    408      const j = Math.floor(Math.random() * (i + 1));
    409      [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
    410    }
    
  • L1383

    ts
    1381
    1382      const message: BroadcastMessage = {
    1383        id: `bcast_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    1384        content: truncatedContent,
    1385        sender,
    

libs/psyche/tavus-bridge/src/zoom-chat.ts#

  • L328

    ts
    326      super();
    327      this.config = { ...DEFAULT_ZOOM_CHAT_CONFIG, ...config };
    328      this.id = createStreamId(`zoomchat_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    329      this.metrics = this.createInitialMetrics();
    330    }
    
  • L429

    ts
    427      // Create message object
    428      const message: ZoomChatMessage = {
    429        id: options.messageId ?? `msg_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    430        senderId,
    431        senderName,
    

libs/psyche/tavus-bridge/src/zoom-recording.ts#

  • L22

    ts
    20
    21  export function createRecordingId(id?: string): RecordingId {
    22    return (id ?? `rec_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as RecordingId;
    23  }
    24
    
  • L32

    ts
    30
    31  export function createRecordingFileId(id?: string): RecordingFileId {
    32    return (id ?? `rf_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as RecordingFileId;
    33  }
    34
    
  • L43

    ts
    41  export function createRecordingManagerId(id?: string): RecordingManagerId {
    42    return (id ??
    43      `rmgr_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`) as RecordingManagerId;
    44  }
    45
    

libs/psyche/tavus-client/src/batcher.ts#

  • L349

    ts
    347     */
    348    private generateId(): string {
    349      return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    350    }
    351
    

libs/psyche/tavus-client/src/failover.ts#

  • L201

    ts
    199    // Apply jitter
    200    if (config.jitterFactor > 0) {
    201      const jitter = delay * config.jitterFactor * (Math.random() * 2 - 1);
    202      delay = delay + jitter;
    203    }
    

libs/psyche/tavus-client/src/mock.ts#

  • L255

    ts
    253
    254  function randomBetween(min: number, max: number): number {
    255    return min + Math.random() * (max - min);
    256  }
    257
    
  • L762

    ts
    760        status: 'ready',
    761        sourceUrl: request.url,
    762        chunkCount: request.type === 'text' ? 1 : Math.ceil(Math.random() * 10),
    763        lastCrawledAt: request.type === 'website' || request.type === 'url' ? now : undefined,
    764        createdAt: now,
    

libs/psyche/tavus-client/src/multi-region.ts#

  • L583

    ts
    581
    582    const totalWeight = eligible.reduce((sum, r) => sum + r.weight, 0);
    583    let random = Math.random() * totalWeight;
    584
    585    for (const region of eligible) {
    

libs/psyche/tavus-conversation/src/analytics.ts#

  • L114

    ts
    112      const now = new Date();
    113      const analyticsId = createAnalyticsSessionId(
    114        `analytics_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
    115      );
    116
    
  • L535

    ts
    533      const now = new Date();
    534      const analyticsId = createAnalyticsSessionId(
    535        `analytics_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
    536      );
    537
    

libs/psyche/tavus-conversation/src/recording.ts#

  • L125

    ts
    123      const now = new Date();
    124      const recordingId = createRecordingId(
    125        `rec_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
    126      );
    127
    
  • L533

    ts
    531     */
    532    private generateSignedUrl(baseUrl: string, expiresAt: Date): string {
    533      const token = Math.random().toString(36).substring(2);
    534      return `${baseUrl}?token=${token}&expires=${expiresAt.getTime()}`;
    535    }
    
  • L541

    ts
    539     */
    540    private generateChecksum(): string {
    541      return Array.from({ length: 64 }, () => Math.floor(Math.random() * 16).toString(16)).join('');
    542    }
    543
    

libs/psyche/tavus-conversation/src/transcripts.ts#

  • L110

    ts
    108      const now = new Date();
    109      const transcriptId = createTranscriptId(
    110        `transcript_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
    111      );
    112
    
  • L277

    ts
    275      const segmentWithId: TranscriptSegment = {
    276        ...segment,
    277        id: createTranscriptSegmentId(`seg_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`),
    278      };
    279
    
  • L647

    ts
    645        const utterance = sampleUtterances[i];
    646        const words = utterance.text.split(' ');
    647        const duration = words.length * 0.3 + Math.random() * 0.5; // ~300ms per word + variation
    648
    649        const transcriptWords: TranscriptWord[] =
    
  • L655

    ts
    653                startTime: currentTime + (wordIndex * duration) / words.length,
    654                endTime: currentTime + ((wordIndex + 1) * duration) / words.length,
    655                confidence: 0.85 + Math.random() * 0.14,
    656                speaker: utterance.speaker,
    657              }))
    
  • L662

    ts
    660        const emotion =
    661          options?.enableEmotionDetection !== false
    662            ? emotions[Math.floor(Math.random() * emotions.length)]
    663            : null;
    664
    
  • L672

    ts
    670          startTime: currentTime,
    671          endTime: currentTime + duration,
    672          confidence: 0.88 + Math.random() * 0.11,
    673          words: transcriptWords,
    674          emotion,
    
  • L675

    ts
    673          words: transcriptWords,
    674          emotion,
    675          emotionConfidence: emotion ? 0.7 + Math.random() * 0.25 : null,
    676          language: 'en',
    677          isHighlight: false,
    
  • L681

    ts
    679        });
    680
    681        currentTime += duration + 0.2 + Math.random() * 0.5; // Gap between utterances
    682      }
    683
    
  • L759

    ts
    757
    758      // Calculate sentiment
    759      const sentimentScores = segments.map(() => Math.random() * 2 - 1);
    760      const avgSentiment = sentimentScores.reduce((a, b) => a + b, 0) / sentimentScores.length;
    761
    

libs/psyche/tavus-expression/src/expression-ab-testing.ts#

  • L272

    ts
    270   */
    271  export function generateExperimentId(): string {
    272    return `exp_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
    273  }
    274
    
  • L1142

    ts
    1140
    1141    private selectRandomVariant(experiment: ExpressionExperiment): ExpressionVariant {
    1142      const random = Math.random() * 100;
    1143      let cumulative = 0;
    1144
    
  • L1205

    ts
    1203      }
    1204
    1205      const random = Math.random() * totalScore;
    1206      let cumulative = 0;
    1207
    

libs/psyche/tavus-expression/src/expression-analytics.ts#

  • L191

    ts
    189  /** Generate a unique event ID */
    190  export function generateEventId(): string {
    191    return `evt_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    192  }
    193
    

libs/psyche/tavus-expression/src/expression-channel.ts#

  • L117

    ts
    115
    116      this.channelId = createExpressionChannelId(
    117        `expr_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
    118      );
    119      this.conversationId = options.conversationId;
    

libs/psyche/tavus-expression/src/lipsync-bridge.ts#

  • L204

    ts
    202
    203      this.sessionId = createLipSyncSessionId(
    204        `lipsync_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
    205      );
    206      this.mediaStream = audioStream;
    

libs/psyche/tavus-hybrid/src/ab-testing.ts#

  • L328

    ts
    326
    327      const now = new Date();
    328      const experimentId = `exp_${Date.now()}_${Math.random().toString(36).slice(2)}`;
    329
    330      const variants: ExperimentVariant[] = request.variants.map((v, index) => ({
    
  • L830

    ts
    828
    829    private selectRandomVariant(experiment: Experiment): ExperimentVariant {
    830      const random = Math.random() * 100;
    831      let cumulative = 0;
    832
    
  • L893

    ts
    891      }
    892
    893      const random = Math.random() * totalScore;
    894      let cumulative = 0;
    895
    

libs/psyche/tavus-hybrid/src/automatic-mode-selection.ts#

  • L301

    ts
    299  function generateSelectionId(): SelectionId {
    300    return createSelectionId(
    301      `sel_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`
    302    );
    303  }
    

libs/psyche/tavus-hybrid/src/dynamic-component-selection.ts#

  • L346

    ts
    344  function generateSnapshotId(): LoadSnapshotId {
    345    return createLoadSnapshotId(
    346      `snap_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`
    347    );
    348  }
    
  • L352

    ts
    350  function generateDecisionId(): SelectionDecisionId {
    351    return createSelectionDecisionId(
    352      `dec_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`
    353    );
    354  }
    

libs/psyche/tavus-hybrid/src/failover-manager.ts#

  • L201

    ts
    199
    200      const event: FailoverEvent = {
    201        id: createFailoverEventId(`failover_${Date.now()}_${Math.random().toString(36).slice(2)}`),
    202        sessionId: session.id,
    203        trigger,
    
  • L267

    ts
    265
    266      const event: FailoverEvent = {
    267        id: createFailoverEventId(`failover_${Date.now()}_${Math.random().toString(36).slice(2)}`),
    268        sessionId: session.id,
    269        trigger,
    
  • L347

    ts
    345
    346      const event: RecoveryEvent = {
    347        id: `recovery_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    348        sessionId: session.id,
    349        recoveredProvider: provider,
    

libs/psyche/tavus-hybrid/src/failover-notifications.ts#

  • L739

    ts
    737    }): Notification {
    738      return {
    739        id: `notif_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    740        type: options.type,
    741        severity: options.severity,
    

libs/psyche/tavus-hybrid/src/failover-testing.ts#

  • L806

    ts
    804      const injection: FaultInjection = {
    805        ...fault,
    806        id: `fault_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    807        startedAt: new Date(),
    808      };
    
  • L958

    ts
    956    private createTestRun(scenario: TestScenario): TestRun {
    957      return {
    958        id: `run_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    959        scenarioId: scenario.id,
    960        status: 'running',
    

libs/psyche/tavus-hybrid/src/health-checker.ts#

  • L106

    ts
    104      if (!adapter) {
    105        result = {
    106          id: createHealthCheckId(`check_${Date.now()}_${Math.random().toString(36).slice(2)}`),
    107          provider,
    108          status: 'unknown',
    
  • L126

    ts
    124        } catch (error) {
    125          result = {
    126            id: createHealthCheckId(`check_${Date.now()}_${Math.random().toString(36).slice(2)}`),
    127            provider,
    128            status: 'unhealthy',
    
  • L351

    ts
    349
    350      return {
    351        id: createHealthCheckId(`check_${Date.now()}_${Math.random().toString(36).slice(2)}`),
    352        provider: adapter.provider,
    353        status,
    

libs/psyche/tavus-hybrid/src/hybrid-manager.ts#

  • L181

    ts
    179    createSession(request: CreateSessionRequest = {}): HybridSession {
    180      const sessionId = createHybridSessionId(
    181        `hybrid_${Date.now()}_${Math.random().toString(36).slice(2)}`
    182      );
    183      const now = new Date();
    

libs/psyche/tavus-hybrid/src/ml-mode-optimization.ts#

  • L254

    ts
    252  function sampleGamma(shape: number): number {
    253    if (shape < 1) {
    254      const u = Math.random();
    255      return sampleGamma(1 + shape) * Math.pow(u, 1 / shape);
    256    }
    
  • L271

    ts
    269
    270      v = v * v * v;
    271      const u = Math.random();
    272
    273      if (u < 1 - 0.0331 * (x * x) * (x * x)) {
    
  • L287

    ts
    285  /** Box-Muller transform for normal random */
    286  function normalRandom(): number {
    287    const u1 = Math.random();
    288    const u2 = Math.random();
    289    return Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L288

    ts
    286  function normalRandom(): number {
    287    const u1 = Math.random();
    288    const u2 = Math.random();
    289    return Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    290  }
    
  • L491

    ts
    489      switch (model.algorithm) {
    490        case 'epsilon_greedy': {
    491          const explore = Math.random() < model.epsilon;
    492          if (explore) {
    493            selectedMode = ML_MODES[Math.floor(Math.random() * ML_MODES.length)]!;
    
  • L493

    ts
    491          const explore = Math.random() < model.epsilon;
    492          if (explore) {
    493            selectedMode = ML_MODES[Math.floor(Math.random() * ML_MODES.length)]!;
    494            isExploration = true;
    495            reason = `Epsilon-greedy exploration (eps=${model.epsilon.toFixed(3)})`;
    
  • L519

    ts
    517            reason = 'Contextual (no context, fallback to best arm)';
    518          } else {
    519            const explore = Math.random() < model.epsilon;
    520            if (explore) {
    521              selectedMode = ML_MODES[Math.floor(Math.random() * ML_MODES.length)]!;
    
  • L521

    ts
    519            const explore = Math.random() < model.epsilon;
    520            if (explore) {
    521              selectedMode = ML_MODES[Math.floor(Math.random() * ML_MODES.length)]!;
    522              isExploration = true;
    523              reason = `Contextual exploration (eps=${model.epsilon.toFixed(3)})`;
    
  • L759

    ts
    757      if (!exp?.active) return undefined;
    758
    759      const rand = Math.random();
    760      let cumulative = 0;
    761
    

libs/psyche/tavus-hybrid/src/mode-transition.ts#

  • L351

    ts
    349
    350      const plan: TransitionPlan = {
    351        id: `plan_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    352        sessionId,
    353        fromMode: session.mode,
    

libs/psyche/tavus-hybrid/src/multi-region-failover.ts#

  • L237

    ts
    235  function generateEndpointId(regionCode: string): EndpointId {
    236    return createEndpointId(
    237      `ep_${regionCode}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`
    238    );
    239  }
    

libs/psyche/tavus-hybrid/src/optimal-component-finder.ts#

  • L246

    ts
    244  function generateSearchId(): SearchId {
    245    return createSearchId(
    246      `search_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`
    247    );
    248  }
    

libs/psyche/tavus-hybrid/src/performance-tracking.ts#

  • L447

    ts
    445
    446      // Apply sampling
    447      if (Math.random() > this.config.sampleRate) return;
    448
    449      const fullMetric: ComponentMetric = {
    

libs/psyche/tavus-hybrid/src/predictive-failover.ts#

  • L300

    ts
    298  function generatePredictionId(): PredictionId {
    299    return createPredictionId(
    300      `pred_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`
    301    );
    302  }
    
  • L310

    ts
    308  function generateAlertId(): AlertId {
    309    return createAlertId(
    310      `alert_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`
    311    );
    312  }
    

libs/psyche/tavus-knowledge/src/bulk-document-operations.ts#

  • L465

    ts
    463              try {
    464                const id = createKnowledgeDocumentId(
    465                  `doc_${Date.now()}_${Math.random().toString(36).slice(2)}`
    466                );
    467                const now = new Date();
    

libs/psyche/tavus-knowledge/src/custom-retrieval-strategies.ts#

  • L39

    ts
    37  export function createCustomStrategyId(id?: string): CustomStrategyId {
    38    return (id ??
    39      `cstrat_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`) as CustomStrategyId;
    40  }
    41
    
  • L47

    ts
    45  export function createStrategyPipelineId(id?: string): StrategyPipelineId {
    46    return (id ??
    47      `spipe_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`) as StrategyPipelineId;
    48  }
    49
    

libs/psyche/tavus-knowledge/src/document-access-controls.ts#

  • L45

    ts
    43  export function createAccessPolicyId(id?: string): AccessPolicyId {
    44    return (id ??
    45      `apol_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`) as AccessPolicyId;
    46  }
    47
    
  • L53

    ts
    51  export function createAccessRuleId(id?: string): AccessRuleId {
    52    return (id ??
    53      `arule_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`) as AccessRuleId;
    54  }
    55
    
  • L60

    ts
    58   */
    59  export function createAuditLogId(id?: string): AuditLogId {
    60    return (id ?? `alog_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`) as AuditLogId;
    61  }
    62
    

libs/psyche/tavus-knowledge/src/document-analytics.ts#

  • L42

    ts
    40   */
    41  export function createDocumentAnalyticsRecordId(): DocumentAnalyticsRecordId {
    42    return `dar_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as DocumentAnalyticsRecordId;
    43  }
    44
    
  • L49

    ts
    47   */
    48  export function createDocumentEventId(): DocumentEventId {
    49    return `de_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as DocumentEventId;
    50  }
    51
    

libs/psyche/tavus-knowledge/src/document-categorization.ts#

  • L482

    ts
    480      }
    481
    482      const id = createCategoryId(`cat_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    483      const now = new Date();
    484
    

libs/psyche/tavus-knowledge/src/document-manager.ts#

  • L146

    ts
    144    async createDocument(request: CreateDocumentRequest): Promise<KnowledgeDocument> {
    145      const id = createKnowledgeDocumentId(
    146        `doc_${Date.now()}_${Math.random().toString(36).slice(2)}`
    147      );
    148      const now = new Date();
    

libs/psyche/tavus-knowledge/src/document-search.ts#

  • L40

    ts
    38   */
    39  export function createSearchQueryId(): SearchQueryId {
    40    return `sq_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as SearchQueryId;
    41  }
    42
    
  • L47

    ts
    45   */
    46  export function createSavedSearchId(id?: string): SavedSearchId {
    47    return (id ?? `ss_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`) as SavedSearchId;
    48  }
    49
    

libs/psyche/tavus-knowledge/src/hybrid-retrieval.ts#

  • L43

    ts
    41  export function createHybridSourceId(id?: string): HybridSourceId {
    42    return (id ??
    43      `hsrc_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`) as HybridSourceId;
    44  }
    45
    
  • L51

    ts
    49  export function createHybridQueryId(id?: string): HybridQueryId {
    50    return (id ??
    51      `hqry_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`) as HybridQueryId;
    52  }
    53
    

libs/psyche/tavus-knowledge/src/knowledge-manager.ts#

  • L213

    ts
    211    createCollection(request: CreateCollectionRequest): KnowledgeCollection {
    212      const id = createKnowledgeCollectionId(
    213        `col_${Date.now()}_${Math.random().toString(36).slice(2)}`
    214      );
    215      const now = new Date();
    

libs/psyche/tavus-knowledge/src/rag-config-manager.ts#

  • L171

    ts
    169     */
    170    createConfig(request: CreateRAGConfigRequest): RAGConfig {
    171      const id = createRAGConfigId(`rag_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    172      const now = new Date();
    173
    

libs/psyche/tavus-knowledge/src/retrieval-ab-testing.ts#

  • L44

    ts
    42   */
    43  export function createExperimentId(id?: string): ExperimentId {
    44    return (id ?? `exp_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`) as ExperimentId;
    45  }
    46
    
  • L51

    ts
    49   */
    50  export function createVariantId(id?: string): VariantId {
    51    return (id ?? `var_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`) as VariantId;
    52  }
    53
    
  • L58

    ts
    56   */
    57  export function createExposureId(id?: string): ExposureId {
    58    return (id ?? `xpo_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`) as ExposureId;
    59  }
    60
    
  • L1029

    ts
    1027    private weightedRandomAllocate(variants: ExperimentVariant[]): ExperimentVariant {
    1028      const totalWeight = variants.reduce((sum, v) => sum + v.trafficWeight, 0);
    1029      let random = Math.random() * totalWeight;
    1030
    1031      for (const variant of variants) {
    

libs/psyche/tavus-knowledge/src/retrieval-analytics.ts#

  • L31

    ts
    29   */
    30  export function createRetrievalRecordId(): RetrievalRecordId {
    31    return `ret_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as RetrievalRecordId;
    32  }
    33
    

libs/psyche/tavus-knowledge/src/retrieval-quality-monitoring.ts#

  • L25

    ts
    23   */
    24  export function createQualityRecordId(): QualityRecordId {
    25    return `qr_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as QualityRecordId;
    26  }
    27
    

libs/psyche/tavus-knowledge/src/selective-document-sync.ts#

  • L556

    ts
    554     */
    555    createRule(request: CreateSyncRuleRequest): SyncRule {
    556      const id = createSyncRuleId(`rule_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    557      const now = new Date();
    558
    

libs/psyche/tavus-knowledge/src/unified-search.ts#

  • L42

    ts
    40  export function createUnifiedSearchId(id?: string): UnifiedSearchId {
    41    return (id ??
    42      `usrc_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`) as UnifiedSearchId;
    43  }
    44
    
  • L50

    ts
    48  export function createSearchProfileId(id?: string): SearchProfileId {
    49    return (id ??
    50      `sprof_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`) as SearchProfileId;
    51  }
    52
    

libs/psyche/tavus-llm/src/claude-proxy.ts#

  • L313

    ts
    311    private createRequestContext(): ProxyRequestContext {
    312      return {
    313        requestId: `req_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    314        startTime: Date.now(),
    315      };
    

libs/psyche/tavus-llm/src/llm-ab-testing.ts#

  • L781

    ts
    779  /** Select a variant using random splitting */
    780  export function selectVariantRandom(variants: VariantConfig[]): VariantConfig {
    781    const rand = Math.random();
    782    let cumulative = 0;
    783
    
  • L817

    ts
    815    epsilon: number
    816  ): VariantConfig {
    817    if (Math.random() < epsilon) {
    818      // Explore: random selection
    819      const index = Math.floor(Math.random() * variants.length);
    
  • L819

    ts
    817    if (Math.random() < epsilon) {
    818      // Explore: random selection
    819      const index = Math.floor(Math.random() * variants.length);
    820      return variants[index]!;
    821    }
    
  • L886

    ts
    884      const variance =
    885        (successes * failures) / ((successes + failures) ** 2 * (successes + failures + 1));
    886      const sample = mean + Math.sqrt(variance) * inverseNormalCDF(Math.random() * 0.98 + 0.01);
    887
    888      if (sample > bestSample) {
    
  • L1064

    ts
    1062
    1063      const experimentId = createExperimentId(
    1064        `exp_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`
    1065      );
    1066
    
  • L1069

    ts
    1067      const variants: VariantConfig[] = input.variants.map((v, i) => ({
    1068        ...v,
    1069        id: createVariantId(v.id ?? `var_${i}_${Math.random().toString(36).substring(2, 8)}`),
    1070      }));
    1071
    
  • L1301

    ts
    1299
    1300      const observation: Observation = {
    1301        id: createObservationId(`obs_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`),
    1302        variantId,
    1303        experimentId,
    

libs/psyche/tavus-llm/src/llm-fallback.ts#

  • L692

    ts
    690      while (remaining.length > 0) {
    691        const totalWeight = remaining.reduce((sum, m) => sum + m.weight, 0);
    692        let random = Math.random() * totalWeight;
    693
    694        for (let i = 0; i < remaining.length; i++) {
    

libs/psyche/tavus-llm/src/llm-latency-monitor.ts#

  • L252

    ts
    250    recordMeasurement(measurement: Omit<LatencyMeasurement, 'tokensPerSecond'>): void {
    251      // Apply sampling
    252      if (Math.random() > this.config.sampleRate) {
    253        return;
    254      }
    

libs/psyche/tavus-llm/src/speculative-inference.ts#

  • L365

    ts
    363    ): Promise<SpeculativeResult> {
    364      const startTime = Date.now();
    365      const requestId = `spec_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    366
    367      if (!this.config.enabled || this.config.mode === 'disabled') {
    
  • L446

    ts
    444    ): AsyncGenerator<OpenAIStreamChunk, SpeculativeResult, unknown> {
    445      const startTime = Date.now();
    446      const requestId = `spec_stream_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    447
    448      if (!this.config.enabled || this.config.mode === 'disabled') {
    

libs/psyche/tavus-llm/src/stream-translator.ts#

  • L143

    ts
    141        finishReason: null,
    142      };
    143      this.systemFingerprint = `fp_${Math.random().toString(36).substring(2, 15)}`;
    144    }
    145
    

libs/psyche/tavus-memories/src/memory-backup-restore.ts#

  • L37

    ts
    35  // Brand constructors
    36  export function createBackupId(id?: string): BackupId {
    37    return (id ?? `bak_${Date.now()}_${Math.random().toString(36).slice(2)}`) as BackupId;
    38  }
    39
    
  • L41

    ts
    39
    40  export function createRestorePointId(id?: string): RestorePointId {
    41    return (id ?? `rp_${Date.now()}_${Math.random().toString(36).slice(2)}`) as RestorePointId;
    42  }
    43
    
  • L45

    ts
    43
    44  export function createBackupPolicyId(id?: string): BackupPolicyId {
    45    return (id ?? `pol_${Date.now()}_${Math.random().toString(36).slice(2)}`) as BackupPolicyId;
    46  }
    47
    

libs/psyche/tavus-memories/src/memory-conflict-resolution.ts#

  • L41

    ts
    39
    40  export function createConflictId(id?: string): ConflictId {
    41    return (id || `cfl_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`) as ConflictId;
    42  }
    43
    
  • L45

    ts
    43
    44  export function createConflictPolicyId(id?: string): ConflictPolicyId {
    45    return (id || `cpol_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`) as ConflictPolicyId;
    46  }
    47
    
  • L50

    ts
    48  export function createConflictResolutionId(id?: string): ConflictResolutionId {
    49    return (id ||
    50      `cres_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`) as ConflictResolutionId;
    51  }
    52
    

libs/psyche/tavus-memories/src/memory-export-import.ts#

  • L787

    ts
    785    createBackup(name: string, description?: string): BackupMetadata {
    786      const id = createMemorySnapshotId(
    787        `backup_${Date.now()}_${Math.random().toString(36).slice(2)}`
    788      );
    789      const exportResult = this.export({
    

libs/psyche/tavus-memories/src/memory-manager.ts#

  • L146

    ts
    144      }
    145
    146      const id = createMemoryId(`mem_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    147      const now = new Date();
    148
    

libs/psyche/tavus-memories/src/memory-persona-sharing.ts#

  • L51

    ts
    49  // Brand constructors
    50  export function createSharePoolId(id?: string): SharePoolId {
    51    return (id ?? `pool_${Date.now()}_${Math.random().toString(36).slice(2)}`) as SharePoolId;
    52  }
    53
    
  • L55

    ts
    53
    54  export function createShareRequestId(id?: string): ShareRequestId {
    55    return (id ?? `req_${Date.now()}_${Math.random().toString(36).slice(2)}`) as ShareRequestId;
    56  }
    57
    
  • L59

    ts
    57
    58  export function createSubscriptionId(id?: string): SubscriptionId {
    59    return (id ?? `sub_${Date.now()}_${Math.random().toString(36).slice(2)}`) as SubscriptionId;
    60  }
    61
    
  • L63

    ts
    61
    62  export function createTransferId(id?: string): TransferId {
    63    return (id ?? `xfer_${Date.now()}_${Math.random().toString(36).slice(2)}`) as TransferId;
    64  }
    65
    
  • L2171

    ts
    2169      // Generate new memory ID for the transferred copy
    2170      const targetMemoryId = createMemoryId(
    2171        `shared_${Date.now()}_${Math.random().toString(36).slice(2)}`
    2172      );
    2173
    

libs/psyche/tavus-memories/src/memory-privacy-controls.ts#

  • L43

    ts
    41
    42  export function createPrivacyPolicyId(id?: string): PrivacyPolicyId {
    43    return (id || `ppol_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`) as PrivacyPolicyId;
    44  }
    45
    
  • L47

    ts
    45
    46  export function createConsentRecordId(id?: string): ConsentRecordId {
    47    return (id || `cons_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`) as ConsentRecordId;
    48  }
    49
    
  • L51

    ts
    49
    50  export function createAuditEntryId(id?: string): AuditEntryId {
    51    return (id || `aud_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`) as AuditEntryId;
    52  }
    53
    

libs/psyche/tavus-memories/src/selective-memory-sync.ts#

  • L37

    ts
    35  // Brand constructors
    36  export function createSyncProfileId(id?: string): SyncProfileId {
    37    return (id ?? `prof_${Date.now()}_${Math.random().toString(36).slice(2)}`) as SyncProfileId;
    38  }
    39
    
  • L41

    ts
    39
    40  export function createSyncRuleId(id?: string): SyncRuleId {
    41    return (id ?? `rule_${Date.now()}_${Math.random().toString(36).slice(2)}`) as SyncRuleId;
    42  }
    43
    
  • L45

    ts
    43
    44  export function createSyncScheduleId(id?: string): SyncScheduleId {
    45    return (id ?? `sched_${Date.now()}_${Math.random().toString(36).slice(2)}`) as SyncScheduleId;
    46  }
    47
    

libs/psyche/tavus-memories/src/store-manager.ts#

  • L105

    ts
    103     */
    104    createStore(request: CreateMemoryStoreRequest): MemoryStore {
    105      const id = createMemoryStoreId(`store_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    106      const now = new Date();
    107
    

libs/psyche/tavus-memories/src/tag-manager.ts#

  • L162

    ts
    160      }
    161
    162      const id = createMemoryTagId(`tag_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    163      const now = new Date();
    164
    

libs/psyche/tavus-objectives/src/custom-compliance-frameworks.ts#

  • L704

    ts
    702      }
    703
    704      const id = createCustomFrameworkId(`ccf_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    705      const now = new Date();
    706
    
  • L910

    ts
    908
    909      const rule: ComplianceRule = {
    910        id: createComplianceRuleId(`crule_${Date.now()}_${Math.random().toString(36).slice(2)}`),
    911        code: request.code,
    912        name: request.name,
    
  • L1042

    ts
    1040
    1041      const control: ComplianceControl = {
    1042        id: createComplianceControlId(`cctrl_${Date.now()}_${Math.random().toString(36).slice(2)}`),
    1043        code: request.code,
    1044        name: request.name,
    
  • L1365

    ts
    1363
    1364      const report: AuditReport = {
    1365        id: createAuditReportId(`audit_${Date.now()}_${Math.random().toString(36).slice(2)}`),
    1366        frameworkId,
    1367        frameworkName: framework.name,
    

libs/psyche/tavus-objectives/src/guardrail-ab-testing.ts#

  • L977

    ts
    975      conversationId?: string
    976    ): GuardrailVariantId {
    977      const identifier = userId ?? conversationId ?? `anon-${Date.now()}-${Math.random()}`;
    978
    979      // Check sticky assignment
    
  • L1067

    ts
    1065
    1066    private randomAllocate(variants: GuardrailExperimentVariant[]): GuardrailVariantId {
    1067      const rand = Math.random();
    1068      let cumulative = 0;
    1069      for (const variant of variants) {
    
  • L1090

    ts
    1088    private weightedAllocate(variants: GuardrailExperimentVariant[]): GuardrailVariantId {
    1089      const totalWeight = variants.reduce((sum, v) => sum + v.weight, 0);
    1090      let rand = Math.random() * totalWeight;
    1091
    1092      for (const variant of variants) {
    
  • L1763

    ts
    1761
    1762      const id = createGuardrailExperimentId(
    1763        `gexp_${Date.now()}_${Math.random().toString(36).slice(2)}`
    1764      );
    1765      const now = new Date();
    
  • L1772

    ts
    1770
    1771      const variants: GuardrailExperimentVariant[] = request.variants.map((v) => ({
    1772        id: createGuardrailVariantId(`gvar_${Date.now()}_${Math.random().toString(36).slice(2)}`),
    1773        name: v.name,
    1774        description: v.description,
    
  • L2060

    ts
    2058
    2059      const exposure: GuardrailExposureRecord = {
    2060        id: createGuardrailExposureId(`gexpo_${Date.now()}_${Math.random().toString(36).slice(2)}`),
    2061        experimentId,
    2062        variantId,
    

libs/psyche/tavus-objectives/src/guardrail-manager.ts#

  • L168

    ts
    166    createTemplate(request: CreateGuardrailTemplateRequest): GuardrailTemplate {
    167      const id = createGuardrailTemplateId(
    168        `tmpl_guard_${Date.now()}_${Math.random().toString(36).slice(2)}`
    169      );
    170      const now = new Date();
    
  • L744

    ts
    742
    743      return {
    744        eventId: `trigger_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    745        guardrailId: guardrail.id,
    746        ruleId: guardrail.id,
    
  • L806

    ts
    804
    805      return {
    806        eventId: `trigger_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    807        guardrailId: guardrail.id,
    808        ruleId: guardrail.id,
    

libs/psyche/tavus-objectives/src/guardrail-notifications.ts#

  • L516

    ts
    514    ): CallbackHandler {
    515      const id = createCallbackHandlerId(
    516        `handler_${Date.now()}_${Math.random().toString(36).slice(2)}`
    517      );
    518
    
  • L804

    ts
    802      }
    803
    804      const id = createNotificationId(`notif_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    805
    806      const channelStatus: Record<NotificationChannel, NotificationStatus> = {} as Record<
    
  • L974

    ts
    972
    973      const batch: NotificationBatch = {
    974        id: `batch_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    975        notificationIds: pendingIds,
    976        createdAt: new Date(),
    

libs/psyche/tavus-objectives/src/guardrail-suggestion-system.ts#

  • L1107

    ts
    1105    createRule(request: CreateGuardrailSuggestionRuleRequest): GuardrailSuggestionRule {
    1106      const id = createGuardrailSuggestionRuleId(
    1107        `gsrule_${Date.now()}_${Math.random().toString(36).slice(2)}`
    1108      );
    1109
    
  • L1179

    ts
    1177    createProfile(request: CreateGuardrailIndustryProfileRequest): GuardrailIndustryProfile {
    1178      const id = createGuardrailIndustryProfileId(
    1179        `gsprof_${Date.now()}_${Math.random().toString(36).slice(2)}`
    1180      );
    1181
    
  • L1277

    ts
    1275      const startTime = Date.now();
    1276      const requestId =
    1277        context.requestId ?? `gsreq_${Date.now()}_${Math.random().toString(36).slice(2)}`;
    1278
    1279      const industryProfile = context.industry
    
  • L1531

    ts
    1529
    1530      return {
    1531        id: createGuardrailSuggestionId(`gsug_${Date.now()}_${Math.random().toString(36).slice(2)}`),
    1532        template,
    1533        score: finalScore,
    

libs/psyche/tavus-objectives/src/multi-objective-conversations.ts#

  • L497

    ts
    495
    496      const sessionId = createConversationSessionId(
    497        `sess_${Date.now()}_${Math.random().toString(36).slice(2)}`
    498      );
    499
    
  • L1019

    ts
    1017      const ruleWithId: TransitionRule = {
    1018        ...rule,
    1019        id: createTransitionRuleId(`rule_${Date.now()}_${Math.random().toString(36).slice(2)}`),
    1020      };
    1021
    

libs/psyche/tavus-objectives/src/objective-ab-testing.ts#

  • L889

    ts
    887      conversationId?: string
    888    ): ObjectiveVariantId {
    889      const identifier = userId ?? conversationId ?? `anon-${Date.now()}-${Math.random()}`;
    890
    891      // Check sticky assignment
    
  • L984

    ts
    982
    983    private randomAllocate(variants: ObjectiveExperimentVariant[]): ObjectiveVariantId {
    984      const rand = Math.random();
    985      let cumulative = 0;
    986      for (const variant of variants) {
    
  • L1008

    ts
    1006      // Weighted random selection
    1007      const totalWeight = variants.reduce((sum, v) => sum + v.weight, 0);
    1008      let rand = Math.random() * totalWeight;
    1009
    1010      for (const variant of variants) {
    

libs/psyche/tavus-objectives/src/objective-manager.ts#

  • L105

    ts
    103    createTemplate(request: CreateObjectiveTemplateRequest): ObjectiveTemplate {
    104      const id = createObjectiveTemplateId(
    105        `tmpl_obj_${Date.now()}_${Math.random().toString(36).slice(2)}`
    106      );
    107      const now = new Date();
    
  • L241

    ts
    239
    240      const instanceId = createWorkflowInstanceId(
    241        `inst_${Date.now()}_${Math.random().toString(36).slice(2)}`
    242      );
    243      const now = new Date();
    

libs/psyche/tavus-objectives/src/tool-call-analytics.ts#

  • L407

    ts
    405      }
    406
    407      const id = createToolCallLogId(`log_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    408      const sanitizedEntry = this.sanitizeLogEntry(entry);
    409
    
  • L554

    ts
    552
    553      const entry: CacheEntry = {
    554        id: createCacheEntryId(`cache_${Date.now()}_${Math.random().toString(36).slice(2)}`),
    555        toolName,
    556        argumentsHash: key,
    
  • L1291

    ts
    1289
    1290      // Add jitter (±10%)
    1291      const jitter = delay * 0.1 * (Math.random() * 2 - 1);
    1292      delay = Math.min(delay + jitter, maxDelayMs);
    1293
    

libs/psyche/tavus-objectives/src/tool-call-anomaly-detection.ts#

  • L310

    ts
    308  function generateAnomalyId(): AnomalyId {
    309    return createAnomalyId(
    310      `anom_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`
    311    );
    312  }
    
  • L335

    ts
    333  function generateAlertId(): AnomalyAlertId {
    334    return createAnomalyAlertId(
    335      `alrt_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`
    336    );
    337  }
    

libs/psyche/tavus-objectives/src/tool-call-approval-workflows.ts#

  • L276

    ts
    274  function generateRequestId(): ApprovalRequestId {
    275    return createApprovalRequestId(
    276      `areq_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`
    277    );
    278  }
    

libs/psyche/tavus-objectives/src/tool-call-monitoring-dashboard.ts#

  • L732

    ts
    730        };
    731      }
    732      this.id = createDashboardId(`dash_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    733
    734      this.emitEvent('dashboard:created', {
    
  • L810

    ts
    808      config: WidgetConfig = {}
    809    ): DashboardWidget {
    810      const id = createWidgetId(`wgt_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    811      const widget: DashboardWidget = { id, type, title, position, config, visible: true };
    812      this.widgets.set(id, widget);
    
  • L1181

    ts
    1179     */
    1180    addAlertRule(rule: Omit<AlertRule, 'id' | 'lastTriggered' | 'triggerCount'>): AlertRule {
    1181      const id = createAlertRuleId(`alert_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    1182      const alertRule: AlertRule = {
    1183        ...rule,
    
  • L1463

    ts
    1461      if (!this.dataProvider) return undefined;
    1462
    1463      const id = createSnapshotId(`snap_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    1464
    1465      const summary = this.dataProvider.getSummary();
    
  • L2122

    ts
    2120    private fireAlert(rule: AlertRule, currentValue: number): Alert {
    2121      const alert: Alert = {
    2122        id: `alert_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    2123        ruleId: rule.id,
    2124        ruleName: rule.name,
    

libs/psyche/tavus-objectives/src/tool-call-prediction-prefetch.ts#

  • L613

    ts
    611        .slice(0, this.config.maxPredictions)
    612        .map(([tool, data]) => {
    613          const id = createPredictionId(`pred_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    614          const prediction: ToolCallPrediction = {
    615            id,
    
  • L702

    ts
    700      if (pending.length >= this.config.maxPrefetchQueue) return undefined;
    701
    702      const id = createPrefetchId(`pf_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    703      const entry: PrefetchEntry = {
    704        id,
    

libs/psyche/tavus-objectives/src/tool-marketplace-integration.ts#

  • L348

    ts
    346   */
    347  function generateReviewId(): ReviewId {
    348    return createReviewId(`rev_${Date.now().toString(36)}_${Math.random().toString(36).slice(2)}`);
    349  }
    350
    
  • L355

    ts
    353   */
    354  function generateInstallationId(): InstallationId {
    355    return createInstallationId(`inst_${Date.now().toString(36)}_${Math.random().toString(36).slice(2)}`);
    356  }
    357
    

libs/psyche/tavus-objectives/src/tool-registration-interface.ts#

  • L1083

    ts
    1081      }
    1082
    1083      const id = createToolHookId(`hook_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    1084      const hook: RegisteredHook = {
    1085        id,
    

libs/psyche/tavus-perception/src/index.ts#

  • L306

    ts
    304
    305      const sessionId = createSessionId(
    306        sessionIdStr ?? `perception_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`
    307      );
    308
    

libs/psyche/tavus-perception/src/learning-perception-optimizer.ts#

  • L637

    ts
    635
    636    // Sample using Box-Muller for a single normal, then clamp
    637    const u1 = Math.random();
    638    const u2 = Math.random();
    639    const z = Math.sqrt(-2 * Math.log(Math.max(u1, 1e-10))) * Math.cos(2 * Math.PI * u2);
    
  • L638

    ts
    636    // Sample using Box-Muller for a single normal, then clamp
    637    const u1 = Math.random();
    638    const u2 = Math.random();
    639    const z = Math.sqrt(-2 * Math.log(Math.max(u1, 1e-10))) * Math.cos(2 * Math.PI * u2);
    640
    
  • L1191

    ts
    1189
    1190      // Exploration: random mode
    1191      if (Math.random() < this.explorationRate) {
    1192        const modes = ALL_PERCEPTION_MODES;
    1193        const mode = modes[Math.floor(Math.random() * modes.length)];
    
  • L1193

    ts
    1191      if (Math.random() < this.explorationRate) {
    1192        const modes = ALL_PERCEPTION_MODES;
    1193        const mode = modes[Math.floor(Math.random() * modes.length)];
    1194        this.emit('mode:recommended', { mode, confidence: 0 });
    1195        return { mode, confidence: 0 };
    

libs/psyche/tavus-perception/src/screen-content-analysis.ts#

  • L368

    ts
    366   */
    367  export function generateElementId(): string {
    368    return `elem_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    369  }
    370
    

libs/psyche/tavus-perception/src/video-forwarder.ts#

  • L129

    ts
    127      this.videoTrack = videoTrack;
    128      this.dataChannel = dataChannel;
    129      this.streamId = `video_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    130
    131      try {
    

libs/psyche/tavus-persona-manager/src/manager.ts#

  • L50

    ts
    48   */
    49  function generateId(prefix: string): string {
    50    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    51  }
    52
    

libs/psyche/tavus-persona-manager/src/validation.ts#

  • L617

    ts
    615
    616    const result: PersonaValidationResult = {
    617      id: createValidationResultId(`vr_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`),
    618      targetId: (options.targetId ?? 'unknown') as never,
    619      targetType: options.targetType ?? 'snapshot',
    

libs/psyche/tavus-phoenix/src/frame-interpolation.ts#

  • L1313

    ts
    1311
    1312      for (let i = 0; i < sampleCount; i++) {
    1313        const idx = Math.floor(Math.random() * (result.data.length / 4)) * 4;
    1314
    1315        // Check if result RGB is between prev and next (with tolerance)
    

libs/psyche/tavus-phoenix/src/frame-sync.ts#

  • L153

    ts
    151
    152      this.sessionId = createSyncSessionId(
    153        `sync_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
    154      );
    155
    

libs/psyche/tavus-phoenix/src/multi-avatar.ts#

  • L276

    ts
    274  /** Generate a unique slot ID */
    275  export function generateSlotId(): string {
    276    return `slot_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    277  }
    278
    

libs/psyche/tavus-phoenix/src/render-pipeline.ts#

  • L143

    ts
    141
    142      this.pipelineId = createRenderPipelineId(
    143        `pipeline_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
    144      );
    145
    

libs/psyche/tavus-phoenix/src/rendering-fallback.ts#

  • L297

    ts
    295  /** Generate a unique record ID */
    296  export function generateRecordId(): string {
    297    return `fb_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    298  }
    299
    
  • L304

    ts
    302    const exponential = config.baseDelayMs * Math.pow(config.backoffMultiplier, attempt);
    303    const capped = Math.min(exponential, config.maxDelayMs);
    304    const jitter = capped * config.jitterFactor * (Math.random() * 2 - 1);
    305    return Math.max(0, Math.floor(capped + jitter));
    306  }
    

libs/psyche/tavus-phoenix/src/stream-receiver.ts#

  • L193

    ts
    191
    192      this.streamId = createPhoenixStreamId(
    193        `phoenix_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
    194      );
    195
    

libs/psyche/tavus-pipecat/src/cost-monitoring.ts#

  • L1288

    ts
    1286      const id =
    1287        sessionId ??
    1288        createCostSessionId(`cost_session_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    1289      this.activeSessionId = id;
    1290      this.sessionCosts.set(id, { startTime: new Date(), entries: [] });
    

libs/psyche/tavus-pipecat/src/custom-stt-processor.ts#

  • L1042

    ts
    1040      const session: RecognitionSession = {
    1041        id: createRecognitionSessionId(
    1042          `session_${Date.now()}_${Math.random().toString(36).slice(2)}`
    1043        ),
    1044        provider: selectedProvider,
    

libs/psyche/tavus-pipecat/src/custom-tts-processor.ts#

  • L1594

    ts
    1592    ): Promise<SynthesisResult> {
    1593      const requestId = createSynthesisRequestId(
    1594        `synth_${Date.now()}_${Math.random().toString(36).slice(2)}`
    1595      );
    1596      const voiceId = options?.voiceId ?? this.ttsConfig.defaultVoiceId ?? createVoiceId('default');
    

libs/psyche/tavus-pipecat/src/deployment-automation.ts#

  • L293

    ts
    291      type: DeploymentRecord['type'] = 'normal'
    292    ): DeploymentRecord {
    293      const id = `deploy_${Date.now()}_${Math.random().toString(36).substring(7)}`;
    294
    295      const record: DeploymentRecord = {
    

libs/psyche/tavus-pipecat/src/monitoring.ts#

  • L596

    ts
    594
    595    private generateId(): string {
    596      return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
    597    }
    598  }
    
  • L825

    ts
    823    shouldSampleTrace(): boolean {
    824      if (!this.config.enableTracing) return false;
    825      return Math.random() < this.config.traceSampleRate;
    826    }
    827
    
  • L1017

    ts
    1015            // Fire alert
    1016            const alert: Alert = {
    1017              id: `alert_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    1018              name,
    1019              severity: definition.severity,
    

libs/psyche/tavus-pipecat/src/multi-region-deployment.ts#

  • L507

    ts
    505    if (totalWeight === 0) return regions[0];
    506
    507    let random = Math.random() * totalWeight;
    508    for (const region of regions) {
    509      random -= region.weight;
    
  • L968

    ts
    966      if (totalWeight === 0) return regions[0];
    967
    968      let random = Math.random() * totalWeight;
    969      for (const region of regions) {
    970        const w = this.policy.weights.get(region.id) ?? region.weight;
    

libs/psyche/tavus-pipecat/src/multimodal-fusion-processor.ts#

  • L1562

    ts
    1560      this.fusionConfig = fusionCfg;
    1561      this.sessionId = createFusionSessionId(
    1562        `fusion_${Date.now()}_${Math.random().toString(36).slice(2)}`
    1563      );
    1564      this.aligner = new TemporalAligner(fusionCfg.alignmentMethod, fusionCfg.windowDurationMs);
    
  • L1917

    ts
    1915      for (const [modality] of points) {
    1916        if (result.size <= 1) break; // Keep at least one
    1917        if (Math.random() < this.fusionConfig.dropoutRate) {
    1918          result.delete(modality);
    1919        }
    
  • L2460

    ts
    2458    startSession(): FusionSessionId {
    2459      this.sessionId = createFusionSessionId(
    2460        `fusion_${Date.now()}_${Math.random().toString(36).slice(2)}`
    2461      );
    2462      this.sessionStartTime = Date.now();
    

libs/psyche/tavus-pipecat/src/performance-optimization.ts#

  • L376

    ts
    374  function generateProfileId(): OptimizationProfileId {
    375    return createOptimizationProfileId(
    376      `prof_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`
    377    );
    378  }
    
  • L386

    ts
    384  function generateBottleneckId(): BottleneckId {
    385    return createBottleneckId(
    386      `bn_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`
    387    );
    388  }
    

libs/psyche/tavus-pipecat/src/pipeline.ts#

  • L84

    ts
    82      this.id = config.id
    83        ? (config.id as unknown as PipelineId)
    84        : createPipelineId(`pipeline_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    85      this.name = config.name;
    86      this.type = config.type ?? 'sequential';
    

libs/psyche/tavus-pipecat/src/plugin-marketplace.ts#

  • L321

    ts
    319  function generateReviewId(): ReviewId {
    320    return createReviewId(
    321      `review_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`
    322    );
    323  }
    

libs/psyche/tavus-pipecat/src/processor.ts#

  • L69

    ts
    67
    68      this.id =
    69        config.id ?? createProcessorId(`proc_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    70      this.name = config.name;
    71      this.type = config.type;
    

libs/psyche/tavus-pipecat/src/services.ts#

  • L63

    ts
    61
    62      this.id =
    63        config.id ?? createServiceId(`svc_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    64      this.name = config.name;
    65      this.type = config.type;
    

libs/psyche/tavus-pipeline/src/conversation-templates.ts#

  • L567

    ts
    565    const now = Date.now();
    566    return {
    567      id: `tpl_${now}_${Math.random().toString(36).substring(2, 9)}`,
    568      name,
    569      description: '',
    

libs/psyche/tavus-pipeline/src/data-channel.ts#

  • L483

    ts
    481
    482    private generateInferenceId(): string {
    483      return createInferenceId(`inf_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`);
    484    }
    485  }
    

libs/psyche/tavus-pipeline/src/lifecycle-manager.ts#

  • L429

    ts
    427      return {
    428        id: createPipelineSessionId(
    429          `session_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`
    430        ),
    431        conversationId: options.conversationId,
    

libs/psyche/tavus-pipeline/src/multi-conversation.ts#

  • L444

    ts
    442   */
    443  export function generateManagedId(): string {
    444    return `mc_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    445  }
    446
    

libs/psyche/tavus-replica-manager/src/ab-testing.ts#

  • L593

    ts
    591  export function selectVariantEqual(variants: readonly ExperimentVariant[]): VariantId | null {
    592    if (variants.length === 0) return null;
    593    const index = Math.floor(Math.random() * variants.length);
    594    return variants[index]!.id;
    595  }
    
  • L605

    ts
    603    if (totalWeight <= 0) return variants[0]!.id;
    604
    605    let random = Math.random() * totalWeight;
    606    for (const variant of variants) {
    607      random -= variant.trafficWeight;
    
  • L624

    ts
    622    if (variants.length === 0) return null;
    623
    624    if (Math.random() < epsilon) {
    625      // Explore: pick random
    626      const index = Math.floor(Math.random() * variants.length);
    
  • L626

    ts
    624    if (Math.random() < epsilon) {
    625      // Explore: pick random
    626      const index = Math.floor(Math.random() * variants.length);
    627      return variants[index]!.id;
    628    }
    
  • L718

    ts
    716    if (shape < 1) {
    717      // Boost small shape: Gamma(a) = Gamma(a+1) * U^(1/a)
    718      return sampleGamma(shape + 1) * Math.pow(Math.random(), 1 / shape);
    719    }
    720
    
  • L733

    ts
    731
    732      v = v * v * v;
    733      const u = Math.random();
    734
    735      if (u < 1 - 0.0331 * (x * x) * (x * x)) return d * v;
    
  • L746

    ts
    744   */
    745  function standardNormalSample(): number {
    746    const u1 = Math.random();
    747    const u2 = Math.random();
    748    return Math.sqrt(-2 * Math.log(u1 || 1e-10)) * Math.cos(2 * Math.PI * u2);
    
  • L747

    ts
    745  function standardNormalSample(): number {
    746    const u1 = Math.random();
    747    const u2 = Math.random();
    748    return Math.sqrt(-2 * Math.log(u1 || 1e-10)) * Math.cos(2 * Math.PI * u2);
    749  }
    

libs/psyche/tavus-replica-manager/src/cloning.ts#

  • L175

    ts
    173  export function generateCloneId(): ReplicaVersionId {
    174    const timestamp = Date.now().toString(36);
    175    const random = Math.random().toString(36).substring(2, 8);
    176    return createReplicaVersionId(`ver_clone_${timestamp}_${random}`);
    177  }
    

libs/psyche/tavus-replica-manager/src/manager.ts#

  • L943

    ts
    941     * lip-sync residuals from the rendering pipeline). When no
    942     * evaluator is configured the manager throws — the historical
    943     * `Math.random()`-based fabrication produced scores that downstream
    944     * rule evaluation and auto-retrain logic treated as truthful,
    945     * masking real quality regressions and triggering spurious retrains.
    

libs/psyche/tavus-replica-manager/src/types.ts#

  • L645

    ts
    643   * user feedback ratings, lip-sync residuals from the rendering
    644   * pipeline, etc. Without an evaluator, the manager throws rather than
    645   * fabricating with `Math.random()`.
    646   */
    647  export interface ReplicaQualityEvaluatorInput {
    
  • L680

    ts
    678     * Pluggable quality evaluator (V1-P2-0921). When omitted,
    679     * `evaluateQuality` throws a configuration error rather than
    680     * fabricating scores with `Math.random()`. Typed as `unknown` so
    681     * this module doesn't force a hard dep on the evaluator
    682     * implementation; the manager casts at runtime.
    

libs/psyche/tavus-tools/src/builtin-tools.ts#

  • L191

    ts
    189
    190    async createEvent(event: Omit<CalendarEvent, 'id'>): Promise<CalendarEvent> {
    191      const id = `event_${Date.now()}_${Math.random().toString(36).slice(2)}`;
    192      const newEvent: CalendarEvent = { ...event, id };
    193      this.events.set(id, newEvent);
    
  • L270

    ts
    268      entity: Omit<CRMEntity, 'id' | 'createdAt' | 'updatedAt'>
    269    ): Promise<CRMEntity> {
    270      const id = `${entity.type}_${Date.now()}_${Math.random().toString(36).slice(2)}`;
    271      const now = new Date();
    272      const newEntity: CRMEntity = {
    
  • L325

    ts
    323
    324      const result: EmailSendResult = {
    325        messageId: `msg_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    326        success: true,
    327        timestamp: new Date(),
    

libs/psyche/tavus-tools/src/extended-tools.ts#

  • L552

    ts
    550
    551    async createMeeting(options: CreateMeetingOptions): Promise<Meeting> {
    552      const id = `mtg_${Date.now()}_${Math.random().toString(36).slice(2)}`;
    553
    554      const meeting: Meeting = {
    
  • L564

    ts
    562        participants: [],
    563        joinUrl: `https://meet.example.com/${id}`,
    564        passcode: Math.random().toString(36).slice(2, 8).toUpperCase(),
    565        isRecording: false,
    566        settings: { ...this.defaultSettings, ...options.settings },
    

libs/psyche/tavus-tools/src/security-advanced.ts#

  • L585

    ts
    583     */
    584    addRule(rule: Omit<RateLimitRule, 'id' | 'windowSeconds'>): RateLimitRule {
    585      const id = createRateLimitRuleId(`rule_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    586      const windowSeconds = WINDOW_SECONDS[rule.window];
    587
    
  • L1182

    ts
    1180
    1181      const sandboxId = createSandboxInstanceId(
    1182        `sandbox_${Date.now()}_${Math.random().toString(36).slice(2)}`
    1183      );
    1184
    

libs/psyche/tavus-tools/src/security-manager.ts#

  • L237

    ts
    235      const fullEntry: AuditLogEntry = {
    236        ...entry,
    237        id: `audit_${Date.now()}_${Math.random().toString(36).slice(2)}`,
    238        timestamp: new Date(),
    239      };
    

libs/psyche/tavus-tools/src/tool-executor.ts#

  • L134

    ts
    132      const startTime = new Date();
    133      const executionId = createToolExecutionId(
    134        `exec_${Date.now()}_${Math.random().toString(36).slice(2)}`
    135      );
    136
    
  • L232

    ts
    230    ): Promise<ToolExecutionResult> {
    231      const call: ToolCall = {
    232        callId: createToolCallId(`call_${Date.now()}_${Math.random().toString(36).slice(2)}`),
    233        toolName,
    234        arguments: args,
    

libs/psyche/tavus-tools/src/tool-manager.ts#

  • L97

    ts
    95      }
    96
    97      const id = createToolId(`tool_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    98      const now = new Date();
    99
    

libs/psyche/tavus-tts/src/custom-tts-provider.ts#

  • L1447

    ts
    1445
    1446      const requestId = createSynthesisRequestId(
    1447        `synth_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`
    1448      );
    1449
    
  • L1509

    ts
    1507
    1508      const requestId = createSynthesisRequestId(
    1509        `synth_stream_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`
    1510      );
    1511
    
  • L1961

    ts
    1959
    1960        case 'random':
    1961          selected = activeProviders[Math.floor(Math.random() * activeProviders.length)]!;
    1962          break;
    1963
    

libs/psyche/tavus-tts/src/tavus-tts-manager.ts#

  • L339

    ts
    337      }
    338    ): VoiceProfile {
    339      const id = createVoiceProfileId(`vp_${Date.now()}_${Math.random().toString(36).slice(2)}`);
    340      const now = new Date();
    341
    

libs/psyche/tavus-tts/src/tts-latency-monitor.ts#

  • L487

    ts
    485    recordMeasurement(measurement: TTSLatencyMeasurement): void {
    486      // Apply sample rate
    487      if (this.config.sampleRate < 1 && Math.random() > this.config.sampleRate) {
    488        return;
    489      }
    

libs/psyche/tavus-tts/src/voice-cloning.ts#

  • L270

    ts
    268      // 4. Return sample metadata
    269
    270      const sampleId = `sample_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    271
    272      // Simulate audio analysis
    
  • L435

    ts
    433      this.validateCloneRequest(request);
    434
    435      const cloneId = `clone_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    436      const voiceId = createTavusVoiceId(`${request.provider}_${cloneId}`);
    437
    

libs/psyche/tavus-tts/src/voice-quality-analytics.ts#

  • L1062

    ts
    1060    startSession(): QualitySessionId {
    1061      const sessionId = createQualitySessionId(
    1062        `qs_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`
    1063      );
    1064      this.sessions.set(sessionId, []);
    
  • L1157

    ts
    1155      const measurement: QualityMeasurement = {
    1156        id: createQualityMeasurementId(
    1157          `qm_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`
    1158        ),
    1159        sessionId,
    

libs/psyche/tavus-tts/src/voice-switch-manager.ts#

  • L619

    ts
    617      }
    618
    619      const switchId = `switch_${now}_${Math.random().toString(36).substring(2, 9)}`;
    620
    621      const pendingSwitch: PendingVoiceSwitch = {
    

libs/psyche/tavus-turntaking/src/ab-testing.ts#

  • L274

    ts
    272   */
    273  export function generateExperimentId(): string {
    274    return `exp_tt_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    275  }
    276
    
  • L281

    ts
    279   */
    280  export function generateVariantId(): string {
    281    return `var_tt_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    282  }
    283
    
  • L1073

    ts
    1071
    1072    private randomAllocation(experiment: TurnTakingExperiment): TurnTakingVariant {
    1073      const rand = Math.random();
    1074      let cumWeight = 0;
    1075      for (const variant of experiment.variants) {
    
  • L1139

    ts
    1137      const probs = exps.map((e) => e / sumExps);
    1138
    1139      const rand = Math.random();
    1140      let cumProb = 0;
    1141      for (let i = 0; i < probs.length; i++) {
    

libs/psyche/tavus-turntaking/src/custom-rules.ts#

  • L283

    ts
    281   */
    282  export function generateRuleId(): string {
    283    return `rule_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    284  }
    285
    
  • L290

    ts
    288   */
    289  export function generateRuleSetId(): string {
    290    return `ruleset_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    291  }
    292
    

libs/psyche/tavus-turntaking/src/hesitation-handling.ts#

  • L653

    ts
    651      // Select a backchannel phrase
    652      const phrases = config.backchannelPhrases;
    653      const phrase = phrases[Math.floor(Math.random() * phrases.length)];
    654
    655      this.lastBackchannelTime = now;
    
  • L1031

    ts
    1029          return this.selectBackchannelPhrase();
    1030        case 'offer-help':
    1031          return config.helpPhrases[Math.floor(Math.random() * config.helpPhrases.length)] ?? null;
    1032        case 'prompt-continuation':
    1033          return 'Please continue...';
    
  • L1044

    ts
    1042      const phrases = this.config.response.backchannelPhrases;
    1043      if (phrases.length === 0) return null;
    1044      return phrases[Math.floor(Math.random() * phrases.length)];
    1045    }
    1046
    

libs/psyche/tavus-turntaking/src/index.ts#

  • L126

    ts
    124      this.state = 'connecting';
    125      this.dataChannel = dataChannel;
    126      this.streamId = `stream_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    127
    128      try {
    
  • L695

    ts
    693
    694      const sessionId = createSessionId(
    695        sessionIdStr ?? `session_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`
    696      );
    697
    

libs/psyche/tavus-turntaking/src/learning-optimizer.ts#

  • L485

    ts
    483
    484    // Sample using Box-Muller for a single normal, then clamp
    485    const u1 = Math.random();
    486    const u2 = Math.random();
    487    const z = Math.sqrt(-2 * Math.log(Math.max(u1, 1e-10))) * Math.cos(2 * Math.PI * u2);
    
  • L486

    ts
    484    // Sample using Box-Muller for a single normal, then clamp
    485    const u1 = Math.random();
    486    const u2 = Math.random();
    487    const z = Math.sqrt(-2 * Math.log(Math.max(u1, 1e-10))) * Math.cos(2 * Math.PI * u2);
    488
    
  • L831

    ts
    829
    830      // Exploration: random mode
    831      if (Math.random() < this.explorationRate) {
    832        const modes = ALL_TURN_TAKING_MODES;
    833        const mode = modes[Math.floor(Math.random() * modes.length)];
    
  • L833

    ts
    831      if (Math.random() < this.explorationRate) {
    832        const modes = ALL_TURN_TAKING_MODES;
    833        const mode = modes[Math.floor(Math.random() * modes.length)];
    834        this.emit('mode:recommended', { mode, confidence: 0 });
    835        return { mode, confidence: 0 };
    

libs/psyche/tavus-turntaking/src/multi-speaker.ts#

  • L843

    ts
    841
    842      this.sessionId = createSessionId(
    843        sessionIdStr ?? `ms_session_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`
    844      );
    845      this.sessionStartTime = Date.now();
    
  • L913

    ts
    911
    912      const id = createParticipantId(
    913        options.id ?? `participant_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`
    914      );
    915
    

libs/psyche/tavus-turntaking/src/speaker-adaptation.ts#

  • L504

    ts
    502      const now = Date.now();
    503      const speakerId = createSpeakerId(
    504        options.speakerId ?? `speaker_${now}_${Math.random().toString(36).substring(2, 9)}`
    505      );
    506      const personality = options.personality ?? this.config.defaultPersonality;
    

libs/psyche/teams-integration/src/bot-sdk.ts#

  • L204

    ts
    202
    203        // Generate call ID
    204        this.callId = `call-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    205        this.meetingStatus = 'in_meeting';
    206
    
  • L713

    ts
    711     */
    712    private generateParticipantId(): string {
    713      return `participant-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    714    }
    715
    

libs/psyche/teams-integration/src/teams-conference-session.ts#

  • L648

    ts
    646
    647    private generateRoomId(): string {
    648      return `teams-room-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    649    }
    650
    

libs/psyche/tool-execution/src/parser.ts#

  • L391

    ts
    389   */
    390  export function generateCallId(): string {
    391    return `call_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
    392  }
    393
    

libs/psyche/viseme-generator/src/timing.ts#

  • L275

    ts
    273      // Apply variation
    274      if (applyVariation) {
    275        const variation = 1 + (Math.random() - 0.5) * 2 * this.config.durationVariation;
    276        duration *= variation;
    277      }
    

libs/psyche/voice-consistency/src/voice-identity.ts#

  • L553

    ts
    551
    552  function generateId(): string {
    553    return `voice_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 9)}`;
    554  }
    555
    

libs/psyche/voice-streaming/src/stream-session.ts#

  • L561

    ts
    559
    560    private generateSessionId(): string {
    561      return `stream-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
    562    }
    563
    

libs/psyche/zoom-integration/src/sdk.ts#

  • L1036

    ts
    1034
    1035    private generateParticipantId(): string {
    1036      return `p_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1037    }
    1038
    
  • L1040

    ts
    1038
    1039    private generateMessageId(): string {
    1040      return `m_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1041    }
    1042
    

libs/saraswati/battery/src/cell/cell-catalog.ts#

  • L821

    ts
    819      requiredByDate: string
    820    ): ProcurementOrder {
    821      const orderId = `PO-${Date.now()}-${Math.floor(Math.random() * 1000)}` as ProcurementOrderId;
    822      const order: ProcurementOrder = {
    823        orderId,
    

libs/saraswati/battery/src/module/module-engineering.ts#

  • L128

    ts
    126      const actualDensity = maxCurrentA / busbarCrossSectionMm2;
    127
    128      const moduleId = `MOD-${Date.now()}-${Math.floor(Math.random() * 1000)}` as ModuleDesignId;
    129
    130      const spec: ModuleDesignSpec = {
    

libs/saraswati/drones/src/delivery/delivery.ts#

  • L810

    ts
    808      // In production this would call the actual model endpoint
    809      const findings: DefectFinding[] = [];
    810      const simulatedDetections = Math.random() < 0.3 ? 1 : 0; // 30% chance of finding defect
    811
    812      for (let i = 0; i < simulatedDetections; i++) {
    
  • L813

    ts
    811
    812      for (let i = 0; i < simulatedDetections; i++) {
    813        const confidence = model.mAP50 * (0.8 + Math.random() * 0.2);
    814        const category =
    815          model.defectCategories[Math.floor(Math.random() * model.defectCategories.length)];
    
  • L815

    ts
    813        const confidence = model.mAP50 * (0.8 + Math.random() * 0.2);
    814        const category =
    815          model.defectCategories[Math.floor(Math.random() * model.defectCategories.length)];
    816        const severityLevels: DefectSeverity[] = ['negligible', 'minor', 'moderate', 'severe'];
    817        const severity = severityLevels[Math.floor(confidence * severityLevels.length)];
    

libs/saraswati/robotics/src/sota/swarm.ts#

  • L64

    ts
    62      const numSamples = 1000;
    63
    64      // Deterministic LCG to avoid Math.random() in computation
    65      // LCG parameters: modulus 2^31-1, a=1103515245, c=12345
    66      const counts = new Array<number>(robots.length).fill(0);
    

libs/saraswati/telecom/src/equipment/equipment.ts#

  • L261

    ts
    259
    260    return {
    261      antennaId: `ANT-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    262      towerId,
    263      antennaType,
    
  • L680

    ts
    678    }): TransmissionEquipment {
    679      const link: TransmissionEquipment = {
    680        transmissionId: `TX-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    681        towerId: params.towerId,
    682        backhaulType: params.backhaulType,
    
  • L965

    ts
    963    }): FuelTank {
    964      const tank: FuelTank = {
    965        tankId: `TNK-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    966        towerId: params.towerId,
    967        capacityL: params.capacityL,
    

libs/saraswati/telecom/src/maintenance/maintenance.ts#

  • L753

    ts
    751    addPart(params: Omit<SparePart, 'partId'>): SparePart {
    752      const part: SparePart = {
    753        partId: `PRT-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    754        ...params,
    755      };
    

libs/saraswati/telecom/src/site/site.ts#

  • L567

    ts
    565    addKeyHolder(params: Omit<KeyHolder, 'keyHolderId'>): KeyHolder {
    566      const kh: KeyHolder = {
    567        keyHolderId: `KH-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    568        ...params,
    569      };
    
  • L870

    ts
    868    addStakeholder(params: Omit<Stakeholder, 'stakeholderId'>): Stakeholder {
    869      const s: Stakeholder = {
    870        stakeholderId: `STK-${Date.now()}-${Math.floor(Math.random() * 1000)}`,
    871        ...params,
    872      };
    

libs/seshat/academy/src/certification.ts#

  • L699

    ts
    697    const levelCode = level.substring(0, 4).toUpperCase();
    698    const year = new Date().getFullYear();
    699    const seq = Math.floor(Math.random() * 9000) + 1000;
    700    return `${domainCode}-${levelCode}-${year}-${seq}`;
    701  }
    

libs/seshat/harmony/src/feng-shui.ts#

  • L1641

    ts
    1639        placement: `Near ${arrow.type} at (${arrow.source.x.toFixed(1)}, ${arrow.source.y.toFixed(1)})`,
    1640        description,
    1641        effectiveness: Math.round(60 + Math.random() * 20),
    1642      };
    1643    });
    

libs/seshat/sustainability/src/certification.ts#

  • L137

    ts
    135
    136    return {
    137      id: `cert_${params.type}_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    138      type: params.type,
    139      certificationBody: params.certificationBody,
    

libs/shared/ai-advanced/src/adapters/adapter-manager.ts#

  • L566

    ts
    564              const inputs = Array.isArray(params.input) ? params.input : [params.input];
    565              return {
    566                embeddings: inputs.map(() => new Array(1536).fill(0).map(() => Math.random())),
    567              };
    568            },
    

libs/shared/ai-advanced/src/benchmarks/benchmark-manager.ts#

  • L69

    ts
    67    }): Promise<BenchmarkSuite> {
    68      const suite: BenchmarkSuite = {
    69        id: `suite_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    70        name: params.name,
    71        description: params.description,
    
  • L185

    ts
    183
    184      const result: BenchmarkResult = {
    185        id: `bench_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as BenchmarkId,
    186        adapterId,
    187        modelId,
    

libs/shared/ai-advanced/src/edge/edge-manager.ts#

  • L85

    ts
    83    }): Promise<EdgeModel> {
    84      const model: EdgeModel = {
    85        id: `edge_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    86        name: params.name,
    87        description: params.description,
    
  • L388

    ts
    386
    387      const deployment: EdgeDeployment = {
    388        id: `deploy_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    389        modelId: config.modelId,
    390        runtime: config.runtime,
    
  • L542

    ts
    540
    541    async loadModel(config: OnnxModelConfig): Promise<OnnxSession> {
    542      const sessionId = `session_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    543
    544      const session: OnnxSession = {
    
  • L554

    ts
    552          return {
    553            logits: {
    554              data: new Float32Array(outputSize).fill(0).map(() => Math.random()),
    555              dims: [1, outputSize],
    556              type: 'float32',
    

libs/shared/ai-advanced/src/research/research-manager.ts#

  • L112

    ts
    110    }): Promise<ResearchProject> {
    111      const project: ResearchProject = {
    112        id: `proj_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as ResearchProjectId,
    113        name: params.name,
    114        description: params.description,
    
  • L178

    ts
    176    ): Promise<Experiment> {
    177      const experiment: Experiment = {
    178        id: `exp_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    179        name: params.name,
    180        description: params.description,
    
  • L214

    ts
    212    ): Promise<ExperimentRun> {
    213      const run: ExperimentRun = {
    214        id: `run_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    215        config,
    216        metrics: {},
    
  • L362

    ts
    360    }): Promise<BenchmarkDataset> {
    361      const dataset: BenchmarkDataset = {
    362        id: `dataset_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as DatasetId,
    363        name: params.name,
    364        description: params.description,
    
  • L444

    ts
    442    }): Promise<PaperReproduction> {
    443      const reproduction: PaperReproduction = {
    444        id: `repro_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    445        paperId: params.paperId,
    446        title: params.title,
    
  • L537

    ts
    535    ): Promise<ResearchCollaboration> {
    536      const collaboration: ResearchCollaboration = {
    537        id: `collab_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    538        projectId,
    539        members: members.map(m => ({ ...m, joinedAt: new Date() })),
    

libs/shared/ai-advanced/src/selection/model-selector.ts#

  • L50

    ts
    48    }): Promise<ModelProfile> {
    49      const profile: ModelProfile = {
    50        id: `profile_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as ModelProfileId,
    51        adapterId: params.adapterId,
    52        modelId: params.modelId,
    

libs/shared/ai/src/advanced/index.ts#

  • L20

    ts
    18
    19  function generateId(prefix: string): string {
    20    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    21  }
    22
    
  • L702

    ts
    700
    701      // Weighted random selection
    702      const random = Math.random();
    703      let cumulative = 0;
    704
    

libs/shared/ai/src/local/inference-engine.ts#

  • L1125

    ts
    1123   */
    1124  export function generateRequestId(): string {
    1125    return `req_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
    1126  }
    

libs/shared/ai/src/prompts/testing.ts#

  • L25

    ts
    23  /** Generate a test case ID */
    24  export function generateTestCaseId(): TestCaseID {
    25    return `tc_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as TestCaseID;
    26  }
    27
    
  • L96

    ts
    94  /** Generate a test run ID */
    95  export function generateTestRunId(): TestRunID {
    96    return `tr_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as TestRunID;
    97  }
    98
    
  • L268

    ts
    266  /** Generate an A/B test ID */
    267  export function generateABTestId(): ABTestID {
    268    return `ab_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as ABTestID;
    269  }
    270
    

libs/shared/ai/src/prompts/versioning.ts#

  • L81

    ts
    79  /** Generate a new version ID */
    80  export function generateVersionId(): PromptVersionID {
    81    return `pv_${Date.now()}_${Math.random().toString(36).substring(2, 11)}` as PromptVersionID;
    82  }
    83
    

libs/shared/ai/src/router/ml-router.ts#

  • L316

    ts
    314      const indices = Array.from({ length: numFeatures }, (_, i) => i);
    315      for (let i = indices.length - 1; i > 0; i--) {
    316        const j = Math.floor(Math.random() * (i + 1));
    317        [indices[i], indices[j]] = [indices[j], indices[i]];
    318      }
    
  • L550

    ts
    548
    549      for (let i = 0; i < n; i++) {
    550        const idx = Math.floor(Math.random() * X.length);
    551        bootX.push(X[idx]);
    552        bootY.push(y[idx]);
    
  • L1024

    ts
    1022
    1023      // A/B testing
    1024      const isABTestSample = this.mlConfig.enableABTesting && Math.random() < 0.5;
    1025      if (isABTestSample) {
    1026        useML = Math.random() < this.mlConfig.abTestRatio;
    
  • L1026

    ts
    1024      const isABTestSample = this.mlConfig.enableABTesting && Math.random() < 0.5;
    1025      if (isABTestSample) {
    1026        useML = Math.random() < this.mlConfig.abTestRatio;
    1027      }
    1028
    

libs/shared/ai/src/usage/index.ts#

  • L186

    ts
    184
    185      const record: UsageRecord = {
    186        id: `usage_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    187        timestamp: new Date(),
    188        provider,
    
  • L216

    ts
    214
    215      const record: UsageRecord = {
    216        id: `usage_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    217        timestamp: new Date(),
    218        provider,
    

libs/shared/auth/src/service.ts#

  • L868

    ts
    866
    867      // Add random suffix for uniqueness
    868      const suffix = Math.random().toString(36).substring(2, 8);
    869      return `${base.substring(0, 20)}_${suffix}`;
    870    }
    

libs/shared/cache/src/distributed-lock.ts#

  • L273

    ts
    271    private generateValue(): string {
    272      // Generate unique value for lock ownership
    273      return `${process.pid}-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
    274    }
    275
    

libs/shared/cache/src/key-builder.ts#

  • L253

    ts
    251   */
    252  export function uniqueSuffix(): string {
    253    return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    254  }
    255
    

libs/shared/config/src/features.ts#

  • L592

    ts
    590
    591    // Random percentage check
    592    return Math.random() * 100 < percentage;
    593  }
    594
    

libs/shared/gpu-dispatcher/src/fallback.ts#

  • L629

    ts
    627      // Use priority as weight
    628      const totalWeight = endpoints.reduce((sum, e) => sum + (e.priority ?? 1), 0);
    629      let random = Math.random() * totalWeight;
    630
    631      for (const endpoint of endpoints) {
    
  • L654

    ts
    652      alternatives: TrackedEndpoint[]
    653    ): EndpointSelection {
    654      const index = Math.floor(Math.random() * endpoints.length);
    655      const selected = endpoints[index];
    656
    

libs/shared/gpu-dispatcher/src/retry.ts#

  • L364

    ts
    362    if (config.jitter) {
    363      const jitterRange = baseDelay * config.jitterFactor;
    364      const jitter = (Math.random() * 2 - 1) * jitterRange;
    365      baseDelay = baseDelay + jitter;
    366    }
    

libs/shared/http-client/src/retry.ts#

  • L55

    ts
    53    // Add jitter (0-50% random variation)
    54    if (config.jitter) {
    55      const jitterAmount = delay * 0.5 * Math.random();
    56      delay = delay + jitterAmount;
    57    }
    

libs/shared/logging/src/sampling/index.ts#

  • L91

    ts
    89
    90      // Apply fixed rate sampling
    91      if (Math.random() < this.config.rate) {
    92        this.stats.sampled++;
    93        return true;
    
  • L161

    ts
    159      }
    160
    161      if (Math.random() < this.currentRate) {
    162        this.stats.sampled++;
    163        return true;
    
  • L238

    ts
    236      const rate = this.config.rates[priority] ?? 1.0;
    237
    238      if (Math.random() < rate) {
    239        this.stats.sampled++;
    240        return true;
    
  • L311

    ts
    309      // If no hash value, use random sampling
    310      if (!hashValue) {
    311        if (Math.random() < this.config.rate) {
    312          this.stats.sampled++;
    313          return true;
    

libs/shared/migration/src/scripts/lilith-ingestion-to-sophia.ts#

  • L591

    ts
    589      return cryptoObj.randomUUID();
    590    }
    591    // Fallback RFC 4122 v4 via getRandomValues. Math.random is NOT a valid
    592    // fallback — it breaks resumability because two runs against the same
    593    // source row would generate different target ids, which would double-insert
    

libs/shared/migration/src/scripts/yemaya-engine-to-bellona.ts#

  • L725

    ts
    723      return cryptoObj.randomUUID();
    724    }
    725    // Fallback RFC 4122 v4 via getRandomValues. Math.random is NOT a valid
    726    // fallback — it breaks resumability because two runs against the same
    727    // source row would generate different target ids, which would double-insert
    

libs/shared/migration/src/scripts/yemaya-generation-to-isis.ts#

  • L771

    ts
    769      return cryptoObj.randomUUID();
    770    }
    771    // Fallback RFC 4122 v4 via getRandomValues. Math.random is NOT a valid
    772    // fallback — it breaks resumability because two runs against the same
    773    // source row would generate different target ids, which would double-insert
    

libs/shared/rate-limit/src/limiters/exemptions.ts#

  • L164

    ts
    162   */
    163  function generateExemptionId(): string {
    164    return `exempt_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    165  }
    166
    

libs/shared/rate-limit/src/monitoring/alerts.ts#

  • L92

    ts
    90   */
    91  function generateAlertId(): string {
    92    return `alert_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    93  }
    94
    

libs/shared/runpod-client/src/client.ts#

  • L504

    ts
    502
    503      if (jitter) {
    504        const jitterFactor = 0.75 + Math.random() * 0.5;
    505        delay = Math.round(delay * jitterFactor);
    506      }
    

libs/shared/runpod-client/src/polling.ts#

  • L55

    ts
    53   */
    54  export function addJitter(delay: number): number {
    55    const jitterFactor = 0.75 + Math.random() * 0.5; // 0.75 to 1.25
    56    return Math.round(delay * jitterFactor);
    57  }
    

libs/shared/service-discovery/src/service-discovery.ts#

  • L266

    ts
    264      switch (strategy) {
    265        case 'random':
    266          return instances[Math.floor(Math.random() * instances.length)];
    267
    268        case 'weighted': {
    
  • L270

    ts
    268        case 'weighted': {
    269          const totalWeight = instances.reduce((sum, i) => sum + (i.weight ?? 100), 0);
    270          let random = Math.random() * totalWeight;
    271          for (const instance of instances) {
    272            random -= instance.weight ?? 100;
    

libs/shared/testing/src/fixtures/index.ts#

  • L20

    ts
    18    let result = '';
    19    for (let i = 0; i < length; i++) {
    20      result += chars.charAt(Math.floor(Math.random() * chars.length));
    21    }
    22    return result;
    
  • L36

    ts
    34   */
    35  export function randomInt(min: number, max: number): number {
    36    return Math.floor(Math.random() * (max - min + 1)) + min;
    37  }
    38
    
  • L43

    ts
    41   */
    42  export function randomPick<T>(items: T[]): T {
    43    return items[Math.floor(Math.random() * items.length)];
    44  }
    45
    
  • L51

    ts
    49  export function randomUUID(): string {
    50    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    51      const r = (Math.random() * 16) | 0;
    52      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    53      return v.toString(16);
    
  • L61

    ts
    59   */
    60  export function randomDate(start: Date = new Date(2020, 0, 1), end: Date = new Date()): Date {
    61    return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
    62  }
    63
    
  • L68

    ts
    66   */
    67  export function randomBoolean(): boolean {
    68    return Math.random() < 0.5;
    69  }
    70
    

libs/shared/tracing/src/tracer.ts#

  • L582

    ts
    580
    581    private shouldSample(): boolean {
    582      return Math.random() < this.config.sampleRate;
    583    }
    584
    

libs/shared/types/src/legacy.ts#

  • L606

    ts
    604
    605        if (jitter > 0) {
    606          const jitterAmount = calculatedDelay * jitter * Math.random();
    607          calculatedDelay = calculatedDelay + jitterAmount;
    608        }
    

libs/shared/websocket/src/queue.ts#

  • L75

    ts
    73   */
    74  function generateMessageId(): string {
    75    return `msg_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    76  }
    77
    

libs/shared/websocket/src/state.ts#

  • L623

    ts
    621    private generateSessionId(): string {
    622      const timestamp = Date.now().toString(36);
    623      const random = Math.random().toString(36).substring(2, 10);
    624      return `ses_${timestamp}_${random}`;
    625    }
    

libs/sophia/citation-analysis/src/network/citation-network-analyzer.ts#

  • L506

    ts
    504        const shuffled = [...nodeIds];
    505        for (let i = shuffled.length - 1; i > 0; i--) {
    506          const j = Math.floor(Math.random() * (i + 1));
    507          [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
    508        }
    

libs/sophia/evaluation/src/benchmarks/benchmark-runner.ts#

  • L114

    ts
    112      const startTime = new Date();
    113      const evaluationId = createEvaluationId(
    114        `bench-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
    115      );
    116
    

libs/sophia/evaluation/src/citation/citation-checker.ts#

  • L103

    ts
    101      const startTime = Date.now();
    102      const evaluationId = createEvaluationId(
    103        `citation-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
    104      );
    105
    

libs/sophia/evaluation/src/groundedness/groundedness-scorer.ts#

  • L66

    ts
    64      const startTime = Date.now();
    65      const evaluationId = createEvaluationId(
    66        `ground-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
    67      );
    68
    

libs/sophia/evaluation/src/retrieval/retrieval-evaluator.ts#

  • L86

    ts
    84      const startTime = Date.now();
    85      const evaluationId = createEvaluationId(
    86        `eval-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
    87      );
    88
    

libs/sophia/indexing/src/graphs/graph-visualization.ts#

  • L379

    ts
    377        ...(options.includePositions && node.position
    378          ? { x: node.position.x, y: node.position.y }
    379          : { x: Math.random() * 100, y: Math.random() * 100 }),
    380        ...(options.includeStyling && node.style
    381          ? {
    

libs/sophia/knowledge-graph/src/algorithms/community.ts#

  • L71

    ts
    69      const shuffled = [...nodeIds];
    70      for (let i = shuffled.length - 1; i > 0; i--) {
    71        const j = Math.floor(Math.random() * (i + 1));
    72        [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
    73      }
    

libs/sophia/semantic-search/src/search-orchestration/search-orchestration.ts#

  • L727

    ts
    725   */
    726  function generateSessionId(): string {
    727    return `session-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
    728  }
    729
    

libs/tara/analytics/src/events/index.ts#

  • L709

    ts
    707   */
    708  export function createEventId(): string {
    709    return `${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 11)}`;
    710  }
    

libs/tara/analytics/src/providers/internal.ts#

  • L215

    ts
    213
    214    private generateId(): string {
    215      return `${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 11)}`;
    216    }
    217  }
    

libs/tara/analytics/src/tracking/tracker.ts#

  • L161

    ts
    159      // Apply sampling
    160      const samplingRate = options.samplingRate ?? this.config.samplingRate;
    161      if (Math.random() > samplingRate) {
    162        return;
    163      }
    
  • L346

    ts
    344
    345    private generateId(): string {
    346      return `${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 11)}`;
    347    }
    348  }
    

libs/tara/content/src/api/client.ts#

  • L1254

    ts
    1252      const maxDelay = this.config.retry.maxDelay ?? 10000;
    1253      const exponentialDelay = initialDelay * Math.pow(backoffMultiplier, attempt - 1);
    1254      const jitter = Math.random() * 0.3 * exponentialDelay;
    1255      return Math.min(exponentialDelay + jitter, maxDelay);
    1256    }
    

libs/tara/monitoring/src/error-tracking/error-tracker.ts#

  • L463

    ts
    461        return false;
    462      }
    463      return Math.random() < this.config.sampleRate;
    464    }
    465
    
  • L470

    ts
    468      let id = '';
    469      for (let i = 0; i < 32; i++) {
    470        id += chars[Math.floor(Math.random() * chars.length)];
    471      }
    472      return id;
    

libs/tara/monitoring/src/performance/performance-monitor.ts#

  • L125

    ts
    123      let id = '';
    124      for (let i = 0; i < 16; i++) {
    125        id += chars[Math.floor(Math.random() * chars.length)];
    126      }
    127      return id;
    
  • L291

    ts
    289      let id = '';
    290      for (let i = 0; i < 32; i++) {
    291        id += chars[Math.floor(Math.random() * chars.length)];
    292      }
    293      return id;
    
  • L300

    ts
    298      let id = '';
    299      for (let i = 0; i < 16; i++) {
    300        id += chars[Math.floor(Math.random() * chars.length)];
    301      }
    302      return id;
    
  • L456

    ts
    454        return false;
    455      }
    456      return Math.random() < this.config.sampleRate;
    457    }
    458
    

libs/tara/monitoring/src/providers/console.ts#

  • L249

    ts
    247      const timestamp = Date.now().toString(16);
    248      const counter = this.eventCounter.toString(16).padStart(4, '0');
    249      const random = Math.random().toString(16).slice(2, 10);
    250      return `${timestamp}${counter}${random}`.slice(0, 32);
    251    }
    

libs/tara/monitoring/src/providers/memory.ts#

  • L416

    ts
    414      const timestamp = Date.now().toString(16);
    415      const counter = this.eventCounter.toString(16).padStart(4, '0');
    416      const random = Math.random().toString(16).slice(2, 10);
    417      return `${timestamp}${counter}${random}`.slice(0, 32);
    418    }
    

libs/tara/monitoring/src/providers/server.ts#

  • L350

    ts
    348        return false;
    349      }
    350      return Math.random() < this.config.sampleRate;
    351    }
    352
    
  • L357

    ts
    355      const timestamp = Date.now().toString(16);
    356      const counter = this.eventCounter.toString(16).padStart(4, '0');
    357      const random = Math.random().toString(16).slice(2, 10);
    358      return `${timestamp}${counter}${random}`.slice(0, 32);
    359    }
    

libs/tara/ui/src/animations/micro.tsx#

  • L424

    ts
    422      const particlePositions = Array.from({ length: particleCount }, (_, i) => {
    423        const angle = (i / particleCount) * Math.PI * 2;
    424        const distance = 20 + Math.random() * 10;
    425        return {
    426          x: Math.cos(angle) * distance,
    

libs/tara/ui/src/components/SessionComplete/SessionComplete.tsx#

  • L423

    ts
    421  ): { x: number; y: number; delay: number; scale: number }[] {
    422    return Array.from({ length: count }, () => ({
    423      x: Math.random() * 100,
    424      y: Math.random() * 100,
    425      delay: Math.random() * 500,
    
  • L424

    ts
    422    return Array.from({ length: count }, () => ({
    423      x: Math.random() * 100,
    424      y: Math.random() * 100,
    425      delay: Math.random() * 500,
    426      scale: 0.5 + Math.random() * 0.5,
    
  • L425

    ts
    423      x: Math.random() * 100,
    424      y: Math.random() * 100,
    425      delay: Math.random() * 500,
    426      scale: 0.5 + Math.random() * 0.5,
    427    }));
    
  • L426

    ts
    424      y: Math.random() * 100,
    425      delay: Math.random() * 500,
    426      scale: 0.5 + Math.random() * 0.5,
    427    }));
    428  }
    
  • L438

    ts
    436    const colors = ['#6366f1', '#8b5cf6', '#ec4899', '#f97316', '#fbbf24', '#10b981'];
    437    return Array.from({ length: count }, () => ({
    438      x: Math.random() * 100,
    439      delay: Math.random() * 1000,
    440      color: colors[Math.floor(Math.random() * colors.length)],
    
  • L439

    ts
    437    return Array.from({ length: count }, () => ({
    438      x: Math.random() * 100,
    439      delay: Math.random() * 1000,
    440      color: colors[Math.floor(Math.random() * colors.length)],
    441      rotation: Math.random() * 360,
    
  • L440

    ts
    438      x: Math.random() * 100,
    439      delay: Math.random() * 1000,
    440      color: colors[Math.floor(Math.random() * colors.length)],
    441      rotation: Math.random() * 360,
    442    }));
    
  • L441

    ts
    439      delay: Math.random() * 1000,
    440      color: colors[Math.floor(Math.random() * colors.length)],
    441      rotation: Math.random() * 360,
    442    }));
    443  }
    

libs/kalika/algebra/src/finite-groups.ts#

  • L2745

    ts
    2743        Math.ceil(Math.log(targetOrder) / Math.log(prime)) + 2;
    2744      const random =
    2745        options.randomSeed === undefined ? Math.random : seededRandom(options.randomSeed);
    2746      const elements = this.closure(maxElements).filter(
    2747        (element) => element.order() > 1 && isPowerOfPrime(element.order(), prime)
    

libs/kalika/notebooks/src/collaboration.ts#

  • L1217

    ts
    1215
    1216  function createSessionId(clientId: number): string {
    1217    return `notebook-session-${String(clientId)}-${Math.random().toString(36).slice(2, 10)}`;
    1218  }
    

libs/kalika/notebooks/src/sharing.ts#

  • L153

    ts
    151    nextGrantId: () => `notebook-grant-${nextGeneratedSharingId()}`,
    152    nextLinkId: () => `notebook-link-${nextGeneratedSharingId()}`,
    153    nextLinkToken: () => `unb_${nextGeneratedSharingId()}_${Math.random().toString(36).slice(2, 14)}`,
    154  };
    155
    

libs/kalika/quantum-field-theory/src/large-expression.ts#

  • L1102

    ts
    1100
    1101  function randomSuffix(): string {
    1102    return Math.random().toString(36).slice(2, 10);
    1103  }
    

libs/veritas/agents-devops/src/devops-agent.ts#

  • L623

    ts
    621      // In production, this would actually call the endpoint
    622      // For now, simulate a health check
    623      const simulatedSuccess = Math.random() > 0.1; // 90% success rate
    624      const simulatedLatency = Math.random() * 200 + 50; // 50-250ms
    625
    
  • L624

    ts
    622      // For now, simulate a health check
    623      const simulatedSuccess = Math.random() > 0.1; // 90% success rate
    624      const simulatedLatency = Math.random() * 200 + 50; // 50-250ms
    625
    626      return {
    

libs/veritas/agents-orchestrator/src/conflict-resolver.ts#

  • L449

    ts
    447
    448    private resolveRandom(conflict: Conflict): Resolution {
    449      const randomIndex = Math.floor(Math.random() * conflict.participants.length);
    450      const winner = conflict.participants[randomIndex];
    451
    

libs/veritas/agents-qa/src/qa-agent.ts#

  • L756

    ts
    754      // Simulate test execution
    755      // In production, this would actually run the test
    756      const simulatedResult = Math.random();
    757      const passed = simulatedResult > 0.15; // 85% pass rate
    758      const isFlaky = simulatedResult > 0.1 && simulatedResult <= 0.15; // 5% flaky
    
  • L760

    ts
    758      const isFlaky = simulatedResult > 0.1 && simulatedResult <= 0.15; // 5% flaky
    759
    760      const duration = Math.random() * 1000 + 100; // 100-1100ms
    761
    762      let status: TestStatus;
    
  • L1235

    ts
    1233      const responseTimes: number[] = [];
    1234      for (let i = 0; i < totalRequests; i++) {
    1235        responseTimes.push(Math.random() * 200 + 50); // 50-250ms
    1236      }
    1237      responseTimes.sort((a, b) => a - b);
    

libs/veritas/agents-social-media/src/social-media-manager.ts#

  • L957

    ts
    955     * end-to-end in tests that don't care about real platform calls.
    956     * The fallback uses `crypto.randomUUID()` rather than
    957     * `Math.random()` so the id is collision-free without being
    958     * mistaken for a real platform identifier.
    959     */
    
  • L1952

    ts
    1950  /**
    1951   * V1-P2-1241 — UUID-derived id without dashes for the legacy
    1952   * fallback platformPostId. Replaces the prior `Math.random()`
    1953   * approach so collisions are vanishingly unlikely without
    1954   * pretending to be a real platform identifier.
    

libs/veritas/ai-next-gen/src/investigations.ts#

  • L2364

    ts
    2362     */
    2363    private generateId(prefix: string): string {
    2364      return `${prefix}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    2365    }
    2366
    

libs/veritas/ai-next-gen/src/osint.ts#

  • L195

    ts
    193  /**
    194   * V1-P2-1232 — pluggable bot detector. The previous `detectBots`
    195   * generated `probability: Math.random() * 0.5` and a fixed list
    196   * of three indicators per account regardless of input. The
    197   * replacement delegates to a wired adapter (typically a
    
  • L314

    ts
    312   * Calibrated logistic-regression bot detector.
    313   *
    314   * The previous `detectBots` returned `probability: Math.random() *
    315   * 0.5` and three fixed indicator strings per account. This
    316   * replacement is a real linear classifier over a feature set drawn
    
  • L1122

    ts
    1120        narratives: params.keywords.map((kw) => ({
    1121          theme: kw,
    1122          postCount: Math.floor(Math.random() * 10000) + 1000,
    1123          sentiment: Math.random() * 2 - 1,
    1124          peakDate: new Date(
    
  • L1123

    ts
    1121          theme: kw,
    1122          postCount: Math.floor(Math.random() * 10000) + 1000,
    1123          sentiment: Math.random() * 2 - 1,
    1124          peakDate: new Date(
    1125            params.dateRange.start.getTime() +
    
  • L1126

    ts
    1124          peakDate: new Date(
    1125            params.dateRange.start.getTime() +
    1126              Math.random() * (params.dateRange.end.getTime() - params.dateRange.start.getTime())
    1127          ),
    1128          spreadVelocity: Math.random() * 100,
    
  • L1128

    ts
    1126              Math.random() * (params.dateRange.end.getTime() - params.dateRange.start.getTime())
    1127          ),
    1128          spreadVelocity: Math.random() * 100,
    1129        })),
    1130        influencers: Array.from({ length: 10 }, () => ({
    
  • L1132

    ts
    1130        influencers: Array.from({ length: 10 }, () => ({
    1131          accountId: randomUUID(),
    1132          influence: Math.random(),
    1133          reach: Math.floor(Math.random() * 1000000),
    1134        })),
    
  • L1133

    ts
    1131          accountId: randomUUID(),
    1132          influence: Math.random(),
    1133          reach: Math.floor(Math.random() * 1000000),
    1134        })),
    1135      };
    
  • L1389

    ts
    1387      if (request.analysisTypes.includes('sentiment_analysis')) {
    1388        result.sentiment = {
    1389          overall: Math.random() * 2 - 1,
    1390          distribution: { positive: 0.3, neutral: 0.5, negative: 0.2 },
    1391          timeline: [],
    

libs/veritas/analytics/src/events/tracker.ts#

  • L579

    ts
    577
    578    private shouldSample(): boolean {
    579      return Math.random() < this.config.samplingRate;
    580    }
    581
    

libs/veritas/analytics/src/types.ts#

  • L1087

    ts
    1085  export function generateEventId(): string {
    1086    const timestamp = Date.now().toString(36);
    1087    const randomPart = Math.random().toString(36).substring(2, 10);
    1088    return `evt_${timestamp}_${randomPart}`;
    1089  }
    
  • L1096

    ts
    1094  export function generateSessionId(): string {
    1095    const timestamp = Date.now().toString(36);
    1096    const randomPart = Math.random().toString(36).substring(2, 10);
    1097    return `ses_${timestamp}_${randomPart}`;
    1098  }
    

libs/veritas/archive/src/archive.ts#

  • L478

    ts
    476
    477    private generateId(prefix: string): string {
    478      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    479    }
    480
    

libs/veritas/archive/src/collections.ts#

  • L462

    ts
    460
    461    private generateId(prefix: string): string {
    462      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    463    }
    464
    

libs/veritas/archive/src/on-this-day.ts#

  • L400

    ts
    398
    399    private generateId(prefix: string): string {
    400      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    401    }
    402
    

libs/veritas/archive/src/story-tracking.ts#

  • L447

    ts
    445
    446    private generateId(prefix: string): string {
    447      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    448    }
    449
    

libs/veritas/article-generation/src/article-generator.ts#

  • L458

    ts
    456    private generateArticleId(): string {
    457      const timestamp = Date.now().toString(36);
    458      const random = Math.random().toString(36).substring(2, 8);
    459      return `article_${timestamp}_${random}`;
    460    }
    

libs/veritas/audio-production/src/clients/ghana-nlp.ts#

  • L684

    ts
    682
    683    if (config.jitter) {
    684      delay = delay * (0.5 + Math.random() * 0.5);
    685    }
    686
    

libs/veritas/automated-content/src/generators/fuel-generator.ts#

  • L367

    ts
    365
    366      return products.map((product) => {
    367        const basePrice = basePrices[product] + Math.random() * 2;
    368        const change = (Math.random() - 0.5) * 1.5; // -0.75 to +0.75 GHS
    369        const price = basePrice + change;
    
  • L368

    ts
    366      return products.map((product) => {
    367        const basePrice = basePrices[product] + Math.random() * 2;
    368        const change = (Math.random() - 0.5) * 1.5; // -0.75 to +0.75 GHS
    369        const price = basePrice + change;
    370        const previousPrice = basePrice;
    

libs/veritas/automated-content/src/generators/loadshed-generator.ts#

  • L164

    ts
    162
    163      // Determine current status (simulated)
    164      const hasActiveShedding = Math.random() < 0.3; // 30% chance of active shedding
    165      const hasScheduledShedding = Math.random() < 0.5; // 50% chance of scheduled shedding
    166
    
  • L165

    ts
    163      // Determine current status (simulated)
    164      const hasActiveShedding = Math.random() < 0.3; // 30% chance of active shedding
    165      const hasScheduledShedding = Math.random() < 0.5; // 50% chance of scheduled shedding
    166
    167      const status: LoadSheddingStatus = hasActiveShedding
    
  • L469

    ts
    467
    468      // Select random zones for shedding
    469      const selectedZones = ECG_ZONES.filter(() => Math.random() < 0.3);
    470
    471      selectedZones.forEach((zone, index) => {
    
  • L473

    ts
    471      selectedZones.forEach((zone, index) => {
    472        // Morning or afternoon slot
    473        const isMorning = Math.random() < 0.5;
    474        const startHour = isMorning ? 6 + (index % 3) * 2 : 14 + (index % 3) * 2;
    475        const duration = 4 + Math.floor(Math.random() * 4); // 4-8 hours
    
  • L475

    ts
    473        const isMorning = Math.random() < 0.5;
    474        const startHour = isMorning ? 6 + (index % 3) * 2 : 14 + (index % 3) * 2;
    475        const duration = 4 + Math.floor(Math.random() * 4); // 4-8 hours
    476
    477        const startTime = new Date(baseDate);
    
  • L489

    ts
    487          endTime,
    488          duration,
    489          confirmed: Math.random() < 0.8,
    490          reason: this.getRandomReason(),
    491        });
    
  • L501

    ts
    499
    500      // 1-3 active outages
    501      const count = 1 + Math.floor(Math.random() * 3);
    502      const selectedZones = ECG_ZONES.sort(() => Math.random() - 0.5).slice(0, count);
    503
    
  • L502

    ts
    500      // 1-3 active outages
    501      const count = 1 + Math.floor(Math.random() * 3);
    502      const selectedZones = ECG_ZONES.sort(() => Math.random() - 0.5).slice(0, count);
    503
    504      selectedZones.forEach((zone) => {
    
  • L505

    ts
    503
    504      selectedZones.forEach((zone) => {
    505        const hoursAgo = Math.random() * 3;
    506        const startTime = new Date(now.getTime() - hoursAgo * 60 * 60 * 1000);
    507        const duration = 4 + Math.floor(Math.random() * 4);
    
  • L507

    ts
    505        const hoursAgo = Math.random() * 3;
    506        const startTime = new Date(now.getTime() - hoursAgo * 60 * 60 * 1000);
    507        const duration = 4 + Math.floor(Math.random() * 4);
    508        const endTime = new Date(startTime.getTime() + duration * 60 * 60 * 1000);
    509
    
  • L526

    ts
    524    private generatePowerStatus(): PowerStatus {
    525      const stability =
    526        Math.random() < 0.7 ? 'stable' : Math.random() < 0.5 ? 'unstable' : 'critical';
    527      const baseGeneration = 2500; // MW
    528      const generation = baseGeneration + Math.floor(Math.random() * 500) - 250;
    
  • L528

    ts
    526        Math.random() < 0.7 ? 'stable' : Math.random() < 0.5 ? 'unstable' : 'critical';
    527      const baseGeneration = 2500; // MW
    528      const generation = baseGeneration + Math.floor(Math.random() * 500) - 250;
    529      const demand = generation + Math.floor(Math.random() * 300);
    530      const deficit = Math.max(0, demand - generation);
    
  • L529

    ts
    527      const baseGeneration = 2500; // MW
    528      const generation = baseGeneration + Math.floor(Math.random() * 500) - 250;
    529      const demand = generation + Math.floor(Math.random() * 300);
    530      const deficit = Math.max(0, demand - generation);
    531
    
  • L556

    ts
    554    private selectTips(status: LoadSheddingStatus): string[] {
    555      const count = status === 'none' ? 2 : 4;
    556      return POWER_TIPS.sort(() => Math.random() - 0.5).slice(0, count);
    557    }
    558
    
  • L568

    ts
    566        'Generation shortfall',
    567      ];
    568      return reasons[Math.floor(Math.random() * reasons.length)];
    569    }
    570
    

libs/veritas/automated-content/src/generators/market-generator.ts#

  • L388

    ts
    386      return indices.map((index) => {
    387        const baseValue = this.getBaseIndexValue(index);
    388        const change = (Math.random() - 0.5) * 4; // -2% to +2%
    389        const value = baseValue * (1 + change / 100);
    390
    
  • L397

    ts
    395          percentChange: change,
    396          open: baseValue,
    397          high: value * (1 + Math.random() * 0.01),
    398          low: value * (1 - Math.random() * 0.01),
    399          previousClose: baseValue,
    
  • L398

    ts
    396          open: baseValue,
    397          high: value * (1 + Math.random() * 0.01),
    398          low: value * (1 - Math.random() * 0.01),
    399          previousClose: baseValue,
    400        };
    
  • L407

    ts
    405      switch (index) {
    406        case 'gse_ci':
    407          return 3200 + Math.random() * 200;
    408        case 'gse_fsi':
    409          return 2100 + Math.random() * 100;
    
  • L409

    ts
    407          return 3200 + Math.random() * 200;
    408        case 'gse_fsi':
    409          return 2100 + Math.random() * 100;
    410        case 'gse_sas':
    411          return 1800 + Math.random() * 100;
    
  • L411

    ts
    409          return 2100 + Math.random() * 100;
    410        case 'gse_sas':
    411          return 1800 + Math.random() * 100;
    412        default:
    413          return 100;
    
  • L419

    ts
    417    private generateStockData(): StockData[] {
    418      return GSE_STOCKS.map((stock) => {
    419        const basePrice = 1 + Math.random() * 20;
    420        const change = (Math.random() - 0.5) * 10;
    421        const price = basePrice * (1 + change / 100);
    
  • L420

    ts
    418      return GSE_STOCKS.map((stock) => {
    419        const basePrice = 1 + Math.random() * 20;
    420        const change = (Math.random() - 0.5) * 10;
    421        const price = basePrice * (1 + change / 100);
    422
    
  • L429

    ts
    427          change: price - basePrice,
    428          percentChange: change,
    429          volume: Math.floor(Math.random() * 500000) + 10000,
    430          marketCap: price * (1000000 + Math.random() * 10000000),
    431        };
    
  • L430

    ts
    428          percentChange: change,
    429          volume: Math.floor(Math.random() * 500000) + 10000,
    430          marketCap: price * (1000000 + Math.random() * 10000000),
    431        };
    432      });
    
  • L439

    ts
    437        {
    438          pair: 'USD/GHS',
    439          buyRate: 14.8 + Math.random() * 0.5,
    440          sellRate: 15.0 + Math.random() * 0.5,
    441          bogRate: 14.9,
    
  • L440

    ts
    438          pair: 'USD/GHS',
    439          buyRate: 14.8 + Math.random() * 0.5,
    440          sellRate: 15.0 + Math.random() * 0.5,
    441          bogRate: 14.9,
    442          change: (Math.random() - 0.5) * 0.3,
    
  • L442

    ts
    440          sellRate: 15.0 + Math.random() * 0.5,
    441          bogRate: 14.9,
    442          change: (Math.random() - 0.5) * 0.3,
    443          percentChange: (Math.random() - 0.5) * 2,
    444        },
    
  • L443

    ts
    441          bogRate: 14.9,
    442          change: (Math.random() - 0.5) * 0.3,
    443          percentChange: (Math.random() - 0.5) * 2,
    444        },
    445        {
    
  • L447

    ts
    445        {
    446          pair: 'EUR/GHS',
    447          buyRate: 16.2 + Math.random() * 0.5,
    448          sellRate: 16.5 + Math.random() * 0.5,
    449          bogRate: 16.3,
    
  • L448

    ts
    446          pair: 'EUR/GHS',
    447          buyRate: 16.2 + Math.random() * 0.5,
    448          sellRate: 16.5 + Math.random() * 0.5,
    449          bogRate: 16.3,
    450          change: (Math.random() - 0.5) * 0.3,
    
  • L450

    ts
    448          sellRate: 16.5 + Math.random() * 0.5,
    449          bogRate: 16.3,
    450          change: (Math.random() - 0.5) * 0.3,
    451          percentChange: (Math.random() - 0.5) * 2,
    452        },
    
  • L451

    ts
    449          bogRate: 16.3,
    450          change: (Math.random() - 0.5) * 0.3,
    451          percentChange: (Math.random() - 0.5) * 2,
    452        },
    453        {
    
  • L455

    ts
    453        {
    454          pair: 'GBP/GHS',
    455          buyRate: 18.8 + Math.random() * 0.5,
    456          sellRate: 19.2 + Math.random() * 0.5,
    457          bogRate: 19.0,
    
  • L456

    ts
    454          pair: 'GBP/GHS',
    455          buyRate: 18.8 + Math.random() * 0.5,
    456          sellRate: 19.2 + Math.random() * 0.5,
    457          bogRate: 19.0,
    458          change: (Math.random() - 0.5) * 0.3,
    
  • L458

    ts
    456          sellRate: 19.2 + Math.random() * 0.5,
    457          bogRate: 19.0,
    458          change: (Math.random() - 0.5) * 0.3,
    459          percentChange: (Math.random() - 0.5) * 2,
    460        },
    
  • L459

    ts
    457          bogRate: 19.0,
    458          change: (Math.random() - 0.5) * 0.3,
    459          percentChange: (Math.random() - 0.5) * 2,
    460        },
    461      ];
    

libs/veritas/automated-content/src/generators/sports-data-fetcher.ts#

  • L27

    ts
    25   * Throws when no provider is configured because there's no
    26   * plausible synthetic fallback for match scores, standings
    27   * positions, and top-scorer tables — the previous `Math.random()`
    28   * synthesis was removed in V1-P2-0281 (it shipped a *different*
    29   * league table on every call, which would publish contradictory
    

libs/veritas/automated-content/src/generators/sports-generator.ts#

  • L77

    ts
    75     * no provider is configured because there's no plausible synthetic
    76     * fallback for match scores, standings positions, and top-scorer
    77     * tables — the previous `Math.random()` synthesis was removed in
    78     * V1-P2-0281 (it shipped a *different* league table on every call,
    79     * which would publish contradictory news within the same hour).
    

libs/veritas/automated-content/src/generators/traffic-generator.ts#

  • L331

    ts
    329
    330        // Add randomness
    331        const severity = Math.min(5, Math.max(1, baseSeverity + Math.floor(Math.random() * 2) - 1));
    332        const condition = this.severityToCondition(severity);
    333
    
  • L334

    ts
    332        const condition = this.severityToCondition(severity);
    333
    334        const normalTravelTime = 10 + Math.floor(Math.random() * 20);
    335        const delayMinutes = Math.round(normalTravelTime * (severity - 1) * 0.3);
    336        const currentTravelTime = normalTravelTime + delayMinutes;
    
  • L357

    ts
    355
    356      // 30% chance of an incident
    357      if (Math.random() < 0.3) {
    358        const types: TrafficIncidentType[] = ['accident', 'breakdown', 'construction', 'flooding'];
    359        const type = types[Math.floor(Math.random() * types.length)];
    
  • L359

    ts
    357      if (Math.random() < 0.3) {
    358        const types: TrafficIncidentType[] = ['accident', 'breakdown', 'construction', 'flooding'];
    359        const type = types[Math.floor(Math.random() * types.length)];
    360        const route = ACCRA_ROUTES[Math.floor(Math.random() * ACCRA_ROUTES.length)];
    361
    
  • L360

    ts
    358        const types: TrafficIncidentType[] = ['accident', 'breakdown', 'construction', 'flooding'];
    359        const type = types[Math.floor(Math.random() * types.length)];
    360        const route = ACCRA_ROUTES[Math.floor(Math.random() * ACCRA_ROUTES.length)];
    361
    362        incidents.push({
    
  • L367

    ts
    365          location: route.name,
    366          description: this.generateIncidentDescription(type, route.name),
    367          severity: 3 + Math.floor(Math.random() * 2),
    368          startTime: new Date(now.getTime() - Math.random() * 2 * 60 * 60 * 1000),
    369          expectedClearTime: new Date(now.getTime() + Math.random() * 2 * 60 * 60 * 1000),
    
  • L368

    ts
    366          description: this.generateIncidentDescription(type, route.name),
    367          severity: 3 + Math.floor(Math.random() * 2),
    368          startTime: new Date(now.getTime() - Math.random() * 2 * 60 * 60 * 1000),
    369          expectedClearTime: new Date(now.getTime() + Math.random() * 2 * 60 * 60 * 1000),
    370          affectedRoutes: [route.name],
    
  • L369

    ts
    367          severity: 3 + Math.floor(Math.random() * 2),
    368          startTime: new Date(now.getTime() - Math.random() * 2 * 60 * 60 * 1000),
    369          expectedClearTime: new Date(now.getTime() + Math.random() * 2 * 60 * 60 * 1000),
    370          affectedRoutes: [route.name],
    371          alternatives: this.getAlternativeRoutes(route.id),
    

libs/veritas/automated-content/src/generators/weather-data-fetcher.ts#

  • L26

    ts
    24   *
    25   * - Throws when no provider is configured. The previous synthesis
    26   *   stack used `Math.random()` for temperatures, humidity, wind
    27   *   speed, and rain probability, so it could never produce a
    28   *   trustworthy reading; we don't fall back to it.
    

libs/veritas/automated-content/src/generators/weather-generator.ts#

  • L74

    ts
    72     * meteo.gov.gh scrapers, or third-party feeds. The generator
    73     * throws when no provider is configured because the previous
    74     * synthesis stack used `Math.random()` for temperatures,
    75     * humidity, wind speed, and rain probability — it could never
    76     * produce a trustworthy weather reading.
    

libs/veritas/automated-content/src/types.ts#

  • L239

    ts
    237     * Live weather-data adapter. The generator throws on `fetchData()`
    238     * when this is unset — there's no synthetic fallback path because
    239     * every previous "default" reading was `Math.random()` driven.
    240     */
    241    provider?: WeatherDataProvider;
    

libs/veritas/b2b-sdk/src/resources/base.ts#

  • L212

    ts
    210    const delay = Math.min(baseDelay * Math.pow(2, attempt - 1), maxDelay);
    211    // Add jitter
    212    return delay + Math.random() * 500;
    213  }
    214
    

libs/veritas/cms/src/ai-assist.ts#

  • L833

    ts
    831
    832    private generateId(prefix: string): string {
    833      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    834    }
    835
    

libs/veritas/cms/src/breaking.ts#

  • L469

    ts
    467
    468    private generateId(prefix: string): string {
    469      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    470    }
    471
    

libs/veritas/cms/src/content.ts#

  • L623

    ts
    621
    622    private generateId(prefix: string): string {
    623      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    624    }
    625
    

libs/veritas/cms/src/workflow.ts#

  • L636

    ts
    634
    635    private generateId(prefix: string): string {
    636      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    637    }
    638  }
    

libs/veritas/comments/src/comments.ts#

  • L717

    ts
    715
    716    private generateCommentId(): string {
    717      return `cmt_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    718    }
    719
    

libs/veritas/comments/src/community.ts#

  • L410

    ts
    408
    409      const report: CommentReport = {
    410        id: `report_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    411        commentId,
    412        reporterId,
    
  • L509

    ts
    507
    508      const request: ExpertVerificationRequest = {
    509        id: `expert_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    510        userId,
    511        expertiseArea,
    

libs/veritas/comments/src/dashboard.ts#

  • L468

    ts
    466
    467      const appeal: Appeal = {
    468        id: `appeal_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    469        commentId,
    470        userId,
    

libs/veritas/comments/src/moderation.ts#

  • L608

    ts
    606
    607      return {
    608        id: `queue_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    609        comment,
    610        moderationResult: result,
    

libs/veritas/community/src/citizen-journalism.ts#

  • L1071

    ts
    1069
    1070    private generateId(prefix: string): string {
    1071      return `${prefix}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    1072    }
    1073  }
    

libs/veritas/community/src/gamification.ts#

  • L924

    ts
    922     *      still sees a different sentence.
    923     *
    924     * The output is deterministic (no `Math.random`) so quiz seeds and
    925     * regression tests are stable.
    926     */
    
  • L1017

    ts
    1015      const shuffled = [...array];
    1016      for (let i = shuffled.length - 1; i > 0; i--) {
    1017        const j = Math.floor(Math.random() * (i + 1));
    1018        [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
    1019      }
    
  • L1628

    ts
    1626
    1627    private generateId(prefix: string): string {
    1628      return `${prefix}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    1629    }
    1630  }
    

libs/veritas/community/src/securedrop.ts#

  • L159

    ts
    157   */
    158  function generateCodename(): string {
    159    const adjective = ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)];
    160    const noun = NOUNS[Math.floor(Math.random() * NOUNS.length)];
    161    const number = Math.floor(Math.random() * 1000);
    
  • L160

    ts
    158  function generateCodename(): string {
    159    const adjective = ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)];
    160    const noun = NOUNS[Math.floor(Math.random() * NOUNS.length)];
    161    const number = Math.floor(Math.random() * 1000);
    162    return `${adjective}${noun}${number}`;
    
  • L161

    ts
    159    const adjective = ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)];
    160    const noun = NOUNS[Math.floor(Math.random() * NOUNS.length)];
    161    const number = Math.floor(Math.random() * 1000);
    162    return `${adjective}${noun}${number}`;
    163  }
    

libs/veritas/database/src/utils.ts#

  • L337

    ts
    335  export function generateUniqueSlug(text: string): string {
    336    const baseSlug = generateSlug(text);
    337    const suffix = Math.random().toString(36).substring(2, 8);
    338    return `${baseSlug}-${suffix}`;
    339  }
    

libs/veritas/emergency/src/alerts.ts#

  • L633

    ts
    631
    632    private generateId(prefix: string): string {
    633      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    634    }
    635
    

libs/veritas/emergency/src/distribution.ts#

  • L683

    ts
    681
    682    private generateId(prefix: string): string {
    683      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    684    }
    685
    

libs/veritas/emergency/src/election.ts#

  • L721

    ts
    719
    720    private generateId(prefix: string): string {
    721      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    722    }
    723
    
  • L795

    ts
    793
    794      // Clean up old counts periodically
    795      if (Math.random() < 0.1) {
    796        this.misinformationCounts.clear();
    797      }
    

libs/veritas/fact-checking/src/ai-assist/verdict-generator.ts#

  • L447

    ts
    445        for (const evidence of input.rankedEvidence) {
    446          const claimEvidence: ClaimEvidence = {
    447            id: `ev_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    448            url: evidence.url,
    449            quote: evidence.snippet,
    
  • L536

    ts
    534        .filter((e) => e.llmAnalysis?.stance === 'supporting')
    535        .map((e) => ({
    536          id: `ev_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    537          url: e.url,
    538          quote: e.snippet,
    
  • L547

    ts
    545        .filter((e) => e.llmAnalysis?.stance === 'contradicting')
    546        .map((e) => ({
    547          id: `ev_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    548          url: e.url,
    549          quote: e.snippet,
    

libs/veritas/ghana-nlp/src/config.ts#

  • L293

    ts
    291    if (config.jitter) {
    292      // Add random jitter of ±25%
    293      const jitterFactor = 0.75 + Math.random() * 0.5;
    294      return Math.floor(delay * jitterFactor);
    295    }
    

libs/veritas/headline-service/src/testing/ab-testing.ts#

  • L290

    ts
    288
    289    private generateTestId(): string {
    290      return `test_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    291    }
    292
    
  • L336

    ts
    334
    335    private selectEqualAllocation(variants: TestVariant[]): TestVariant {
    336      const random = Math.random();
    337      let cumulative = 0;
    338
    
  • L354

    ts
    352
    353      // Explore: random selection
    354      if (Math.random() < epsilon) {
    355        return variants[Math.floor(Math.random() * variants.length)];
    356      }
    
  • L355

    ts
    353      // Explore: random selection
    354      if (Math.random() < epsilon) {
    355        return variants[Math.floor(Math.random() * variants.length)];
    356      }
    357
    

libs/veritas/knowledge-graph/src/temporal/tracker.ts#

  • L623

    ts
    621     */
    622    private generateEventId(): string {
    623      return `event_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    624    }
    625  }
    

libs/veritas/live-stream/src/archive/breaking-news-archive.ts#

  • L905

    ts
    903
    904    private generateArchiveId(): string {
    905      return `arc_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
    906    }
    907
    
  • L909

    ts
    907
    908    private generateUpdateId(): string {
    909      return `upd_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    910    }
    911
    

libs/veritas/live-stream/src/interactive/viewer-qa.ts#

  • L1183

    ts
    1181
    1182    private generateQuestionId(): string {
    1183      return `q_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
    1184    }
    1185
    
  • L1187

    ts
    1185
    1186    private generateResponseId(): string {
    1187      return `r_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
    1188    }
    1189
    

libs/veritas/live-stream/src/scheduler/stream-scheduler.ts#

  • L519

    ts
    517      const breakingNews: BreakingNewsEvent = {
    518        ...event,
    519        id: `breaking_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    520        createdAt: new Date(),
    521      };
    

libs/veritas/live-stream/src/video/live-video-generator.ts#

  • L488

    ts
    486      }
    487
    488      return greetings[Math.floor(Math.random() * greetings.length)] ?? 'Hello and welcome.';
    489    }
    490
    
  • L500

    ts
    498
    499      const signOffs = this.currentPersona.signOffs;
    500      return signOffs[Math.floor(Math.random() * signOffs.length)]!;
    501    }
    502
    

libs/veritas/newsletter/src/email-service.ts#

  • L196

    ts
    194            return {
    195              success: true,
    196              messageId: `sandbox_${Date.now()}_${Math.random().toString(36).substring(7)}`,
    197            };
    198          }
    
  • L344

    ts
    342            return {
    343              success: true,
    344              messageId: `sandbox_${Date.now()}_${Math.random().toString(36).substring(7)}`,
    345            };
    346          }
    
  • L469

    ts
    467            return {
    468              success: true,
    469              messageId: `sandbox_${Date.now()}_${Math.random().toString(36).substring(7)}`,
    470            };
    471          }
    
  • L559

    ts
    557            return {
    558              success: true,
    559              messageId: `sandbox_${Date.now()}_${Math.random().toString(36).substring(7)}`,
    560            };
    561          }
    
  • L679

    ts
    677            return {
    678              success: true,
    679              messageId: `sandbox_${Date.now()}_${Math.random().toString(36).substring(7)}`,
    680            };
    681          }
    

libs/veritas/newsletter/src/newsletters.ts#

  • L1077

    ts
    1075        variantId: variant.id,
    1076        sentCount: 100,
    1077        opens: Math.floor(Math.random() * 50) + 20,
    1078        openRate: 0,
    1079        clicks: Math.floor(Math.random() * 20) + 5,
    
  • L1079

    ts
    1077        opens: Math.floor(Math.random() * 50) + 20,
    1078        openRate: 0,
    1079        clicks: Math.floor(Math.random() * 20) + 5,
    1080        clickRate: 0,
    1081        conversions: Math.floor(Math.random() * 10),
    
  • L1081

    ts
    1079        clicks: Math.floor(Math.random() * 20) + 5,
    1080        clickRate: 0,
    1081        conversions: Math.floor(Math.random() * 10),
    1082        conversionRate: 0,
    1083        confidence: Math.random() * 0.3 + 0.7,
    
  • L1083

    ts
    1081        conversions: Math.floor(Math.random() * 10),
    1082        conversionRate: 0,
    1083        confidence: Math.random() * 0.3 + 0.7,
    1084      }));
    1085
    

libs/veritas/notifications/src/types.ts#

  • L1310

    ts
    1308  export function generateNotificationId(prefix = 'ntf'): string {
    1309    const timestamp = Date.now().toString(36).toUpperCase();
    1310    const random = Math.random().toString(36).substring(2, 8).toUpperCase();
    1311    return `${prefix}_${timestamp}_${random}`;
    1312  }
    

libs/veritas/payments/src/types.ts#

  • L1231

    ts
    1229  export function generateTransactionReference(prefix = 'TXN'): string {
    1230    const timestamp = Date.now().toString(36).toUpperCase();
    1231    const random = Math.random().toString(36).substring(2, 8).toUpperCase();
    1232    return `${prefix}_${timestamp}_${random}`;
    1233  }
    

libs/veritas/platforms/src/enterprise.ts#

  • L279

    ts
    277
    278      return {
    279        id: `alert_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    280        clientId: this.config.clientId,
    281        type,
    
  • L747

    ts
    745      }
    746
    747      const deploymentId = `deploy_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    748
    749      this.deployments.set(deploymentId, {
    

libs/veritas/realtime-data/src/financial.ts#

  • L39

    ts
    37     * persisted rate from `storage` (or throw if nothing is cached)
    38     * — they no longer return a synthetic constant or
    39     * `Math.random()` value.
    40     */
    41    bogProvider?: BogDataProvider;
    
  • L978

    ts
    976
    977    private getMockStockQuote(symbol: string): StockQuote {
    978      const basePrice = 2 + Math.random() * 10;
    979      const change = (Math.random() - 0.5) * 0.5;
    980      return {
    
  • L979

    ts
    977    private getMockStockQuote(symbol: string): StockQuote {
    978      const basePrice = 2 + Math.random() * 10;
    979      const change = (Math.random() - 0.5) * 0.5;
    980      return {
    981        symbol,
    
  • L989

    ts
    987        high: basePrice + Math.abs(change),
    988        low: basePrice - Math.abs(change),
    989        volume: Math.floor(Math.random() * 100000),
    990        change,
    991        changePercent: (change / (basePrice - change)) * 100,
    
  • L1002

    ts
    1000        shortName: 'GSE-CI',
    1001        exchange: 'GSE',
    1002        value: 2500 + Math.random() * 100,
    1003        previousClose: 2500,
    1004        change: Math.random() * 20 - 10,
    
  • L1004

    ts
    1002        value: 2500 + Math.random() * 100,
    1003        previousClose: 2500,
    1004        change: Math.random() * 20 - 10,
    1005        changePercent: Math.random() * 2 - 1,
    1006        high52Week: 2800,
    
  • L1005

    ts
    1003        previousClose: 2500,
    1004        change: Math.random() * 20 - 10,
    1005        changePercent: Math.random() * 2 - 1,
    1006        high52Week: 2800,
    1007        low52Week: 2200,
    
  • L1043

    ts
    1041      const [base, quote] = pair.split('/');
    1042      const rate = rates[pair] ?? 10;
    1043      const change = (Math.random() - 0.5) * 0.1;
    1044
    1045      return {
    
  • L1081

    ts
    1079        category: 'precious_metals' as CommodityCategory,
    1080      };
    1081      const change = (Math.random() - 0.5) * info.price * 0.02;
    1082
    1083      return {
    
  • L1107

    ts
    1105
    1106    private generateId(prefix: string): string {
    1107      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1108    }
    1109  }
    

libs/veritas/realtime-data/src/utilities.ts#

  • L740

    ts
    738        : ['free_flow', 'light', 'moderate'];
    739
    740      const severity = severities[Math.floor(Math.random() * severities.length)];
    741
    742      return {
    
  • L767

    ts
    765
    766      const basePrice = basePrices[fuelType];
    767      const change = (Math.random() - 0.5) * 0.5;
    768
    769      return {
    
  • L807

    ts
    805
    806      for (let i = 0; i < 10; i++) {
    807        const airline = airlines[Math.floor(Math.random() * airlines.length)];
    808        const dest = destinations[Math.floor(Math.random() * destinations.length)];
    809        const flightNumber = `${airline.code}${100 + Math.floor(Math.random() * 900)}`;
    
  • L808

    ts
    806      for (let i = 0; i < 10; i++) {
    807        const airline = airlines[Math.floor(Math.random() * airlines.length)];
    808        const dest = destinations[Math.floor(Math.random() * destinations.length)];
    809        const flightNumber = `${airline.code}${100 + Math.floor(Math.random() * 900)}`;
    810
    
  • L809

    ts
    807        const airline = airlines[Math.floor(Math.random() * airlines.length)];
    808        const dest = destinations[Math.floor(Math.random() * destinations.length)];
    809        const flightNumber = `${airline.code}${100 + Math.floor(Math.random() * 900)}`;
    810
    811        const scheduled = new Date(now);
    
  • L813

    ts
    811        const scheduled = new Date(now);
    812        scheduled.setHours(scheduled.getHours() + i);
    813        scheduled.setMinutes(Math.floor(Math.random() * 60));
    814
    815        const statuses: FlightStatusType[] = [
    
  • L822

    ts
    820          'arrived',
    821        ];
    822        const status = i < 3 ? statuses[Math.floor(Math.random() * 3)] : 'scheduled';
    823
    824        flights.push({
    
  • L839

    ts
    837          scheduledArrival: new Date(scheduled.getTime() + 3 * 60 * 60 * 1000),
    838          terminal: 'Terminal 3',
    839          gate: `G${Math.floor(Math.random() * 20) + 1}`,
    840          delay: status === 'delayed' ? Math.floor(Math.random() * 60) + 15 : undefined,
    841        });
    
  • L840

    ts
    838          terminal: 'Terminal 3',
    839          gate: `G${Math.floor(Math.random() * 20) + 1}`,
    840          delay: status === 'delayed' ? Math.floor(Math.random() * 60) + 15 : undefined,
    841        });
    842      }
    
  • L927

    ts
    925
    926    private generateId(prefix: string): string {
    927      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    928    }
    929  }
    

libs/veritas/realtime-data/src/weather.ts#

  • L906

    ts
    904        },
    905        current: {
    906          temperature: baseTemp + Math.random() * 4 - 2,
    907          feelsLike: baseTemp + 2,
    908          humidity: isNorthern ? 40 + Math.random() * 20 : 60 + Math.random() * 20,
    
  • L908

    ts
    906          temperature: baseTemp + Math.random() * 4 - 2,
    907          feelsLike: baseTemp + 2,
    908          humidity: isNorthern ? 40 + Math.random() * 20 : 60 + Math.random() * 20,
    909          pressure: 1012 + Math.random() * 5,
    910          windSpeed: 3 + Math.random() * 5,
    
  • L909

    ts
    907          feelsLike: baseTemp + 2,
    908          humidity: isNorthern ? 40 + Math.random() * 20 : 60 + Math.random() * 20,
    909          pressure: 1012 + Math.random() * 5,
    910          windSpeed: 3 + Math.random() * 5,
    911          windDirection: 180 + Math.random() * 60,
    
  • L910

    ts
    908          humidity: isNorthern ? 40 + Math.random() * 20 : 60 + Math.random() * 20,
    909          pressure: 1012 + Math.random() * 5,
    910          windSpeed: 3 + Math.random() * 5,
    911          windDirection: 180 + Math.random() * 60,
    912          visibility: 10000,
    
  • L911

    ts
    909          pressure: 1012 + Math.random() * 5,
    910          windSpeed: 3 + Math.random() * 5,
    911          windDirection: 180 + Math.random() * 60,
    912          visibility: 10000,
    913          uvIndex: 8 + Math.random() * 3,
    
  • L913

    ts
    911          windDirection: 180 + Math.random() * 60,
    912          visibility: 10000,
    913          uvIndex: 8 + Math.random() * 3,
    914          cloudCover: 30 + Math.random() * 40,
    915          condition: 'partly_cloudy',
    
  • L914

    ts
    912          visibility: 10000,
    913          uvIndex: 8 + Math.random() * 3,
    914          cloudCover: 30 + Math.random() * 40,
    915          condition: 'partly_cloudy',
    916          description: 'Partly cloudy',
    
  • L918

    ts
    916          description: 'Partly cloudy',
    917          icon: '02d',
    918          precipitation: Math.random() > 0.7 ? Math.random() * 5 : 0,
    919          sunrise: new Date(new Date().setHours(6, 0, 0)),
    920          sunset: new Date(new Date().setHours(18, 0, 0)),
    
  • L936

    ts
    934        forecast.push({
    935          date,
    936          temperatureMin: 24 + Math.random() * 2,
    937          temperatureMax: 31 + Math.random() * 3,
    938          humidity: 65 + Math.random() * 15,
    
  • L937

    ts
    935          date,
    936          temperatureMin: 24 + Math.random() * 2,
    937          temperatureMax: 31 + Math.random() * 3,
    938          humidity: 65 + Math.random() * 15,
    939          windSpeed: 4 + Math.random() * 4,
    
  • L938

    ts
    936          temperatureMin: 24 + Math.random() * 2,
    937          temperatureMax: 31 + Math.random() * 3,
    938          humidity: 65 + Math.random() * 15,
    939          windSpeed: 4 + Math.random() * 4,
    940          windDirection: 180,
    
  • L939

    ts
    937          temperatureMax: 31 + Math.random() * 3,
    938          humidity: 65 + Math.random() * 15,
    939          windSpeed: 4 + Math.random() * 4,
    940          windDirection: 180,
    941          precipitation: Math.random() > 0.6 ? Math.random() * 10 : 0,
    
  • L941

    ts
    939          windSpeed: 4 + Math.random() * 4,
    940          windDirection: 180,
    941          precipitation: Math.random() > 0.6 ? Math.random() * 10 : 0,
    942          precipitationProbability: Math.random() * 50,
    943          condition: Math.random() > 0.7 ? 'moderate_rain' : 'partly_cloudy',
    
  • L942

    ts
    940          windDirection: 180,
    941          precipitation: Math.random() > 0.6 ? Math.random() * 10 : 0,
    942          precipitationProbability: Math.random() * 50,
    943          condition: Math.random() > 0.7 ? 'moderate_rain' : 'partly_cloudy',
    944          description: Math.random() > 0.7 ? 'Light rain' : 'Partly cloudy',
    
  • L943

    ts
    941          precipitation: Math.random() > 0.6 ? Math.random() * 10 : 0,
    942          precipitationProbability: Math.random() * 50,
    943          condition: Math.random() > 0.7 ? 'moderate_rain' : 'partly_cloudy',
    944          description: Math.random() > 0.7 ? 'Light rain' : 'Partly cloudy',
    945          icon: Math.random() > 0.7 ? '10d' : '02d',
    
  • L944

    ts
    942          precipitationProbability: Math.random() * 50,
    943          condition: Math.random() > 0.7 ? 'moderate_rain' : 'partly_cloudy',
    944          description: Math.random() > 0.7 ? 'Light rain' : 'Partly cloudy',
    945          icon: Math.random() > 0.7 ? '10d' : '02d',
    946          sunrise: new Date(date.setHours(6, 0, 0)),
    
  • L945

    ts
    943          condition: Math.random() > 0.7 ? 'moderate_rain' : 'partly_cloudy',
    944          description: Math.random() > 0.7 ? 'Light rain' : 'Partly cloudy',
    945          icon: Math.random() > 0.7 ? '10d' : '02d',
    946          sunrise: new Date(date.setHours(6, 0, 0)),
    947          sunset: new Date(date.setHours(18, 0, 0)),
    
  • L970

    ts
    968        forecast.push({
    969          time,
    970          temperature: baseTemp + Math.random() * 3,
    971          feelsLike: baseTemp + 2,
    972          humidity: 65 + Math.random() * 15,
    
  • L972

    ts
    970          temperature: baseTemp + Math.random() * 3,
    971          feelsLike: baseTemp + 2,
    972          humidity: 65 + Math.random() * 15,
    973          windSpeed: 4 + Math.random() * 3,
    974          windDirection: 180,
    
  • L973

    ts
    971          feelsLike: baseTemp + 2,
    972          humidity: 65 + Math.random() * 15,
    973          windSpeed: 4 + Math.random() * 3,
    974          windDirection: 180,
    975          precipitation: Math.random() > 0.8 ? Math.random() * 3 : 0,
    
  • L975

    ts
    973          windSpeed: 4 + Math.random() * 3,
    974          windDirection: 180,
    975          precipitation: Math.random() > 0.8 ? Math.random() * 3 : 0,
    976          precipitationProbability: Math.random() * 40,
    977          condition: 'partly_cloudy',
    
  • L976

    ts
    974          windDirection: 180,
    975          precipitation: Math.random() > 0.8 ? Math.random() * 3 : 0,
    976          precipitationProbability: Math.random() * 40,
    977          condition: 'partly_cloudy',
    978          description: 'Partly cloudy',
    
  • L988

    ts
    986    private getMockAlerts(): WeatherAlert[] {
    987      // Return empty most of the time, occasional alerts
    988      if (Math.random() > 0.2) return [];
    989
    990      return [
    
  • L1029

    ts
    1027
    1028    private generateId(prefix: string): string {
    1029      return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    1030    }
    1031  }
    

libs/veritas/recommendations/src/realtime.ts#

  • L318

    ts
    316  function generateSessionId(): string {
    317    const timestamp = Date.now().toString(36);
    318    const random = Math.random().toString(36).substring(2, 10);
    319    return `ses_${timestamp}${random}`;
    320  }
    

libs/veritas/regional/src/anchors.ts#

  • L156

    ts
    154      // Select a name
    155      const nameList = gender === 'male' ? names.male : names.female;
    156      const name = options.name || nameList[Math.floor(Math.random() * nameList.length)];
    157
    158      const anchor: RegionalAnchorPersona = {
    
  • L164

    ts
    162        displayName: options.displayName || name,
    163        gender,
    164        age: options.age || 28 + Math.floor(Math.random() * 15),
    165        primaryLanguage: options.primaryLanguage || regionData.primaryLanguages[0] || 'English',
    166        secondaryLanguages:
    

libs/veritas/research-assistant/src/briefing-generator.ts#

  • L199

    ts
    197        return `briefing-${crypto.randomUUID()}`;
    198      } catch {
    199        return `briefing-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
    200      }
    201    }
    

libs/veritas/seo/src/web-stories.ts#

  • L561

    ts
    559    ): WebStoryPage {
    560      const page: WebStoryPage = {
    561        id: `page_${Date.now()}_${Math.random().toString(36).substring(7)}`,
    562        background: { ...template.background },
    563        layers: template.layers.map((layer) => ({ ...layer })),
    

libs/veritas/seo/src/web-vitals.ts#

  • L219

    ts
    217    ): Promise<void> {
    218      // Apply sample rate
    219      if (Math.random() > this.config.sampleRate) {
    220        return;
    221      }
    
  • L263

    ts
    261
    262    // Check if we should sample this pageview
    263    if (Math.random() > sampleRate) return;
    264
    265    // Report function
    
  • L554

    ts
    552      const fullAlert: PerformanceAlert = {
    553        ...alert,
    554        id: `alert_${Date.now()}_${Math.random().toString(36).substring(7)}`,
    555        createdAt: new Date(),
    556      };
    

libs/veritas/signup/src/enterprise-sales.ts#

  • L283

    ts
    281                start: slotStart,
    282                end: slotEnd,
    283                available: Math.random() > 0.3, // 70% availability
    284              });
    285            }
    

libs/veritas/social-automation/src/adapters/base.ts#

  • L141

    ts
    139     */
    140    protected generateRequestId(): string {
    141      return `${this.platform}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    142    }
    143  }
    

libs/veritas/story-clustering/src/quality/assessment.ts#

  • L65

    ts
    63      // Random sample
    64      sampleArticles = [...articles]
    65        .sort(() => Math.random() - 0.5)
    66        .slice(0, config.coherence.maxSampleSize);
    67    }
    

libs/veritas/video-production/src/advanced/live-event.ts#

  • L758

    ts
    756          eventId,
    757          timestamp: new Date(),
    758          viewerCount: Math.floor(Math.random() * 10000) + 1000,
    759          peakViewers: Math.floor(Math.random() * 15000) + 2000,
    760          engagementRate: Math.random() * 0.3 + 0.1,
    
  • L759

    ts
    757          timestamp: new Date(),
    758          viewerCount: Math.floor(Math.random() * 10000) + 1000,
    759          peakViewers: Math.floor(Math.random() * 15000) + 2000,
    760          engagementRate: Math.random() * 0.3 + 0.1,
    761          avgWatchTimeSeconds: Math.floor(Math.random() * 300) + 60,
    
  • L760

    ts
    758          viewerCount: Math.floor(Math.random() * 10000) + 1000,
    759          peakViewers: Math.floor(Math.random() * 15000) + 2000,
    760          engagementRate: Math.random() * 0.3 + 0.1,
    761          avgWatchTimeSeconds: Math.floor(Math.random() * 300) + 60,
    762          chatMessagesPerMinute: Math.floor(Math.random() * 100) + 10,
    
  • L761

    ts
    759          peakViewers: Math.floor(Math.random() * 15000) + 2000,
    760          engagementRate: Math.random() * 0.3 + 0.1,
    761          avgWatchTimeSeconds: Math.floor(Math.random() * 300) + 60,
    762          chatMessagesPerMinute: Math.floor(Math.random() * 100) + 10,
    763          socialMentions: Math.floor(Math.random() * 500) + 50,
    
  • L762

    ts
    760          engagementRate: Math.random() * 0.3 + 0.1,
    761          avgWatchTimeSeconds: Math.floor(Math.random() * 300) + 60,
    762          chatMessagesPerMinute: Math.floor(Math.random() * 100) + 10,
    763          socialMentions: Math.floor(Math.random() * 500) + 50,
    764          sentimentDistribution: {
    
  • L763

    ts
    761          avgWatchTimeSeconds: Math.floor(Math.random() * 300) + 60,
    762          chatMessagesPerMinute: Math.floor(Math.random() * 100) + 10,
    763          socialMentions: Math.floor(Math.random() * 500) + 50,
    764          sentimentDistribution: {
    765            positive: Math.random() * 0.5 + 0.2,
    
  • L765

    ts
    763          socialMentions: Math.floor(Math.random() * 500) + 50,
    764          sentimentDistribution: {
    765            positive: Math.random() * 0.5 + 0.2,
    766            neutral: Math.random() * 0.3 + 0.2,
    767            negative: Math.random() * 0.2 + 0.1,
    
  • L766

    ts
    764          sentimentDistribution: {
    765            positive: Math.random() * 0.5 + 0.2,
    766            neutral: Math.random() * 0.3 + 0.2,
    767            negative: Math.random() * 0.2 + 0.1,
    768          },
    
  • L767

    ts
    765            positive: Math.random() * 0.5 + 0.2,
    766            neutral: Math.random() * 0.3 + 0.2,
    767            negative: Math.random() * 0.2 + 0.1,
    768          },
    769          topTopics: event.topics.map((topic) => ({
    
  • L771

    ts
    769          topTopics: event.topics.map((topic) => ({
    770            topic,
    771            count: Math.floor(Math.random() * 100) + 10,
    772          })),
    773        };
    

libs/veritas/video-production/src/avatars/ewe-anchors.ts#

  • L442

    ts
    440  export function getEweGreeting(time: keyof typeof EWE_GREETINGS): string {
    441    const greetings = EWE_GREETINGS[time];
    442    return greetings[Math.floor(Math.random() * greetings.length)]!;
    443  }
    444
    
  • L450

    ts
    448  export function getEweSignOff(context: keyof typeof EWE_SIGN_OFFS): string {
    449    const signOffs = EWE_SIGN_OFFS[context];
    450    return signOffs[Math.floor(Math.random() * signOffs.length)]!;
    451  }
    452
    
  • L543

    ts
    541    // Get time-specific intro if available, otherwise use general intro
    542    const intros = branding.introByTime?.[time] ?? branding.intro;
    543    const template = intros[Math.floor(Math.random() * intros.length)]!;
    544
    545    // Replace anchor name placeholder
    
  • L562

    ts
    560    // Get context-specific outro if available, otherwise use general outro
    561    const outros = branding.outroByContext?.[context] ?? branding.outro;
    562    const template = outros[Math.floor(Math.random() * outros.length)]!;
    563
    564    // Replace anchor name placeholder if present
    

libs/veritas/video-production/src/avatars/ga-anchors.ts#

  • L440

    ts
    438  export function getGaGreeting(time: keyof typeof GA_GREETINGS): string {
    439    const greetings = GA_GREETINGS[time];
    440    return greetings[Math.floor(Math.random() * greetings.length)]!;
    441  }
    442
    
  • L448

    ts
    446  export function getGaSignOff(context: keyof typeof GA_SIGN_OFFS): string {
    447    const signOffs = GA_SIGN_OFFS[context];
    448    return signOffs[Math.floor(Math.random() * signOffs.length)]!;
    449  }
    450
    
  • L541

    ts
    539    // Get time-specific intro if available, otherwise use general intro
    540    const intros = branding.introByTime?.[time] ?? branding.intro;
    541    const template = intros[Math.floor(Math.random() * intros.length)]!;
    542
    543    // Replace anchor name placeholder
    
  • L560

    ts
    558    // Get context-specific outro if available, otherwise use general outro
    559    const outros = branding.outroByContext?.[context] ?? branding.outro;
    560    const template = outros[Math.floor(Math.random() * outros.length)]!;
    561
    562    // Replace anchor name placeholder if present
    

libs/veritas/video-production/src/avatars/presets.ts#

  • L337

    ts
    335    }
    336
    337    const template = intros[Math.floor(Math.random() * intros.length)];
    338    const name = anchorName ?? 'Anchor';
    339    return renderIntroTemplate(template, name);
    
  • L354

    ts
    352    }
    353
    354    return outros[Math.floor(Math.random() * outros.length)];
    355  }
    

libs/veritas/video-production/src/avatars/sync.ts#

  • L286

    ts
    284
    285    if (featured.length > 0) {
    286      return featured[Math.floor(Math.random() * featured.length)];
    287    }
    288
    
  • L290

    ts
    288
    289    // Return random from remaining candidates
    290    return candidates[Math.floor(Math.random() * candidates.length)];
    291  }
    292
    

libs/veritas/video-production/src/avatars/twi-anchors.ts#

  • L509

    ts
    507    const timeIntros = branding.introByTime?.[time];
    508    if (timeIntros && timeIntros.length > 0) {
    509      return timeIntros[Math.floor(Math.random() * timeIntros.length)];
    510    }
    511
    
  • L512

    ts
    510    }
    511
    512    return branding.intro[Math.floor(Math.random() * branding.intro.length)];
    513  }
    514
    
  • L527

    ts
    525    const contextOutros = branding.outroByContext?.[context];
    526    if (contextOutros && contextOutros.length > 0) {
    527      return contextOutros[Math.floor(Math.random() * contextOutros.length)];
    528    }
    529
    
  • L530

    ts
    528    }
    529
    530    return branding.outro[Math.floor(Math.random() * branding.outro.length)];
    531  }
    532
    
  • L542

    ts
    540    const breakingIntros = branding.breakingNewsIntro;
    541    if (breakingIntros && breakingIntros.length > 0) {
    542      return breakingIntros[Math.floor(Math.random() * breakingIntros.length)];
    543    }
    544
    

libs/veritas/video-production/src/sync/voice-avatar-sync.ts#

  • L476

    ts
    474     */
    475    function generateId(): string {
    476      return `vas_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    477    }
    478
    

libs/yemaya/agents/src/constraints/index.ts#

  • L1710

    ts
    1708
    1709        for (const [varName, range] of Object.entries(variableRanges)) {
    1710          variables[varName] = range.min + Math.random() * (range.max - range.min);
    1711        }
    1712
    
  • L1956

    ts
    1954        let child2 = { ...parent2 };
    1955
    1956        if (Math.random() < this.config.crossoverRate) {
    1957          [child1, child2] = this.crossover(parent1, parent2);
    1958        }
    
  • L1961

    ts
    1959
    1960        // Mutation
    1961        if (Math.random() < this.config.mutationRate) {
    1962          child1 = this.mutate(child1, variableRanges);
    1963        }
    
  • L1964

    ts
    1962          child1 = this.mutate(child1, variableRanges);
    1963        }
    1964        if (Math.random() < this.config.mutationRate) {
    1965          child2 = this.mutate(child2, variableRanges);
    1966        }
    
  • L1976

    ts
    1974    private tournamentSelect(population: SolutionPoint[]): SolutionPoint {
    1975      const tournamentSize = 3;
    1976      let best = population[Math.floor(Math.random() * population.length)]!;
    1977
    1978      for (let i = 1; i < tournamentSize; i++) {
    
  • L1979

    ts
    1977
    1978      for (let i = 1; i < tournamentSize; i++) {
    1979        const competitor = population[Math.floor(Math.random() * population.length)]!;
    1980        if (this.dominates(competitor, best)) {
    1981          best = competitor;
    
  • L1996

    ts
    1994
    1995      for (const varName of Object.keys(parent1.variables)) {
    1996        const alpha = Math.random();
    1997        child1Variables[varName] =
    1998          alpha * (parent1.variables[varName] ?? 0) + (1 - alpha) * (parent2.variables[varName] ?? 0);
    
  • L2034

    ts
    2032
    2033      const varName = Object.keys(mutated.variables)[
    2034        Math.floor(Math.random() * Object.keys(mutated.variables).length)
    2035      ]!;
    2036      const range = variableRanges[varName];
    
  • L2041

    ts
    2039        // Gaussian mutation
    2040        const sigma = (range.max - range.min) * 0.1;
    2041        const mutation = (Math.random() - 0.5) * 2 * sigma;
    2042        mutated.variables[varName] = Math.max(
    2043          range.min,
    

libs/yemaya/agents/src/hitl/index.ts#

  • L1887

    ts
    1885
    1886      if (availableReviewers.length > 0) {
    1887        const randomIndex = Math.floor(Math.random() * availableReviewers.length);
    1888        const selectedReviewer = availableReviewers[randomIndex];
    1889        if (selectedReviewer) {
    

libs/yemaya/agents/src/npc-ai/advanced-npc-ai.ts#

  • L1577

    ts
    1575        case 'engaging':
    1576          // Consider flanking if tactical
    1577          if (profile.tacticalAwareness > 0.7 && Math.random() < profile.tacticalAwareness * 0.3) {
    1578            this.setCombatState(npcId, 'flanking');
    1579            return this.createFlankAction(npcId, primaryTarget, npcPosition, profile);
    
  • L2198

    ts
    2196      // Check if spread happens based on rate and interest
    2197      const spreadChance = this.config.gossipSpreadRate * gossip.interestLevel;
    2198      if (Math.random() > spreadChance) return false;
    2199
    2200      // Check relationship between spreader and receiver
    
  • L2827

    ts
    2825    simulateSupplyDemand(itemId: string, baseSupply: number, baseDemand: number): void {
    2826      // Add some randomness
    2827      const supplyVariation = 1 + (Math.random() - 0.5) * 0.2;
    2828      const demandVariation = 1 + (Math.random() - 0.5) * 0.2;
    2829
    
  • L2828

    ts
    2826      // Add some randomness
    2827      const supplyVariation = 1 + (Math.random() - 0.5) * 0.2;
    2828      const demandVariation = 1 + (Math.random() - 0.5) * 0.2;
    2829
    2830      const supply = Math.max(0, baseSupply * supplyVariation);
    

libs/yemaya/agents/src/optimization/performance-optimizer.ts#

  • L1763

    ts
    1761
    1762    private selectRandom(examples: FewShotExample[]): FewShotExample[] {
    1763      const shuffled = [...examples].sort(() => Math.random() - 0.5);
    1764      return shuffled.slice(0, this.config.maxExamples);
    1765    }
    

libs/yemaya/agents/src/optimization/schedule-optimizer.ts#

  • L744

    ts
    742          if (!parent1 || !parent2) continue;
    743
    744          if (Math.random() < crossoverRate) {
    745            const [child1, child2] = this.crossover(parent1, parent2, input);
    746            offspring.push(child1, child2);
    
  • L754

    ts
    752        // Mutation
    753        for (const individual of offspring) {
    754          if (Math.random() < mutationRate) {
    755            this.mutate(individual, input);
    756          }
    
  • L873

    ts
    871        // Accept or reject
    872        const deltaEnergy = neighborEnergy - currentEnergy;
    873        if (deltaEnergy < 0 || Math.random() < Math.exp(-deltaEnergy / temperature)) {
    874          currentSolution = neighbor;
    875          currentEnergy = neighborEnergy;
    
  • L1956

    ts
    1954        for (const item of variation) {
    1955          if (input.constraints.lockedItems.has(item.id)) continue;
    1956          if (Math.random() < 0.3) {
    1957            // Random time shift
    1958            const shiftHours = (Math.random() - 0.5) * 48;
    
  • L1958

    ts
    1956          if (Math.random() < 0.3) {
    1957            // Random time shift
    1958            const shiftHours = (Math.random() - 0.5) * 48;
    1959            const shiftMs = shiftHours * 60 * 60 * 1000;
    1960            item.scheduledStart = new Date(item.scheduledStart.getTime() + shiftMs);
    
  • L2055

    ts
    2053
    2054      for (let i = 0; i < tournamentSize; i++) {
    2055        const idx = Math.floor(Math.random() * evaluated.length);
    2056        const candidate = evaluated[idx];
    2057        if (candidate && candidate.fitness > best.fitness) {
    
  • L2078

    ts
    2076
    2077      // Single-point crossover on schedule times
    2078      const crossoverPoint = Math.floor(Math.random() * parent1.length);
    2079
    2080      for (let i = crossoverPoint; i < parent1.length; i++) {
    
  • L2107

    ts
    2105      if (schedule.length === 0) return;
    2106
    2107      const idx = Math.floor(Math.random() * schedule.length);
    2108      const item = schedule[idx];
    2109
    
  • L2112

    ts
    2110      if (!item || input.constraints.lockedItems.has(item.id)) return;
    2111
    2112      const mutationType = Math.random();
    2113
    2114      if (mutationType < 0.5) {
    
  • L2116

    ts
    2114      if (mutationType < 0.5) {
    2115        // Time shift mutation
    2116        const shiftHours = (Math.random() - 0.5) * 24;
    2117        const shiftMs = shiftHours * 60 * 60 * 1000;
    2118        item.scheduledStart = new Date(item.scheduledStart.getTime() + shiftMs);
    
  • L2127

    ts
    2125        if (availableResources.length > 0 && item.assignedResourceIds.length > 0) {
    2126          const newResource =
    2127            availableResources[Math.floor(Math.random() * availableResources.length)];
    2128          if (newResource) {
    2129            item.assignedResourceIds[0] = newResource.id;
    
  • L2145

    ts
    2143      if (movableItems.length === 0) return neighbor;
    2144
    2145      const selectedItem = movableItems[Math.floor(Math.random() * movableItems.length)];
    2146      if (!selectedItem) return neighbor;
    2147
    
  • L2152

    ts
    2150
    2151      // Apply random perturbation
    2152      const shiftHours = (Math.random() - 0.5) * 12;
    2153      const shiftMs = shiftHours * 60 * 60 * 1000;
    2154      neighborItem.scheduledStart = new Date(neighborItem.scheduledStart.getTime() + shiftMs);
    

libs/yemaya/agents/src/orchestration/cascading-failure-prevention.ts#

  • L853

    ts
    851          this.stats.loadSheddingEvents++;
    852          this.emit('loadShedding', target.id, this.config.loadSheddingConfig.shedRate);
    853          return Math.random() > this.config.loadSheddingConfig.shedRate;
    854        }
    855      }
    

libs/yemaya/agents/src/orchestration/competitive-differentiation-advisor.ts#

  • L2525

    ts
    2523
    2524      const options = taglines[strategy];
    2525      return options[Math.floor(Math.random() * options.length)];
    2526    }
    2527
    

libs/yemaya/agents/src/orchestration/consensus-decision.ts#

  • L1506

    ts
    1504          const tied = this.findTiedOptions(results);
    1505          if (tied.length > 0) {
    1506            const winner = tied[Math.floor(Math.random() * tied.length)];
    1507            results.winner = winner;
    1508            return true;
    

libs/yemaya/agents/src/orchestration/critical-path-analyzer.ts#

  • L1305

    ts
    1303
    1304      // Sample from triangular distribution
    1305      const u = Math.random();
    1306      const fc = (mode - min) / (max - min);
    1307
    

libs/yemaya/agents/src/orchestration/decision-conflict.ts#

  • L1332

    ts
    1330    private executeRandomTiebreak(conflict: CreativeConflict): ProposedResolution {
    1331      const options = conflict.conflictingOptions;
    1332      const selectedOption = options[Math.floor(Math.random() * options.length)];
    1333
    1334      const resolution = this.createResolution(conflict, {
    

libs/yemaya/agents/src/orchestration/decision-impact.ts#

  • L1635

    ts
    1633          break;
    1634        case 'uniform':
    1635          value = lower + Math.random() * (upper - lower);
    1636          break;
    1637        default:
    
  • L1638

    ts
    1636          break;
    1637        default:
    1638          value = lower + Math.random() * (upper - lower);
    1639      }
    1640
    
  • L1652

    ts
    1650     */
    1651    private sampleNormal(mean: number, stdDev: number): number {
    1652      const u1 = Math.random();
    1653      const u2 = Math.random();
    1654      const z = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    
  • L1653

    ts
    1651    private sampleNormal(mean: number, stdDev: number): number {
    1652      const u1 = Math.random();
    1653      const u2 = Math.random();
    1654      const z = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
    1655      return mean + z * stdDev;
    

libs/yemaya/agents/src/orchestration/delegation.ts#

  • L349

    ts
    347
    348        case 'random':
    349          return candidates[Math.floor(Math.random() * candidates.length)] ?? null;
    350
    351        case 'round-robin':
    

libs/yemaya/agents/src/orchestration/resource-contention-resolver.ts#

  • L907

    ts
    905
    906      // Random selection
    907      let winner = Math.floor(Math.random() * totalTickets);
    908      let selectedEntry: FairQueueEntry | undefined;
    909      let selectedIndex = 0;
    

libs/yemaya/agents/src/orchestration/retry-strategy-selector.ts#

  • L569

    ts
    567      case 'full':
    568        // Random between 0 and baseDelay
    569        return Math.random() * baseDelay;
    570      case 'equal':
    571        // Half fixed, half random
    
  • L572

    ts
    570      case 'equal':
    571        // Half fixed, half random
    572        return baseDelay / 2 + (Math.random() * baseDelay) / 2;
    573      case 'decorrelated':
    574        // AWS-style decorrelated jitter
    
  • L577

    ts
    575        return Math.min(
    576          baseDelay,
    577          Math.random() * baseDelay * 3 * jitterFactor + baseDelay * (1 - jitterFactor)
    578        );
    579      default:
    
  • L642

    ts
    640    if (strategy.jitterFactor > 0 && !strategy.algorithm.includes('jitter')) {
    641      const jitterRange = baseDelay * strategy.jitterFactor;
    642      baseDelay = baseDelay - jitterRange / 2 + Math.random() * jitterRange;
    643    }
    644
    

libs/yemaya/agents/src/orchestration/role-assignment.ts#

  • L1109

    ts
    1107          if (qualityScore >= 80 && agentSkill.usageCount >= 5 && this.canLevelUp(agentSkill.level)) {
    1108            const newLevel = this.getNextLevel(agentSkill.level);
    1109            if (newLevel && Math.random() < agent.learningRate) {
    1110              agentSkill.level = newLevel;
    1111              this.emit('skill:improved', {
    

libs/yemaya/agents/src/orchestration/workflow-recovery.ts#

  • L304

    ts
    302          );
    303
    304          const jitter = baseDelay * this.config.jitterFactor * (Math.random() * 2 - 1);
    305          const delay = Math.max(0, baseDelay + jitter);
    306
    

libs/yemaya/agents/src/pipelines/game-pipeline.ts#

  • L7828

    ts
    7826      const exponentialDelay = initialDelayMs * Math.pow(backoffMultiplier, attempt - 1);
    7827      const boundedDelay = Math.min(exponentialDelay, maxDelayMs);
    7828      const jitter = boundedDelay * jitterFactor * (Math.random() * 2 - 1);
    7829      return Math.max(0, Math.round(boundedDelay + jitter));
    7830    }
    
  • L10062

    ts
    10060      let uid = '';
    10061      for (let i = 0; i < 12; i++) {
    10062        uid += chars.charAt(Math.floor(Math.random() * chars.length));
    10063      }
    10064      return uid;
    
  • L14587

    ts
    14585      const { initialDelayMs, maxDelayMs, backoffMultiplier } = this.config.retryConfig;
    14586      const delay = Math.min(initialDelayMs * Math.pow(backoffMultiplier, attempt), maxDelayMs);
    14587      const jitter = delay * 0.1 * Math.random();
    14588      return Math.floor(delay + jitter);
    14589    }
    

libs/yemaya/agents/src/planning/goal-priority-ranker.ts#

  • L1419

    ts
    1417          case 'random':
    1418            for (let i = group.length - 1; i > 0; i--) {
    1419              const j = Math.floor(Math.random() * (i + 1));
    1420              const temp = group[i];
    1421              const swapTarget = group[j];
    

libs/yemaya/agents/src/planning/progress-estimator.ts#

  • L512

    ts
    510  function random(seed?: number): () => number {
    511    if (seed === undefined) {
    512      return Math.random;
    513    }
    514    // Simple seeded random (Mulberry32)
    

libs/yemaya/agents/src/procedural-animation/procedural-animation.ts#

  • L2460

    ts
    2458      const emotionMod = this.config.blinkFrequency.emotionModifier.get(this.currentEmotion) ?? 1.0;
    2459
    2460      return (base + (Math.random() * 2 - 1) * variance) * emotionMod * 1000;
    2461    }
    2462
    
  • L2690

    ts
    2688      if (this.microExpressions.length === 0) return;
    2689      if (this.activeMicroExpression) return;
    2690      if (Math.random() > this.config.microExpressionChance) return;
    2691
    2692      const randomIndex = Math.floor(Math.random() * this.microExpressions.length);
    
  • L2692

    ts
    2690      if (Math.random() > this.config.microExpressionChance) return;
    2691
    2692      const randomIndex = Math.floor(Math.random() * this.microExpressions.length);
    2693      const expression = this.microExpressions[randomIndex];
    2694      if (expression) {
    
  • L2871

    ts
    2869        this.blinkState.isBlinking = true;
    2870        this.blinkState.blinkProgress = 0;
    2871        this.blinkState.blinkDuration = 0.1 + Math.random() * 0.1; // 100-200ms
    2872      }
    2873    }
    

libs/yemaya/agents/src/quality-assurance/visual-anomaly-detector.ts#

  • L1341

    ts
    1339
    1340      return available.length > 0
    1341        ? available[Math.floor(Math.random() * available.length)]
    1342        : enabledMethods[Math.floor(Math.random() * enabledMethods.length)];
    1343    }
    
  • L1342

    ts
    1340      return available.length > 0
    1341        ? available[Math.floor(Math.random() * available.length)]
    1342        : enabledMethods[Math.floor(Math.random() * enabledMethods.length)];
    1343    }
    1344
    

libs/yemaya/agents/src/registry/index.ts#

  • L212

    ts
    210
    211        case 'random':
    212          return candidates[Math.floor(Math.random() * candidates.length)];
    213
    214        case 'least-busy':
    

libs/yemaya/agents/src/self-improvement/self-improvement.ts#

  • L1888

    ts
    1886
    1887      // Random selection based on allocation percentages
    1888      const rand = Math.random() * 100;
    1889      let cumulative = 0;
    1890
    

libs/yemaya/agents/src/testing/ai-player-algorithms.ts#

  • L1494

    ts
    1492        if (bb.playerPosition) {
    1493          // Pick random nearby position
    1494          const angle = Math.random() * Math.PI * 2;
    1495          const distance = 50 + Math.random() * 100;
    1496          bb.targetPosition = {
    
  • L1495

    ts
    1493          // Pick random nearby position
    1494          const angle = Math.random() * Math.PI * 2;
    1495          const distance = 50 + Math.random() * 100;
    1496          bb.targetPosition = {
    1497            x: bb.playerPosition.x + Math.cos(angle) * distance,
    

libs/yemaya/agents/src/testing/index.d.ts#

  • L893

    ts
    891    /** Real performance statistics */
    892    performance?: ExecPerformanceStats;
    893    /** Real detected issues (replaces synthetic Math.random() issues) */
    894    realIssues: ExecRealIssue[];
    895    /** Crash dumps if any occurred */
    
  • L929

    ts
    927   * - CrashDumpCollector for crash dump capture
    928   * - LogAnalyzer for log parsing
    929   * - IssueDetector for real issue detection (replaces Math.random())
    930   */
    931  export declare class EnhancedTestSessionManager extends TypedEventEmitter<EnhancedTestSessionEvents> {
    

libs/yemaya/agents/src/testing/index.ts#

  • L1885

    ts
    1883      // Move in a random direction with bias toward unexplored areas
    1884      const moveKeys = ['w', 'a', 's', 'd'];
    1885      const randomKey = moveKeys[Math.floor(Math.random() * moveKeys.length)]!;
    1886
    1887      // Occasionally look around
    
  • L1888

    ts
    1886
    1887      // Occasionally look around
    1888      if (Math.random() < 0.1) {
    1889        return {
    1890          type: 'mouse',
    
  • L1892

    ts
    1890          type: 'mouse',
    1891          action: 'move',
    1892          x: Math.floor(Math.random() * 800),
    1893          y: Math.floor(Math.random() * 600),
    1894        };
    
  • L1893

    ts
    1891          action: 'move',
    1892          x: Math.floor(Math.random() * 800),
    1893          y: Math.floor(Math.random() * 600),
    1894        };
    1895      }
    
  • L1901

    ts
    1899        key: randomKey,
    1900        action: 'press',
    1901        duration: 200 + Math.floor(Math.random() * 300),
    1902      };
    1903    }
    
  • L1930

    ts
    1928
    1929      // Occasionally interact with objects
    1930      if (Math.random() < 0.2) {
    1931        return {
    1932          type: 'keyboard',
    
  • L1940

    ts
    1938      // Check corners and edges
    1939      const exploreMoves = ['w', 'a', 's', 'd', 'wa', 'wd', 'sa', 'sd'];
    1940      const move = exploreMoves[Math.floor(Math.random() * exploreMoves.length)]!;
    1941
    1942      if (move.length === 2) {
    
  • L1972

    ts
    1970      ];
    1971
    1972      return combatActions[Math.floor(Math.random() * combatActions.length)]!;
    1973    }
    1974
    
  • L1986

    ts
    1984
    1985      // Look around first
    1986      if (Math.random() < 0.3) {
    1987        return {
    1988          type: 'mouse',
    
  • L1990

    ts
    1988          type: 'mouse',
    1989          action: 'move',
    1990          x: Math.floor(Math.random() * 800),
    1991          y: Math.floor(Math.random() * 600),
    1992        };
    
  • L1991

    ts
    1989          action: 'move',
    1990          x: Math.floor(Math.random() * 800),
    1991          y: Math.floor(Math.random() * 600),
    1992        };
    1993      }
    
  • L1995

    ts
    1993      }
    1994
    1995      return puzzleActions[Math.floor(Math.random() * puzzleActions.length)]!;
    1996    }
    1997
    
  • L2010

    ts
    2008      ];
    2009
    2010      return dialogueActions[Math.floor(Math.random() * dialogueActions.length)]!;
    2011    }
    2012
    
  • L2034

    ts
    2032      ];
    2033
    2034      return stressActions[Math.floor(Math.random() * stressActions.length)]!;
    2035    }
    2036
    
  • L2048

    ts
    2046    private generateRandomAction(): GameInput {
    2047      const actionTypes: InputType[] = ['keyboard', 'mouse'];
    2048      const actionType = actionTypes[Math.floor(Math.random() * actionTypes.length)]!;
    2049
    2050      if (actionType === 'mouse') {
    
  • L2053

    ts
    2051        return {
    2052          type: 'mouse',
    2053          action: Math.random() < 0.7 ? 'click' : 'move',
    2054          button: 'left',
    2055          x: Math.floor(Math.random() * 800),
    
  • L2055

    ts
    2053          action: Math.random() < 0.7 ? 'click' : 'move',
    2054          button: 'left',
    2055          x: Math.floor(Math.random() * 800),
    2056          y: Math.floor(Math.random() * 600),
    2057        };
    
  • L2056

    ts
    2054          button: 'left',
    2055          x: Math.floor(Math.random() * 800),
    2056          y: Math.floor(Math.random() * 600),
    2057        };
    2058      }
    
  • L2063

    ts
    2061      return {
    2062        type: 'keyboard',
    2063        key: keys[Math.floor(Math.random() * keys.length)]!,
    2064        action: 'press',
    2065      };
    
  • L2073

    ts
    2071        { type: 'keyboard', key: 'space', action: 'press' }, // Jump
    2072        { type: 'keyboard', key: 's', action: 'hold', duration: 500 }, // Back up
    2073        { type: 'mouse', action: 'move', x: Math.floor(Math.random() * 400) + 200, y: 300 }, // Look around
    2074      ];
    2075
    
  • L2076

    ts
    2074      ];
    2075
    2076      return escapeActions[Math.floor(Math.random() * escapeActions.length)]!;
    2077    }
    2078
    
  • L2529

    ts
    2527    /** Real performance statistics */
    2528    performance?: ExecPerformanceStats;
    2529    /** Real detected issues (replaces synthetic Math.random() issues) */
    2530    realIssues: ExecRealIssue[];
    2531    /** Crash dumps if any occurred */
    
  • L2558

    ts
    2556   * - CrashDumpCollector for crash dump capture
    2557   * - LogAnalyzer for log parsing
    2558   * - IssueDetector for real issue detection (replaces Math.random())
    2559   */
    2560  export class EnhancedTestSessionManager extends TypedEventEmitter<EnhancedTestSessionEvents> {
    
  • L2675

    ts
    2673      }
    2674
    2675      // Initialize issue detector with real detection (not Math.random())
    2676      this.issueDetector = createExecIssueDetector({
    2677        logAnalyzer: this.logAnalyzer || undefined,
    
  • L2968

    ts
    2966      }
    2967
    2968      // Get real issues (replaces Math.random() synthetic issues)
    2969      const realIssues = this.issueDetector?.getIssues() || [];
    2970      const hasCriticalIssues = realIssues.some((i) => i.severity === 'critical');
    
  • L5809

    ts
    5807          { type: 'keyboard', key: 's', action: 'hold', duration: 500 },
    5808        ];
    5809        return escapeActions[Math.floor(Math.random() * escapeActions.length)]!;
    5810      }
    5811
    
  • L5814

    ts
    5812      // Move in a random direction
    5813      const moveKeys = ['w', 'a', 's', 'd'];
    5814      const randomKey = moveKeys[Math.floor(Math.random() * moveKeys.length)]!;
    5815
    5816      // Occasionally look around
    
  • L5817

    ts
    5815
    5816      // Occasionally look around
    5817      if (Math.random() < 0.1) {
    5818        return {
    5819          type: 'mouse',
    
  • L5821

    ts
    5819          type: 'mouse',
    5820          action: 'move',
    5821          x: Math.floor(Math.random() * 800),
    5822          y: Math.floor(Math.random() * 600),
    5823        };
    
  • L5822

    ts
    5820          action: 'move',
    5821          x: Math.floor(Math.random() * 800),
    5822          y: Math.floor(Math.random() * 600),
    5823        };
    5824      }
    
  • L5830

    ts
    5828        key: randomKey,
    5829        action: 'press',
    5830        duration: 200 + Math.floor(Math.random() * 300),
    5831      };
    5832    }
    

libs/yemaya/agents/src/testing/test-execution-infrastructure.d.ts#

  • L9

    ts
    7   * - Crash dump collection and analysis
    8   * - Log parsing and issue detection
    9   * - Real issue detection (replaces synthetic Math.random() issues)
    10   */
    11  import { TypedEventEmitter } from '../utils/index.js';
    
  • L626

    ts
    624  }
    625  /**
    626   * Detects real issues from game testing (replaces Math.random() fake issues)
    627   * Aggregates data from logs, performance, crashes, and gameplay
    628   */
    
  • L774

    ts
    772  /**
    773   * Integrated test executor that combines all infrastructure components
    774   * This replaces the synthetic Math.random()-based testing with real test execution
    775   */
    776  export declare class TestExecutor extends TypedEventEmitter<TestExecutorEvents> {
    

libs/yemaya/agents/src/testing/test-execution-infrastructure.ts#

  • L9

    ts
    7   * - Crash dump collection and analysis
    8   * - Log parsing and issue detection
    9   * - Real issue detection (replaces synthetic Math.random() issues)
    10   */
    11
    
  • L2102

    ts
    2100;
    2101; /**
    2102   * Detects real issues from game testing (replaces Math.random() fake issues)
    2103   * Aggregates data from logs, performance, crashes, and gameplay
    2104   */
    
  • L2536

    ts
    2534  /**
    2535   * Integrated test executor that combines all infrastructure components
    2536   * This replaces the synthetic Math.random()-based testing with real test execution
    2537   */
    2538  export class TestExecutor extends TypedEventEmitter<TestExecutorEvents> {
    

libs/yemaya/asset-generation/src/asset-core/asset-core.ts#

  • L1614

    ts
    1612        },
    1613        styleGuideId: params.styleGuideId,
    1614        seed: params.seed ?? Math.floor(Math.random() * 2147483647),
    1615        generationParams: params.generationParams ?? {},
    1616        variants: [],
    

libs/yemaya/asset-generation/src/illustration-engine/illustration-engine.ts#

  • L2562

    ts
    2560        quality: qualityMetrics,
    2561        styleGuideId: request.styleGuideId ?? ('' as unknown as StyleGuideId),
    2562        seed: request.seed ?? Math.floor(Math.random() * 2147483647),
    2563        generationParams: {
    2564          style: request.style,
    

libs/yemaya/asset-generation/src/thumbnail-generator/thumbnail-generator.ts#

  • L2056

    ts
    2054        },
    2055        styleGuideId: request.styleGuideId ?? ('' as unknown as StyleGuideId),
    2056        seed: request.seed ?? Math.floor(Math.random() * 2147483647),
    2057        generationParams: {
    2058          style: request.style,
    

libs/yemaya/assets/src/diff/diff-image.ts#

  • L1570

    ts
    1568
    1569      for (let i = 0; i < sampleCount; i++) {
    1570        const x = Math.floor(Math.random() * Math.min(left.width, right.width));
    1571        const y = Math.floor(Math.random() * Math.min(left.height, right.height));
    1572
    
  • L1571

    ts
    1569      for (let i = 0; i < sampleCount; i++) {
    1570        const x = Math.floor(Math.random() * Math.min(left.width, right.width));
    1571        const y = Math.floor(Math.random() * Math.min(left.height, right.height));
    1572
    1573        const leftPixel = this.getPixelRGB(left, x, y);
    

libs/yemaya/assets/src/indexing/metadata-indexing.ts#

  • L975

    ts
    973      options: BulkIndexOptions = {}
    974    ): Promise<BulkIndexResult> {
    975      const batchId = `bulk_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    976      const batchSize = options.batchSize || 100;
    977      const startTime = Date.now();
    

libs/yemaya/assets/src/search/index.ts#

  • L14

    ts
    12
    13  function generateId(prefix: string): string {
    14    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    15  }
    16
    

libs/yemaya/assets/src/versioning/lfs-transfer-acceleration.ts#

  • L569

    ts
    567     */
    568    async queueTransfer(request: TransferRequest): Promise<string> {
    569      const id = request.id || `transfer_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    570      const fullRequest: TransferRequest = { ...request, id };
    571
    
  • L583

    ts
    581     */
    582    async startTransfer(request: TransferRequest): Promise<TransferResult> {
    583      const id = request.id || `transfer_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    584      const fullRequest: TransferRequest = { ...request, id };
    585
    
  • L660

    ts
    658     */
    659    async startBatchTransfer(batch: BatchTransferRequest): Promise<BatchTransferResult> {
    660      const batchId = batch.id || `batch_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    661      const startTime = Date.now();
    662
    

libs/yemaya/auth/src/services/password.ts#

  • L273

    ts
    271      if (options?.includeLowercase !== false) {
    272        charset += lowercase;
    273        const char = lowercase[Math.floor(Math.random() * lowercase.length)];
    274        if (char) required.push(char);
    275      }
    
  • L279

    ts
    277      if (options?.includeUppercase !== false) {
    278        charset += uppercase;
    279        const char = uppercase[Math.floor(Math.random() * uppercase.length)];
    280        if (char) required.push(char);
    281      }
    
  • L285

    ts
    283      if (options?.includeNumbers !== false) {
    284        charset += numbers;
    285        const char = numbers[Math.floor(Math.random() * numbers.length)];
    286        if (char) required.push(char);
    287      }
    
  • L291

    ts
    289      if (options?.includeSymbols !== false) {
    290        charset += symbols;
    291        const char = symbols[Math.floor(Math.random() * symbols.length)];
    292        if (char) required.push(char);
    293      }
    
  • L314

    ts
    312      // Insert required characters at random positions
    313      for (const char of required) {
    314        const position = Math.floor(Math.random() * (password.length + 1));
    315        password = password.slice(0, position) + char + password.slice(position);
    316      }
    

libs/yemaya/budget-management/src/compute-budget.ts#

  • L129

    ts
    127          if (!existingAlert) {
    128            this.alerts.push({
    129              id: `alert_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    130              category: allocation.category,
    131              severity,
    

libs/yemaya/budget-management/src/optimization.ts#

  • L175

    ts
    173
    174      const scenario: Scenario = {
    175        id: `scenario_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    176        name,
    177        cost,
    

libs/yemaya/canon-enforcement/src/canon-manager.ts#

  • L35

    ts
    33    addEntry(fact: string, tier: CanonTier, source: string): CanonEntry {
    34      const entry: CanonEntry = {
    35        id: `canon_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    36        fact,
    37        tier,
    
  • L140

    ts
    138    ): StyleRule {
    139      const entry: StyleRule = {
    140        id: `style_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    141        domain,
    142        rule,
    
  • L182

    ts
    180    ): ConsistencyViolation {
    181      const violation: ConsistencyViolation = {
    182        id: `viol_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    183        type: 'style',
    184        description,
    
  • L277

    ts
    275    ): ConsistencyViolation {
    276      const violation: ConsistencyViolation = {
    277        id: `char_viol_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    278        type: 'character',
    279        description,
    

libs/yemaya/comfyui-integration/src/comfyui-factory/comfyui-factory.ts#

  • L1274

    ts
    1272        const lowerWord = word.toLowerCase().replace(/[^a-z]/g, '');
    1273        const synonyms = synonymMap[lowerWord];
    1274        if (synonyms && Math.random() < 0.3) {
    1275          const synonym = synonyms[Math.floor(Math.random() * synonyms.length)];
    1276          // Replace the first occurrence, case-insensitive
    
  • L1275

    ts
    1273        const synonyms = synonymMap[lowerWord];
    1274        if (synonyms && Math.random() < 0.3) {
    1275          const synonym = synonyms[Math.floor(Math.random() * synonyms.length)];
    1276          // Replace the first occurrence, case-insensitive
    1277          const regex = new RegExp(`\\b${escapeRegExp(word)}\\b`, 'i');
    
  • L1284

    ts
    1282      // Strategy 2: add variation tokens
    1283      if (extraTokens.length > 0) {
    1284        const tokenCount = 1 + Math.floor(Math.random() * 2);
    1285        const selectedTokens: string[] = [];
    1286        for (let t = 0; t < tokenCount; t++) {
    
  • L1287

    ts
    1285        const selectedTokens: string[] = [];
    1286        for (let t = 0; t < tokenCount; t++) {
    1287          const token = extraTokens[Math.floor(Math.random() * extraTokens.length)];
    1288          if (
    1289            !selectedTokens.includes(token) &&
    
  • L1308

    ts
    1306        if (parts.length > 2) {
    1307          // Swap two random non-first parts
    1308          const idx1 = 1 + Math.floor(Math.random() * (parts.length - 1));
    1309          const idx2 = 1 + Math.floor(Math.random() * (parts.length - 1));
    1310          if (idx1 !== idx2) {
    
  • L1309

    ts
    1307          // Swap two random non-first parts
    1308          const idx1 = 1 + Math.floor(Math.random() * (parts.length - 1));
    1309          const idx2 = 1 + Math.floor(Math.random() * (parts.length - 1));
    1310          if (idx1 !== idx2) {
    1311            const temp = parts[idx1];
    
  • L1560

    ts
    1558        return fixedSeed ?? 42;
    1559      case SeedStrategy.Random:
    1560        return Math.floor(Math.random() * 2147483647);
    1561      case SeedStrategy.Incremental:
    1562        return (fixedSeed ?? 0) + 1;
    
  • L1566

    ts
    1564        return fixedSeed ?? 12345;
    1565      default:
    1566        return Math.floor(Math.random() * 2147483647);
    1567    }
    1568  }
    

libs/yemaya/comfyui-integration/src/generation-pipeline/generation-pipeline.ts#

  • L186

    ts
    184      resolution: { width: 1024, height: 1024, aspectRatio: AspectRatio.Square1x1 },
    185      samplerParams: createSamplerParams(QualityPreset.Standard),
    186      seed: Math.floor(Math.random() * 2 ** 32),
    187      seedStrategy: SeedStrategy.Random,
    188      model: '',
    
  • L219

    ts
    217      resolution: res,
    218      samplerParams,
    219      seed: Math.floor(Math.random() * 2 ** 32),
    220      seedStrategy: SeedStrategy.Random,
    221      model: model ?? '',
    
  • L253

    ts
    251      resolution: { width: 1024, height: 1024, aspectRatio: AspectRatio.Square1x1 },
    252      samplerParams: adjustedSampler,
    253      seed: Math.floor(Math.random() * 2 ** 32),
    254      seedStrategy: SeedStrategy.Random,
    255      model: '',
    
  • L291

    ts
    289      resolution: { width: 1024, height: 1024, aspectRatio: AspectRatio.Square1x1 },
    290      samplerParams: adjustedSampler,
    291      seed: Math.floor(Math.random() * 2 ** 32),
    292      seedStrategy: SeedStrategy.Random,
    293      model: '',
    
  • L329

    ts
    327      resolution: { width: 1024, height: 1024, aspectRatio: AspectRatio.Square1x1 },
    328      samplerParams,
    329      seed: Math.floor(Math.random() * 2 ** 32),
    330      seedStrategy: SeedStrategy.Random,
    331      model: '',
    
  • L375

    ts
    373      resolution: { width: 1024, height: 1024, aspectRatio: AspectRatio.Square1x1 },
    374      samplerParams,
    375      seed: Math.floor(Math.random() * 2 ** 32),
    376      seedStrategy: SeedStrategy.Random,
    377      model: '',
    
  • L429

    ts
    427        denoise: denoise ?? 0.3,
    428      },
    429      seed: Math.floor(Math.random() * 2 ** 32),
    430      seedStrategy: SeedStrategy.Fixed,
    431      model: model ?? 'RealESRGAN_x4plus',
    
  • L491

    ts
    489    switch (strategy) {
    490      case SeedStrategy.Random:
    491        return Math.floor(Math.random() * 2 ** 32);
    492      case SeedStrategy.Fixed:
    493        return currentSeed ?? 42;
    
  • L502

    ts
    500      }
    501      default:
    502        return Math.floor(Math.random() * 2 ** 32);
    503    }
    504  }
    

libs/yemaya/comfyui-integration/src/provider-manager/provider-manager.ts#

  • L716

    ts
    714    const clampedDelay = Math.min(maxDelayMs, exponentialDelay);
    715    const jitterRange = clampedDelay * Math.abs(jitter);
    716    const jitterValue = (Math.random() * 2 - 1) * jitterRange;
    717    return Math.max(0, Math.round(clampedDelay + jitterValue));
    718  }
    
  • L2450

    ts
    2448
    2449      // Create new provider job ID
    2450      const newProviderJobId = `${provider.type}_retry_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
    2451
    2452      // Calculate backoff delay (would be used to delay the retry in a real async implementation)
    
  • L2533

    ts
    2531
    2532      // Create a new job on the new provider
    2533      const newProviderJobId = `${alternative.type}_failover_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
    2534
    2535      const health = this.healthStates.get(alternative.id);
    

libs/yemaya/comfyui-integration/src/workflow-core/workflow-core.ts#

  • L1294

    ts
    1292      'KSampler',
    1293      {
    1294        seed: Math.floor(Math.random() * 2 ** 32),
    1295        steps: samplerParams.steps,
    1296        cfg: samplerParams.cfg,
    
  • L1448

    ts
    1446      'KSampler',
    1447      {
    1448        seed: Math.floor(Math.random() * 2 ** 32),
    1449        steps: adjustedParams.steps,
    1450        cfg: adjustedParams.cfg,
    
  • L1602

    ts
    1600      'KSampler',
    1601      {
    1602        seed: Math.floor(Math.random() * 2 ** 32),
    1603        steps: 25,
    1604        cfg: 7.0,
    

libs/yemaya/community/src/certification/certification-manager.ts#

  • L425

    ts
    423      const shuffled = [...pool];
    424      for (let i = shuffled.length - 1; i > 0; i--) {
    425        const j = Math.floor(Math.random() * (i + 1));
    426        [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
    427      }
    

libs/yemaya/community/src/education/education-manager.ts#

  • L957

    ts
    955      const shuffled = [...array];
    956      for (let i = shuffled.length - 1; i > 0; i--) {
    957        const j = Math.floor(Math.random() * (i + 1));
    958        [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
    959      }
    

libs/yemaya/core/src/advanced/security-performance-sota.ts#

  • L31

    ts
    29
    30  function generateId(prefix: string): string {
    31    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    32  }
    33
    
  • L1050

    ts
    1048
    1049      // Simulate finding some vulnerabilities
    1050      if (Math.random() > 0.5) {
    1051        findings.push({
    1052          id: generateId('vuln'),
    
  • L1303

    ts
    1301        asset.status = 'loaded';
    1302        asset.loadedAt = new Date();
    1303        asset.size = Math.floor(Math.random() * 10000) + 1000;
    1304
    1305        const result: AssetLoadingResult = {
    
  • L1522

    ts
    1520        id: generateId('snapshot'),
    1521        timestamp: new Date(),
    1522        totalHeap: Math.floor(Math.random() * 500000000) + 100000000,
    1523        usedHeap: Math.floor(Math.random() * 300000000) + 50000000,
    1524        externalMemory: Math.floor(Math.random() * 50000000),
    
  • L1523

    ts
    1521        timestamp: new Date(),
    1522        totalHeap: Math.floor(Math.random() * 500000000) + 100000000,
    1523        usedHeap: Math.floor(Math.random() * 300000000) + 50000000,
    1524        externalMemory: Math.floor(Math.random() * 50000000),
    1525        arrayBuffers: Math.floor(Math.random() * 10000000),
    
  • L1524

    ts
    1522        totalHeap: Math.floor(Math.random() * 500000000) + 100000000,
    1523        usedHeap: Math.floor(Math.random() * 300000000) + 50000000,
    1524        externalMemory: Math.floor(Math.random() * 50000000),
    1525        arrayBuffers: Math.floor(Math.random() * 10000000),
    1526        regions: [
    
  • L1525

    ts
    1523        usedHeap: Math.floor(Math.random() * 300000000) + 50000000,
    1524        externalMemory: Math.floor(Math.random() * 50000000),
    1525        arrayBuffers: Math.floor(Math.random() * 10000000),
    1526        regions: [
    1527          {
    
  • L1529

    ts
    1527          {
    1528            name: 'new_space',
    1529            allocated: Math.floor(Math.random() * 10000000),
    1530            used: Math.floor(Math.random() * 8000000),
    1531            peak: Math.floor(Math.random() * 12000000),
    
  • L1530

    ts
    1528            name: 'new_space',
    1529            allocated: Math.floor(Math.random() * 10000000),
    1530            used: Math.floor(Math.random() * 8000000),
    1531            peak: Math.floor(Math.random() * 12000000),
    1532            objects: Math.floor(Math.random() * 100000),
    
  • L1531

    ts
    1529            allocated: Math.floor(Math.random() * 10000000),
    1530            used: Math.floor(Math.random() * 8000000),
    1531            peak: Math.floor(Math.random() * 12000000),
    1532            objects: Math.floor(Math.random() * 100000),
    1533          },
    
  • L1532

    ts
    1530            used: Math.floor(Math.random() * 8000000),
    1531            peak: Math.floor(Math.random() * 12000000),
    1532            objects: Math.floor(Math.random() * 100000),
    1533          },
    1534          {
    
  • L1536

    ts
    1534          {
    1535            name: 'old_space',
    1536            allocated: Math.floor(Math.random() * 200000000),
    1537            used: Math.floor(Math.random() * 150000000),
    1538            peak: Math.floor(Math.random() * 250000000),
    
  • L1537

    ts
    1535            name: 'old_space',
    1536            allocated: Math.floor(Math.random() * 200000000),
    1537            used: Math.floor(Math.random() * 150000000),
    1538            peak: Math.floor(Math.random() * 250000000),
    1539            objects: Math.floor(Math.random() * 500000),
    
  • L1538

    ts
    1536            allocated: Math.floor(Math.random() * 200000000),
    1537            used: Math.floor(Math.random() * 150000000),
    1538            peak: Math.floor(Math.random() * 250000000),
    1539            objects: Math.floor(Math.random() * 500000),
    1540          },
    
  • L1539

    ts
    1537            used: Math.floor(Math.random() * 150000000),
    1538            peak: Math.floor(Math.random() * 250000000),
    1539            objects: Math.floor(Math.random() * 500000),
    1540          },
    1541        ],
    
  • L1650

    ts
    1648        id: generateId('gc'),
    1649        type,
    1650        duration: Math.floor(Math.random() * 50) + 5,
    1651        freedBytes: Math.floor(Math.random() * 50000000),
    1652        timestamp: new Date(),
    
  • L1651

    ts
    1649        type,
    1650        duration: Math.floor(Math.random() * 50) + 5,
    1651        freedBytes: Math.floor(Math.random() * 50000000),
    1652        timestamp: new Date(),
    1653        reason: 'manual',
    
  • L1857

    ts
    1855            timestamp: Date.now(),
    1856            stack: ['main', 'processData', 'compute'],
    1857            cpuPercent: Math.random() * 50,
    1858          },
    1859        ],
    
  • L1865

    ts
    1863            file: 'src/processor.ts',
    1864            line: 42,
    1865            selfTime: Math.random() * 100,
    1866            totalTime: Math.random() * 200,
    1867          },
    
  • L1866

    ts
    1864            line: 42,
    1865            selfTime: Math.random() * 100,
    1866            totalTime: Math.random() * 200,
    1867          },
    1868        ],
    

libs/yemaya/core/src/advanced/testing-sota.ts#

  • L26

    ts
    24
    25  function generateId(prefix: string): string {
    26    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    27  }
    28
    
  • L867

    ts
    865     */
    866    generate(config: GeneratorConfig): unknown {
    867      if (config.nullable && Math.random() < 0.1) {
    868        return null;
    869      }
    
  • L879

    ts
    877          return this.generateString(config.minLength ?? 0, config.maxLength ?? 100, config.pattern);
    878        case 'boolean':
    879          return Math.random() < 0.5;
    880        case 'array':
    881          return this.generateArray(config);
    
  • L885

    ts
    883          return this.generateObject(config);
    884        case 'date':
    885          return new Date(Date.now() - Math.floor(Math.random() * 365 * 24 * 60 * 60 * 1000));
    886        case 'uuid':
    887          return this.generateUUID();
    
  • L979

    ts
    977
    978    private generateInteger(min: number, max: number): number {
    979      return Math.floor(Math.random() * (max - min + 1)) + min;
    980    }
    981
    
  • L983

    ts
    981
    982    private generateFloat(min: number, max: number): number {
    983      return Math.random() * (max - min) + min;
    984    }
    985
    
  • L991

    ts
    989      let result = '';
    990      for (let i = 0; i < length; i++) {
    991        result += chars.charAt(Math.floor(Math.random() * chars.length));
    992      }
    993      return result;
    
  • L1019

    ts
    1017    private generateUUID(): string {
    1018      return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    1019        const r = (Math.random() * 16) | 0;
    1020        const v = c === 'x' ? r : (r & 0x3) | 0x8;
    1021        return v.toString(16);
    
  • L1241

    ts
    1239     */
    1240    generateInput(type: FuzzInputType, size?: number): unknown {
    1241      const targetSize = size ?? Math.floor(Math.random() * this.config.maxInputSize);
    1242
    1243      switch (type) {
    
  • L1324

    ts
    1322      const mutations = [
    1323        () => input + this.getRandomDictionaryEntry(),
    1324        () => input.replace(/./g, () => String.fromCharCode(Math.floor(Math.random() * 256))),
    1325        () => input.split('').reverse().join(''),
    1326        () => input.repeat(Math.floor(Math.random() * 10) + 1),
    
  • L1326

    ts
    1324        () => input.replace(/./g, () => String.fromCharCode(Math.floor(Math.random() * 256))),
    1325        () => input.split('').reverse().join(''),
    1326        () => input.repeat(Math.floor(Math.random() * 10) + 1),
    1327        () => input.slice(0, Math.floor(input.length / 2)),
    1328        () =>
    
  • L1329

    ts
    1327        () => input.slice(0, Math.floor(input.length / 2)),
    1328        () =>
    1329          Array.from({ length: Math.floor(Math.random() * 100) }, () =>
    1330            String.fromCharCode(Math.floor(Math.random() * 256))
    1331          ).join(''),
    
  • L1330

    ts
    1328        () =>
    1329          Array.from({ length: Math.floor(Math.random() * 100) }, () =>
    1330            String.fromCharCode(Math.floor(Math.random() * 256))
    1331          ).join(''),
    1332      ];
    
  • L1334

    ts
    1332      ];
    1333
    1334      const mutation = mutations[Math.floor(Math.random() * mutations.length)];
    1335      return mutation ? mutation() : input;
    1336    }
    
  • L1380

    ts
    1378      const chars: string[] = [];
    1379      for (let i = 0; i < size; i++) {
    1380        chars.push(String.fromCharCode(Math.floor(Math.random() * 256)));
    1381      }
    1382      return chars.join('');
    
  • L1397

    ts
    1395        () => -Infinity,
    1396        () => NaN,
    1397        () => Math.random() * Number.MAX_VALUE,
    1398      ];
    1399
    
  • L1400

    ts
    1398      ];
    1399
    1400      const type = types[Math.floor(Math.random() * types.length)];
    1401      return type ? type() : 0;
    1402    }
    
  • L1407

    ts
    1405      const buffer = new Uint8Array(size);
    1406      for (let i = 0; i < size; i++) {
    1407        buffer[i] = Math.floor(Math.random() * 256);
    1408      }
    1409      return buffer;
    
  • L1416

    ts
    1414        string: this.generateFuzzString(100),
    1415        number: this.generateFuzzNumber(),
    1416        boolean: Math.random() < 0.5,
    1417        null: null,
    1418        array: [this.generateFuzzString(10), this.generateFuzzNumber()],
    
  • L1437

    ts
    1435        "admin'--",
    1436      ];
    1437      return payloads[Math.floor(Math.random() * payloads.length)] ?? '';
    1438    }
    1439
    
  • L1442

    ts
    1440    private generateFuzzCommand(): string {
    1441      const payloads = ['; ls -la', '| cat /etc/passwd', '& whoami', '$(whoami)', '`id`'];
    1442      return payloads[Math.floor(Math.random() * payloads.length)] ?? '';
    1443    }
    1444
    
  • L1447

    ts
    1445    private getRandomDictionaryEntry(): string {
    1446      if (this.dictionary.length === 0) return '';
    1447      return this.dictionary[Math.floor(Math.random() * this.dictionary.length)] ?? '';
    1448    }
    1449
    

libs/yemaya/core/src/cost-management.ts#

  • L710

    ts
    708     */
    709    createBudget(config: Omit<BudgetConfig, 'id' | 'status'>): BudgetConfig {
    710      const id = `budget_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as BudgetId;
    711      const budget: BudgetConfig = {
    712        ...config,
    
  • L891

    ts
    889    ): BudgetAlert {
    890      const alert: BudgetAlert = {
    891        id: `alert_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    892        budgetId,
    893        type,
    
  • L1011

    ts
    1009      const fullEntry: CostEntry = {
    1010        ...entry,
    1011        id: `cost_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as CostEntryId,
    1012        timestamp: new Date(),
    1013      };
    
  • L1441

    ts
    1439
    1440      const report: CostReport = {
    1441        id: `report_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as CostReportId,
    1442        name: params.name,
    1443        description: params.description,
    

libs/yemaya/core/src/index.ts#

  • L65

    ts
    63      typeof crypto !== 'undefined' && crypto.randomUUID
    64        ? crypto.randomUUID()
    65        : `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    66
    67    return prefix ? `${prefix}_${uuid}` : uuid;
    

libs/yemaya/core/src/monitoring.ts#

  • L593

    ts
    591        return `${traceId}-${spanId}` as CorrelationId;
    592      }
    593      return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}` as CorrelationId;
    594    }
    595  }
    
  • L931

    ts
    929    startExecution(pipelineName: string, inputSizeBytes: number = 0): PipelineExecutionId {
    930      const id =
    931        `pipeline_${Date.now()}_${Math.random().toString(36).slice(2, 9)}` as PipelineExecutionId;
    932
    933      const execution: PipelineExecution = {
    
  • L1737

    ts
    1735    getCorrelationId(): CorrelationId {
    1736      if (!this.tracingService) {
    1737        return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}` as CorrelationId;
    1738      }
    1739      return this.tracingService.createCorrelationId();
    

libs/yemaya/diagram-renderer/src/layout-engine/layout-engine.ts#

  • L598

    ts
    596    if (dist < 0.01) {
    597      // Nodes on same position, push apart with small random offset
    598      const angle = Math.random() * Math.PI * 2;
    599      return {
    600        fx: Math.cos(angle) * repulsionStrength * 0.01,
    

libs/yemaya/enterprise/src/analytics/analytics-dashboard.ts#

  • L460

    ts
    458      const dashboard: DashboardConfig = {
    459        ...config,
    460        id: `dash_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    461      };
    462
    
  • L478

    ts
    476      const newPanel: DashboardPanel = {
    477        ...panel,
    478        id: `panel_${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
    479      };
    480
    
  • L551

    ts
    549      const alertRule: AlertRule = {
    550        ...rule,
    551        id: `alert_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    552      };
    553
    
  • L644

    ts
    642    private fireAlert(rule: AlertRule, metricValue: MetricValue): void {
    643      const alert: Alert = {
    644        id: `alert_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    645        ruleId: rule.id,
    646        status: 'pending',
    

libs/yemaya/human-override/src/override-system.ts#

  • L51

    ts
    49    ): Override {
    50      const o: Override = {
    51        id: `override_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    52        type,
    53        reason,
    
  • L88

    ts
    86    createCheckpoint(name: string, state: unknown): Checkpoint {
    87      const cp: Checkpoint = {
    88        id: `cp_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    89        name,
    90        state,
    
  • L138

    ts
    136    ): EscalationTrigger {
    137      const trigger: EscalationTrigger = {
    138        id: `esc_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    139        category,
    140        threshold,
    
  • L203

    ts
    201    createRecoveryPlan(overrideId: string, steps: string[], estimatedDuration: number): RecoveryPlan {
    202      const plan: RecoveryPlan = {
    203        id: `recovery_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    204        overrideId,
    205        steps,
    

libs/yemaya/orchestration/src/execution/director.ts#

  • L806

    ts
    804   */
    805  export function sampleTriangularDist(a: number, c: number, b: number): number {
    806    const u = Math.random();
    807    const fc = (c - a) / (b - a);
    808
    

libs/yemaya/orchestration/src/execution/retry-manager.ts#

  • L91

    ts
    89      case 'exponential': {
    90        // Full jitter algorithm: delay = random(0, min(maxDelay, base * 2^attempt))
    91        // Math.random() is intentionally used here for jitter — the goal is to
    92        // decorrelate retry bursts across concurrent callers, not to produce
    93        // cryptographically secure values. Uniform jitter prevents thundering-herd
    
  • L97

    ts
    95        const exponential = baseDelayMs * Math.pow(2, attempt);
    96        const capped = Math.min(exponential, maxDelayMs);
    97        delay = Math.random() * capped;
    98        break;
    99      }
    

libs/yemaya/orchestration/src/services/goal-decomposition.ts#

  • L1824

    ts
    1822  export function sampleTriangular(min: number, mode: number, max: number): number {
    1823    if (min >= max) return mode;
    1824    const u = Math.random();
    1825    const fc = (mode - min) / (max - min);
    1826
    
  • L4015

    ts
    4013      // Apply risk factors
    4014      for (const risk of riskFactors) {
    4015        if (Math.random() < risk.probability) {
    4016          totalDuration += risk.impactDays * this.riskMultiplier;
    4017        }
    

libs/yemaya/organizations/src/services/accessibility-preferences-service.ts#

  • L355

    ts
    353   */
    354  function generateId(): string {
    355    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    356  }
    357
    

libs/yemaya/organizations/src/services/activity-tracking-service.ts#

  • L514

    ts
    512   */
    513  function generateId(): string {
    514    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    515  }
    516
    

libs/yemaya/organizations/src/services/ai-preferences-service.ts#

  • L366

    ts
    364   */
    365  function generateId(): string {
    366    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    367  }
    368
    

libs/yemaya/organizations/src/services/analytics-service.ts#

  • L270

    ts
    268    ): Promise<AnalyticsEvent> {
    269      const fullEvent: AnalyticsEvent = {
    270        id: `evt_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    271        organizationId,
    272        timestamp: new Date(),
    
  • L715

    ts
    713      const now = new Date();
    714      const fullSegment: UserSegment = {
    715        id: `seg_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    716        organizationId,
    717        userCount: 0,
    
  • L826

    ts
    824      const now = new Date();
    825      const fullAlert: AnalyticsAlert = {
    826        id: `alert_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    827        organizationId,
    828        createdAt: now,
    
  • L924

    ts
    922        if (shouldTrigger) {
    923          const trigger: AnalyticsAlertTrigger = {
    924            id: `trigger_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    925            alertId: alert.id,
    926            organizationId,
    
  • L992

    ts
    990      const now = new Date();
    991      const exportRecord: AnalyticsExport = {
    992        id: `export_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    993        organizationId: request.organizationId,
    994        request,
    
  • L1424

    ts
    1422    async getSegmentUserCount(_segment: UserSegment): Promise<number> {
    1423      // Simplified - would evaluate criteria against user data
    1424      return Math.floor(Math.random() * 100);
    1425    }
    1426
    

libs/yemaya/organizations/src/services/anomaly-detection-service.ts#

  • L280

    ts
    278   */
    279  function generateId(): string {
    280    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    281  }
    282
    

libs/yemaya/organizations/src/services/billing-service.ts#

  • L475

    ts
    473
    474      const subscription: Subscription = {
    475        id: `sub_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    476        organizationId,
    477        plan: input.plan,
    
  • L863

    ts
    861      const now = new Date();
    862      const paymentMethod: PaymentMethod = {
    863        id: `pm_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    864        organizationId,
    865        type: input.type,
    

libs/yemaya/organizations/src/services/branding-service.ts#

  • L289

    ts
    287        // Create new branding
    288        const branding: OrganizationBranding = {
    289          id: `branding_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    290          organizationId,
    291          displayName: input.displayName,
    
  • L831

    ts
    829    ): Promise<void> {
    830      await this.repository.logEvent({
    831        id: `evt_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    832        organizationId,
    833        type,
    

libs/yemaya/organizations/src/services/bulk-invitation-service.ts#

  • L289

    ts
    287   */
    288  function generateJobId(): string {
    289    return `bjob_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 9)}`;
    290  }
    291
    

libs/yemaya/organizations/src/services/checklist-service.ts#

  • L607

    ts
    605   */
    606  function generateId(): string {
    607    return `chk_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
    608  }
    609
    

libs/yemaya/organizations/src/services/compliance-reporting-service.ts#

  • L217

    ts
    215   */
    216  function generateId(): string {
    217    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    218  }
    219
    

libs/yemaya/organizations/src/services/data-export-preferences-service.ts#

  • L258

    ts
    256   */
    257  function generateId(): string {
    258    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    259  }
    260
    

libs/yemaya/organizations/src/services/export-service.ts#

  • L1023

    ts
    1021   */
    1022  function generateId(): string {
    1023    return `exp_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 9)}`;
    1024  }
    1025
    

libs/yemaya/organizations/src/services/invitation-tracking-service.ts#

  • L178

    ts
    176   */
    177  function generateEventId(): string {
    178    return `evt_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 9)}`;
    179  }
    180
    

libs/yemaya/organizations/src/services/keyboard-shortcuts-service.ts#

  • L713

    ts
    711   */
    712  function generateId(): string {
    713    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    714  }
    715
    

libs/yemaya/organizations/src/services/language-preferences-service.ts#

  • L830

    ts
    828   */
    829  function generateId(): string {
    830    return `lang_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
    831  }
    832
    

libs/yemaya/organizations/src/services/notification-preferences-service.ts#

  • L683

    ts
    681   */
    682  function generateId(): string {
    683    return `notif_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
    684  }
    685
    
  • L690

    ts
    688   */
    689  function generateUnsubscribeToken(): string {
    690    return `unsub_${Date.now()}_${Math.random().toString(36).slice(2, 16)}`;
    691  }
    692
    

libs/yemaya/organizations/src/services/onboarding-wizard-service.ts#

  • L120

    ts
    118   */
    119  function generateSessionId(): string {
    120    return `wiz_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 9)}`;
    121  }
    122
    
  • L127

    ts
    125   */
    126  function generateEventId(): string {
    127    return `wevt_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 9)}`;
    128  }
    129
    

libs/yemaya/organizations/src/services/privacy-settings-service.ts#

  • L192

    ts
    190   */
    191  function generateId(): string {
    192    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    193  }
    194
    

libs/yemaya/organizations/src/services/progress-tracking-service.ts#

  • L184

    ts
    182   */
    183  function generateId(prefix: string): string {
    184    return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 9)}`;
    185  }
    186
    

libs/yemaya/organizations/src/services/project-settings-service.ts#

  • L494

    ts
    492   */
    493  function generateId(): string {
    494    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    495  }
    496
    

libs/yemaya/organizations/src/services/sample-project-service.ts#

  • L954

    ts
    952   */
    953  function generateId(): string {
    954    return `proj_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
    955  }
    956
    

libs/yemaya/organizations/src/services/settings-service.ts#

  • L252

    ts
    250      this.store = store;
    251      this.orgLookup = orgLookup;
    252      this.generateId = options?.generateId ?? (() => `setting-change-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`);
    253    }
    254
    

libs/yemaya/organizations/src/services/sso-service.ts#

  • L375

    ts
    373      const now = new Date();
    374      const provider: SSOProvider = {
    375        id: `sso_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    376        organizationId,
    377        name: input.name,
    
  • L624

    ts
    622
    623      const now = new Date();
    624      const requestId = `req_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
    625
    626      const authRequest: SSOAuthRequest = {
    
  • L1307

    ts
    1305      const now = new Date();
    1306      const session: SSOSession = {
    1307        id: `session_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    1308        organizationId: provider.organizationId,
    1309        userId,
    
  • L1445

    ts
    1443    ): Promise<void> {
    1444      await this.repository.logEvent({
    1445        id: `evt_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
    1446        organizationId,
    1447        providerId: metadata?.providerId as string,
    

libs/yemaya/organizations/src/services/theme-preferences-service.ts#

  • L532

    ts
    530   */
    531  function generateId(): string {
    532    return `theme_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
    533  }
    534
    

libs/yemaya/organizations/src/services/welcome-tour-service.ts#

  • L626

    ts
    624   */
    625  function generateId(): string {
    626    return `tour_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
    627  }
    628
    

libs/yemaya/podcast-generator/src/audio-mixer/audio-mixer.ts#

  • L810

    ts
    808
    809    for (let i = 0; i < totalSamples; i++) {
    810      result[i] = amp * (Math.random() * 2 - 1);
    811    }
    812
    
  • L839

    ts
    837    // Initialize rows with random values
    838    for (let j = 0; j < numRows; j++) {
    839      rows[j] = Math.random() * 2 - 1;
    840      runningSum += rows[j];
    841    }
    
  • L851

    ts
    849        }
    850        runningSum -= rows[j];
    851        rows[j] = Math.random() * 2 - 1;
    852        runningSum += rows[j];
    853        k >>= 1;
    
  • L857

    ts
    855
    856      // Normalize by number of rows and add white noise component for high frequencies
    857      const white = Math.random() * 2 - 1;
    858      const value = (runningSum + white) / (numRows + 1);
    859      result[i] = amp * clamp(value, -1, 1);
    

libs/yemaya/production-verification/src/verification.ts#

  • L34

    ts
    32
    33      const check: CompletenessCheck = {
    34        id: `check_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    35        category,
    36        name,
    
  • L110

    ts
    108
    109      const benchmark: AAABenchmark = {
    110        id: `bench_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    111        category,
    112        metric,
    
  • L165

    ts
    163
    164      const check: CoherenceCheck = {
    165        id: `coherence_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    166        aspect,
    167        gameScore,
    
  • L245

    ts
    243
    244      const report: SignoffReport = {
    245        id: `signoff_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    246        status,
    247        overallScore,
    

libs/yemaya/rbac/src/custom-roles.ts#

  • L304

    ts
    302      const now = new Date().toISOString();
    303      const role: CustomRoleDefinition = {
    304        id: `custom-role-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    305        name: input.name,
    306        description: input.description,
    

libs/yemaya/rbac/src/role-audit.ts#

  • L203

    ts
    201      this.store = store;
    202      this.retentionDays = options?.retentionDays ?? 365;
    203      this.generateId = options?.generateId ?? (() => `audit-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`);
    204    }
    205
    

libs/yemaya/rbac/src/role-templates.ts#

  • L528

    ts
    526    ) {
    527      this.store = store;
    528      this.generateId = options?.generateId ?? (() => `template-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`);
    529    }
    530
    

libs/yemaya/rbac/src/temporary-grants.ts#

  • L229

    ts
    227      this.maxDurationHours = options?.maxDurationHours ?? 168; // 7 days max
    228      this.defaultDurationHours = options?.defaultDurationHours ?? 24;
    229      this.generateId = options?.generateId ?? (() => `temp-grant-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`);
    230    }
    231
    

libs/yemaya/sdk/scripts/generate-postman.ts#

  • L479

    ts
    477  function generateUUID(): string {
    478    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    479      const r = (Math.random() * 16) | 0;
    480      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    481      return v.toString(16);
    

libs/yemaya/sdk/src/advanced/sdk-sota.ts#

  • L21

    ts
    19
    20  function generateId(prefix: string): string {
    21    return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
    22  }
    23
    
  • L1058

    ts
    1056
    1057      // Apply jitter
    1058      const jitter = delay * policy.jitterFactor * Math.random();
    1059      delay = delay + jitter;
    1060
    

libs/yemaya/self-improvement/src/self-improvement.ts#

  • L36

    ts
    34    ): ProductionOutcome {
    35      const o: ProductionOutcome = {
    36        id: `outcome_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    37        taskId,
    38        agentId,
    
  • L205

    ts
    203    ): TransferablePattern {
    204      const p: TransferablePattern = {
    205        id: `pattern_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    206        name,
    207        sourceProject,
    
  • L232

    ts
    230    ): LessonLearned {
    231      const lesson: LessonLearned = {
    232        id: `lesson_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
    233        project,
    234        category,
    

libs/yemaya/style-transfer/src/style-factory/style-factory.ts#

  • L1468

    ts
    1466      generationTimeMs: durationMs,
    1467      modelUsed: preset.model,
    1468      seed: request.seed ?? Math.floor(Math.random() * 2147483647),
    1469      warnings: [],
    1470    };
    

libs/yemaya/ui/src/components/AIImageGeneration/useAIImageGeneration.ts#

  • L111

    ts
    109   */
    110  function generateJobId(): string {
    111    return `job_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    112  }
    113
    

libs/yemaya/ui/src/components/AudioSync/types.ts#

  • L15

    ts
    13
    14  export function generateSyncPointId(): SyncPointId {
    15    return `sync_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as SyncPointId;
    16  }
    17
    
  • L21

    ts
    19
    20  export function generateSyncGroupId(): SyncGroupId {
    21    return `syncg_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as SyncGroupId;
    22  }
    23
    
  • L27

    ts
    25
    26  export function generateAudioTrackId(): AudioTrackId {
    27    return `atrack_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as AudioTrackId;
    28  }
    29
    

libs/yemaya/ui/src/components/AudioWaveform/types.ts#

  • L15

    ts
    13
    14  export function generateWaveformId(): WaveformId {
    15    return `waveform_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as WaveformId;
    16  }
    17
    
  • L21

    ts
    19
    20  export function generateMarkerId(): MarkerId {
    21    return `marker_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as MarkerId;
    22  }
    23
    
  • L27

    ts
    25
    26  export function generateRegionId(): RegionId {
    27    return `region_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as RegionId;
    28  }
    29
    

libs/yemaya/ui/src/components/AutoFraming/types.ts#

  • L15

    ts
    13
    14  export function generateFrameId(): FrameId {
    15    return `frame_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as FrameId;
    16  }
    17
    
  • L21

    ts
    19
    20  export function generateSubjectId(): SubjectId {
    21    return `subj_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as SubjectId;
    22  }
    23
    

libs/yemaya/ui/src/components/Camera3DVisualization/Camera3DVisualization.tsx#

  • L1785

    ts
    1783    const handleAddCamera = useCallback(() => {
    1784      const camera = createCameraProperties(`Camera ${visualization.cameras.length + 1}`, {
    1785        position: createVector3(Math.random() * 10 - 5, 2, Math.random() * 10 - 5),
    1786      });
    1787      visualization.addCamera(camera);
    

libs/yemaya/ui/src/components/CanvasItems/LayerPanel.tsx#

  • L460

    ts
    458   */
    459  function generateLayerId(): string {
    460    return `layer_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    461  }
    462
    

libs/yemaya/ui/src/components/CanvasItems/UndoRedo.tsx#

  • L215

    ts
    213   */
    214  export function generateActionId(): string {
    215    return `action_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    216  }
    217
    

libs/yemaya/ui/src/components/CanvasItems/types.ts#

  • L537

    ts
    535   */
    536  export function generateItemId(): string {
    537    return `item_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    538  }
    539
    

libs/yemaya/ui/src/components/CharacterDesigner/types.ts#

  • L16

    ts
    14   */
    15  export function generateCharacterId(): string {
    16    return `char-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    17  }
    18
    
  • L20

    ts
    18
    19  export function generateLayerId(): string {
    20    return `layer-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    21  }
    22
    
  • L24

    ts
    22
    23  export function generatePoseId(): string {
    24    return `pose-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    25  }
    26
    
  • L28

    ts
    26
    27  export function generateAnnotationId(): string {
    28    return `annot-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    29  }
    30
    
  • L334

    ts
    332   */
    333  export function generateReferenceId(): string {
    334    return `ref-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    335  }
    336
    
  • L948

    ts
    946   */
    947  export function generateTurnaroundPanelId(): string {
    948    return `panel-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    949  }
    950
    
  • L955

    ts
    953   */
    954  export function generateTurnaroundSheetId(): string {
    955    return `sheet-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    956  }
    957
    
  • L1448

    ts
    1446   */
    1447  export function generateExpressionPanelId(): string {
    1448    return `expr-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    1449  }
    1450
    
  • L1455

    ts
    1453   */
    1454  export function generateExpressionSheetId(): string {
    1455    return `exprsheet-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    1456  }
    1457
    
  • L2199

    ts
    2197   */
    2198  export function generateCostumeId(): string {
    2199    return `costume-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    2200  }
    2201
    
  • L2206

    ts
    2204   */
    2205  export function generateCostumeItemId(): string {
    2206    return `item-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    2207  }
    2208
    
  • L2213

    ts
    2211   */
    2212  export function generateCostumeSheetId(): string {
    2213    return `csheet-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    2214  }
    2215
    
  • L2965

    ts
    2963   */
    2964  export function generateCharacterGenerationId(): string {
    2965    return `chargen-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    2966  }
    2967
    
  • L2972

    ts
    2970   */
    2971  export function generateGeneratedImageId(): string {
    2972    return `genimg-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    2973  }
    2974
    
  • L3445

    ts
    3443   */
    3444  export function generateStyleReferenceId(): string {
    3445    return `styleref-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    3446  }
    3447
    
  • L3452

    ts
    3450   */
    3451  export function generateStyleAnchorId(): string {
    3452    return `anchor-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    3453  }
    3454
    
  • L3459

    ts
    3457   */
    3458  export function generateStyleProfileId(): string {
    3459    return `profile-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    3460  }
    3461
    
  • L3466

    ts
    3464   */
    3465  export function generateStyleAnalysisId(): string {
    3466    return `analysis-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    3467  }
    3468
    
  • L3473

    ts
    3471   */
    3472  export function generateStyleComparisonId(): string {
    3473    return `comparison-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    3474  }
    3475
    
  • L3480

    ts
    3478   */
    3479  export function generateStyleDriftId(): string {
    3480    return `drift-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    3481  }
    3482
    
  • L3487

    ts
    3485   */
    3486  export function generateStyleIssueId(): string {
    3487    return `issue-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    3488  }
    3489
    
  • L4103

    ts
    4101   */
    4102  export function generateIterationWorkflowId(): string {
    4103    return `workflow-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    4104  }
    4105
    
  • L4110

    ts
    4108   */
    4109  export function generateIterationId(): string {
    4110    return `iter-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    4111  }
    4112
    
  • L4117

    ts
    4115   */
    4116  export function generateVariantId(): string {
    4117    return `variant-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    4118  }
    4119
    
  • L4124

    ts
    4122   */
    4123  export function generateIterationComparisonId(): string {
    4124    return `comp-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    4125  }
    4126
    
  • L4131

    ts
    4129   */
    4130  export function generateRefinementEntryId(): string {
    4131    return `refine-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    4132  }
    4133
    
  • L4234

    ts
    4232      prompt,
    4233      negativePrompt: options?.negativePrompt,
    4234      seed: options?.seed ?? Math.floor(Math.random() * 2147483647),
    4235      parameters,
    4236      status: options?.status ?? 'pending',
    
  • L4848

    ts
    4846   */
    4847  export function generateReferenceInputId(): string {
    4848    return `ref-input-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    4849  }
    4850
    
  • L4855

    ts
    4853   */
    4854  export function generateReferenceGroupId(): string {
    4855    return `ref-group-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    4856  }
    4857
    
  • L4862

    ts
    4860   */
    4861  export function generateReferenceGenerationId(): string {
    4862    return `ref-gen-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    4863  }
    4864
    
  • L4869

    ts
    4867   */
    4868  export function generateReferenceResultId(): string {
    4869    return `ref-result-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    4870  }
    4871
    
  • L4876

    ts
    4874   */
    4875  export function generateReferenceLibraryId(): string {
    4876    return `ref-lib-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    4877  }
    4878
    
  • L4883

    ts
    4881   */
    4882  export function generateReferenceComparisonId(): string {
    4883    return `ref-comp-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    4884  }
    4885
    
  • L4890

    ts
    4888   */
    4889  export function generateReferenceHistoryId(): string {
    4890    return `ref-hist-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    4891  }
    4892
    

libs/yemaya/ui/src/components/CharacterTimeline/types.ts#

  • L316

    ts
    314   */
    315  export function generateLifeEventId(): string {
    316    return `event-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    317  }
    318
    

libs/yemaya/ui/src/components/ColorPalette/colorMatching.ts#

  • L605

    ts
    603    const usedIndices = new Set<number>();
    604    while (centroids.length < k) {
    605      const idx = Math.floor(Math.random() * colors.length);
    606      const color = colors[idx];
    607      if (!usedIndices.has(idx) && color) {
    

libs/yemaya/ui/src/components/ColorPalette/paletteCollaboration.ts#

  • L303

    ts
    301        const fullEvent: PaletteChangeEvent = {
    302          ...event,
    303          id: `change-${Date.now()}-${Math.random().toString(36).slice(2)}`,
    304          timestamp: new Date(),
    305        };
    

libs/yemaya/ui/src/components/ColorPalette/types.ts#

  • L530

    ts
    528   */
    529  export function generatePaletteId(): string {
    530    return `pal_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    531  }
    532
    
  • L537

    ts
    535   */
    536  export function generateSwatchId(): string {
    537    return `sw_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    538  }
    

libs/yemaya/ui/src/components/ColorPalette/usePaletteGeneration.ts#

  • L248

    ts
    246   */
    247  export function generateRandomColor(): Color {
    248    const h = Math.floor(Math.random() * 360);
    249    const s = Math.floor(Math.random() * 40) + 50; // 50-90
    250    const l = Math.floor(Math.random() * 30) + 40; // 40-70
    
  • L249

    ts
    247  export function generateRandomColor(): Color {
    248    const h = Math.floor(Math.random() * 360);
    249    const s = Math.floor(Math.random() * 40) + 50; // 50-90
    250    const l = Math.floor(Math.random() * 30) + 40; // 40-70
    251    return createColorFromHsl(h, s, l);
    
  • L250

    ts
    248    const h = Math.floor(Math.random() * 360);
    249    const s = Math.floor(Math.random() * 40) + 50; // 50-90
    250    const l = Math.floor(Math.random() * 30) + 40; // 40-70
    251    return createColorFromHsl(h, s, l);
    252  }
    

libs/yemaya/ui/src/components/ColorScriptTool/types.ts#

  • L16

    ts
    14   */
    15  export function generateSceneId(): string {
    16    return `scene_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    17  }
    18
    
  • L23

    ts
    21   */
    22  export function generateColorEntryId(): string {
    23    return `color_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    24  }
    25
    
  • L30

    ts
    28   */
    29  export function generateColorScriptId(): string {
    30    return `cscript_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    31  }
    32
    
  • L37

    ts
    35   */
    36  export function generateEmotionalBeatId(): string {
    37    return `beat_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    38  }
    39
    
  • L44

    ts
    42   */
    43  export function generateTransitionId(): string {
    44    return `trans_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    45  }
    46
    
  • L51

    ts
    49   */
    50  export function generateScenePaletteId(): string {
    51    return `spal_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    52  }
    53
    

libs/yemaya/ui/src/components/CustomTraitManager/types.ts#

  • L87

    ts
    85   */
    86  export function generateTraitDefinitionId(): string {
    87    return `custom-trait-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    88  }
    89
    
  • L94

    ts
    92   */
    93  export function generateLibraryId(): string {
    94    return `library-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    95  }
    96
    

libs/yemaya/ui/src/components/DialogueExampleEditor/types.ts#

  • L176

    ts
    174   */
    175  export function generateDialogueExampleId(): string {
    176    return `dialogue-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    177  }
    178
    

libs/yemaya/ui/src/components/EnvironmentConcepting/types.ts#

  • L16

    ts
    14   */
    15  export function generateEnvironmentId(): string {
    16    return `env-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    17  }
    18
    
  • L23

    ts
    21   */
    22  export function generateVanishingPointId(): string {
    23    return `vp-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    24  }
    25
    
  • L30

    ts
    28   */
    29  export function generatePerspectiveGuideSetId(): string {
    30    return `pgs-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    31  }
    32
    
  • L37

    ts
    35   */
    36  export function generateGuideLineId(): string {
    37    return `gl-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    38  }
    39
    
  • L1027

    ts
    1025   */
    1026  export function generateLayerId(): string {
    1027    return `layer-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    1028  }
    1029
    
  • L1034

    ts
    1032   */
    1033  export function generateLayerGroupId(): string {
    1034    return `group-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    1035  }
    1036
    
  • L1955

    ts
    1953   */
    1954  export function generateLightingMoodId(): string {
    1955    return `mood-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    1956  }
    1957
    
  • L1962

    ts
    1960   */
    1961  export function generateLightSourceId(): string {
    1962    return `light-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    1963  }
    1964
    
  • L3053

    ts
    3051   */
    3052  export function generateTimeKeyframeId(): string {
    3053    return `keyframe-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    3054  }
    3055
    
  • L3057

    ts
    3055
    3056  export function generateTimelineId(): string {
    3057    return `timeline-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    3058  }
    3059
    
  • L4264

    ts
    4262   */
    4263  export function generateStyleReferenceId(): string {
    4264    return `style-ref-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    4265  }
    4266
    
  • L4268

    ts
    4266
    4267  export function generateConsistencyCheckId(): string {
    4268    return `check-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    4269  }
    4270
    
  • L5062

    ts
    5060   */
    5061  export function generateStyleTransferId(): string {
    5062    return `transfer-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    5063  }
    5064
    
  • L5066

    ts
    5064
    5065  export function generateTransferPresetId(): string {
    5066    return `transfer-preset-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    5067  }
    5068
    
  • L5937

    ts
    5935   */
    5936  export function generateCalloutId(): string {
    5937    return `callout-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    5938  }
    5939
    
  • L5944

    ts
    5942   */
    5943  export function generateCalloutGroupId(): string {
    5944    return `callout-group-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    5945  }
    5946
    
  • L5951

    ts
    5949   */
    5950  export function generateMarkerId(): string {
    5951    return `marker-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    5952  }
    5953
    
  • L6550

    ts
    6548  ): CalloutLayer {
    6549    return {
    6550      id: `layer-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    6551      name,
    6552      visible: options.visible ?? true,
    
  • L6569

    ts
    6567  ): CalloutPreset {
    6568    return {
    6569      id: `preset-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    6570      name,
    6571      type,
    

libs/yemaya/ui/src/components/ImageOrganization/DragAndDrop.tsx#

  • L151

    ts
    149   */
    150  function generateDropId(): string {
    151    return `drop_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    152  }
    153
    

libs/yemaya/ui/src/components/ImageOrganization/types.ts#

  • L385

    ts
    383   */
    384  export function generateCollectionId(): string {
    385    return `col_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    386  }
    387
    
  • L392

    ts
    390   */
    391  export function generateImageId(): string {
    392    return `img_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    393  }
    394
    

libs/yemaya/ui/src/components/ImageSequenceExport/types.ts#

  • L482

    ts
    480   */
    481  export function generateExportId(prefix: string = 'export'): string {
    482    return `${prefix}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    483  }
    484
    

libs/yemaya/ui/src/components/ImageUpload/types.ts#

  • L110

    ts
    108   */
    109  export function generateImageId(): string {
    110    return `img-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    111  }
    112
    

libs/yemaya/ui/src/components/MultiTrack/types.ts#

  • L15

    ts
    13
    14  export function generateMultiTrackId(): MultiTrackId {
    15    return `mtrack_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as MultiTrackId;
    16  }
    17
    
  • L21

    ts
    19
    20  export function generateAudioClipId(): AudioClipId {
    21    return `aclip_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as AudioClipId;
    22  }
    23
    
  • L27

    ts
    25
    26  export function generateTrackGroupId(): TrackGroupId {
    27    return `tgroup_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as TrackGroupId;
    28  }
    29
    
  • L33

    ts
    31
    32  export function generateBusId(): BusId {
    33    return `bus_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as BusId;
    34  }
    35
    

libs/yemaya/ui/src/components/PanelGrid/types.ts#

  • L18

    ts
    16
    17  export function generatePanelId(): PanelId {
    18    return `panel_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as PanelId;
    19  }
    20
    
  • L22

    ts
    20
    21  export function generateTemplateId(): TemplateId {
    22    return `template_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as TemplateId;
    23  }
    24
    

libs/yemaya/ui/src/components/PropDesigner/types.ts#

  • L16

    ts
    14   */
    15  export function generateViewId(): string {
    16    return `view-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    17  }
    18
    
  • L23

    ts
    21   */
    22  export function generateTemplateId(): string {
    23    return `template-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    24  }
    25
    
  • L30

    ts
    28   */
    29  export function generateGuideId(): string {
    30    return `guide-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    31  }
    32
    
  • L37

    ts
    35   */
    36  export function generateDimensionId(): string {
    37    return `dim-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    38  }
    39
    
  • L1304

    ts
    1302   */
    1303  export function generateScaleReferenceId(): string {
    1304    return `scale-ref-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
    1305  }
    1306
    
  • L1803

    ts
    1801  ): ScaleReferenceLayer {
    1802    return {
    1803      id: `layer-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
    1804      name,
    1805      references,
    

libs/yemaya/ui/src/components/ReferenceOverlay/types.ts#

  • L15

    ts
    13
    14  export function generateReferenceId(): ReferenceId {
    15    return `ref_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as ReferenceId;
    16  }
    17
    

libs/yemaya/ui/src/components/SchedulingEngine/types.ts#

  • L642

    ts
    640  export function generateId(prefix = 'id'): string {
    641    const timestamp = Date.now().toString(36);
    642    const random = Math.random().toString(36).substring(2, 9);
    643    return `${prefix}_${timestamp}_${random}`;
    644  }
    

libs/yemaya/ui/src/components/ScratchRecording/types.ts#

  • L15

    ts
    13
    14  export function generateRecordingId(): RecordingId {
    15    return `rec_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as RecordingId;
    16  }
    17
    
  • L21

    ts
    19
    20  export function generateTrackId(): TrackId {
    21    return `track_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as TrackId;
    22  }
    23
    
  • L281

    ts
    279  ): TrackSegment {
    280    return {
    281      id: `seg_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
    282      recordingId,
    283      startTime,
    

libs/yemaya/ui/src/components/StructureBuilder/StructureBuilder.tsx#

  • L67

    ts
    65   */
    66  function generateId(): string {
    67    return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    68  }
    69
    

libs/yemaya/ui/src/components/StyleTransfer/types.ts#

  • L15

    ts
    13
    14  export function generateStyleId(): StyleId {
    15    return `style_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as StyleId;
    16  }
    17
    
  • L21

    ts
    19
    20  export function generateStylePresetId(): StylePresetId {
    21    return `preset_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as StylePresetId;
    22  }
    23
    

libs/yemaya/ui/src/components/TimelineEditor/types.ts#

  • L19

    ts
    17
    18  export function generateClipId(): ClipId {
    19    return `clip_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as ClipId;
    20  }
    21
    
  • L23

    ts
    21
    22  export function generateTrackId(): TrackId {
    23    return `track_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as TrackId;
    24  }
    25
    
  • L27

    ts
    25
    26  export function generateMarkerId(): MarkerId {
    27    return `marker_${Date.now()}_${Math.random().toString(36).substring(2, 9)}` as MarkerId;
    28  }
    29
    

libs/yemaya/ui/src/components/TimingEditor/types.ts#

  • L564

    ts
    562  ): TrackGroup {
    563    return {
    564      id: `group-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
    565      name,
    566      trackIds,
    

libs/yemaya/ui/src/components/Toast.tsx#

  • L144

    ts
    142    const toast = useCallback(
    143      (data: ToastData) => {
    144        const id = data.id || Math.random().toString(36).substring(2, 9);
    145        const newToast = { ...data, id, duration: data.duration ?? duration };
    146
    

libs/yemaya/ui/src/components/TraitSelector/types.ts#

  • L80

    ts
    78   */
    79  export function generateTraitId(): string {
    80    return `trait-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    81  }
    82
    

libs/yemaya/ui/src/components/XMLExport/types.ts#

  • L533

    ts
    531   */
    532  export function generateId(prefix: string = 'id'): string {
    533    return `${prefix}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    534  }
    535
    
  • L541

    ts
    539  export function generateUUID(): string {
    540    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    541      const r = (Math.random() * 16) | 0;
    542      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    543      return v.toString(16);
    

libs/yemaya/video-generation/src/generation-engine/generation-engine.ts#

  • L945

    ts
    943
    944    for (let i = 0; i < safeCount; i++) {
    945      const seed = request.seed !== null ? request.seed + i : Math.floor(Math.random() * 2147483647);
    946
    947      variations.push({
    

libs/yemaya/video-generation/src/provider-router/provider-router.ts#

  • L640

    ts
    638      steps: request.steps,
    639      guidance_scale: request.guidanceScale,
    640      seed: request.seed ?? Math.floor(Math.random() * 2147483647),
    641      aspect_ratio: request.aspectRatio,
    642    };
    
  • L746

    ts
    744    if (!jitter) return Math.round(exponential);
    745    // Full jitter: random value between 0 and exponential
    746    const jitterValue = Math.random() * exponential;
    747    return Math.round(jitterValue);
    748  }
    
  • L1131

    ts
    1129
    1130      // Generate a provider-side job ID
    1131      const providerJobId = `pjob_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    1132      const now = Date.now();
    1133
    
  • L1324

    ts
    1322      // Create a new job on the alternative provider
    1323      const newJobId = createVideoJobId();
    1324      const providerJobId = `pjob_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
    1325      const now = Date.now();
    1326      const selectedHealth = this.healthMap.get(selected.id) ?? initProviderHealth(selected.id);
    

libs/yemaya/video-generation/src/video-factory/video-factory.ts#

  • L1718

    ts
    1716    const bitrate = estimateOutputBitrate(width, height, fps);
    1717    const sizeBytes = Math.round((bitrate * durationSeconds) / 8);
    1718    const seed = genRequest.seed ?? Math.floor(Math.random() * 2147483647);
    1719
    1720    const metadata: VideoMetadata = {
    

minerva/minerva/multimedia/diagram_runtime.py#

  • L170

    py
    168              return existing;
    169          }
    170          const generated = "diagram-" + Math.random().toString(36).slice(2, 10);
    171          diagram.dataset.diagramId = generated;
    172          return generated;
    

scripts/lilith/comprehensive-todos-implementation.ts#

  • L687

    ts
    685        topic,
    686        opinion: \`Agent \${agent.name} analysis of \${topic}\`,
    687        confidence: Math.random() * 0.3 + 0.7, // 70-100% confidence
    688        timestamp: Date.now()
    689      };
    
  • L1143

    ts
    1141          healthy: true,
    1142          port: service.port,
    1143          responseTime: Math.floor(Math.random() * 100) + 50
    1144        };
    1145      } catch (error) {
    

scripts/lilith/master-automation-controller.ts#

  • L31

    ts
    29            system: system.name,
    30            success: true,
    31            executionTime: Math.random() * 5000 + 1000,
    32            output: `${system.name} completed successfully`
    33          };
    

scripts/lilith/performance/run-load-profile.ts#

  • L296

    ts
    294        totalFailures += Math.ceil(simulatedCount * 0.005);
    295        for (let i = 0; i < simulatedCount; i++) {
    296          latencies.push(simulatedLatency * (0.8 + Math.random() * 0.4));
    297        }
    298        await delay(5); // keep the event loop responsive during dry-run
    

scripts/lilith/quality-gates-pipeline.ts#

  • L841

    ts
    839      let iterations = 0;
    840      while (Date.now() - cpuStart < 100) { // 100ms benchmark
    841        Math.random() * Math.random();
    842        iterations++;
    843      }
    
  • L854

    ts
    852      // Memory allocation benchmark
    853      const memStart = process.memoryUsage().heapUsed;
    854      const testArray = new Array(100000).fill(0).map(() => Math.random());
    855      const memEnd = process.memoryUsage().heapUsed;
    856      const memUsed = (memEnd - memStart) / 1024 / 1024;
    

scripts/lilith/seed-databases.ts#

  • L138

    ts
    136          email: `user${i}@example.com`,
    137          email_hash: crypto.createHash('sha256').update(`user${i}@example.com`).digest('hex'),
    138          created_at: new Date(Date.now() - Math.random() * 90 * 24 * 60 * 60 * 1000).toISOString(),
    139          profile: {
    140            display_name: `Test User ${i}`,
    
  • L141

    ts
    139          profile: {
    140            display_name: `Test User ${i}`,
    141            preferred_locale: locales[Math.floor(Math.random() * locales.length)],
    142            timezone: 'UTC',
    143            preferred_persona: personas[Math.floor(Math.random() * personas.length)],
    
  • L143

    ts
    141            preferred_locale: locales[Math.floor(Math.random() * locales.length)],
    142            timezone: 'UTC',
    143            preferred_persona: personas[Math.floor(Math.random() * personas.length)],
    144            accessibility_preferences: {
    145              screen_reader: Math.random() > 0.9,
    
  • L145

    ts
    143            preferred_persona: personas[Math.floor(Math.random() * personas.length)],
    144            accessibility_preferences: {
    145              screen_reader: Math.random() > 0.9,
    146              high_contrast: Math.random() > 0.8,
    147              reduced_motion: Math.random() > 0.85
    
  • L146

    ts
    144            accessibility_preferences: {
    145              screen_reader: Math.random() > 0.9,
    146              high_contrast: Math.random() > 0.8,
    147              reduced_motion: Math.random() > 0.85
    148            },
    
  • L147

    ts
    145              screen_reader: Math.random() > 0.9,
    146              high_contrast: Math.random() > 0.8,
    147              reduced_motion: Math.random() > 0.85
    148            },
    149            notification_preferences: {
    
  • L150

    ts
    148            },
    149            notification_preferences: {
    150              push_enabled: Math.random() > 0.3,
    151              email_enabled: Math.random() > 0.2,
    152              quiet_hours: {
    
  • L151

    ts
    149            notification_preferences: {
    150              push_enabled: Math.random() > 0.3,
    151              email_enabled: Math.random() > 0.2,
    152              quiet_hours: {
    153                start: '22:00',
    
  • L159

    ts
    157          },
    158          subscription: {
    159            tier: Math.random() > 0.7 ? 'premium' : 'free',
    160            expires_at: Math.random() > 0.7 ? new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toISOString() : null
    161          },
    
  • L160

    ts
    158          subscription: {
    159            tier: Math.random() > 0.7 ? 'premium' : 'free',
    160            expires_at: Math.random() > 0.7 ? new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toISOString() : null
    161          },
    162          usage_stats: {
    
  • L163

    ts
    161          },
    162          usage_stats: {
    163            total_sessions: Math.floor(Math.random() * 100),
    164            total_messages: Math.floor(Math.random() * 500),
    165            total_audio_minutes: Math.floor(Math.random() * 1000),
    
  • L164

    ts
    162          usage_stats: {
    163            total_sessions: Math.floor(Math.random() * 100),
    164            total_messages: Math.floor(Math.random() * 500),
    165            total_audio_minutes: Math.floor(Math.random() * 1000),
    166            last_active: new Date(Date.now() - Math.random() * 7 * 24 * 60 * 60 * 1000).toISOString()
    
  • L165

    ts
    163            total_sessions: Math.floor(Math.random() * 100),
    164            total_messages: Math.floor(Math.random() * 500),
    165            total_audio_minutes: Math.floor(Math.random() * 1000),
    166            last_active: new Date(Date.now() - Math.random() * 7 * 24 * 60 * 60 * 1000).toISOString()
    167          }
    
  • L166

    ts
    164            total_messages: Math.floor(Math.random() * 500),
    165            total_audio_minutes: Math.floor(Math.random() * 1000),
    166            last_active: new Date(Date.now() - Math.random() * 7 * 24 * 60 * 60 * 1000).toISOString()
    167          }
    168        });
    
  • L184

    ts
    182          id: `content_${i.toString().padStart(3, '0')}`,
    183          title: `Sample Content ${i}`,
    184          tradition: traditions[Math.floor(Math.random() * traditions.length)],
    185          content_type: contentTypes[Math.floor(Math.random() * contentTypes.length)],
    186          language: languages[Math.floor(Math.random() * languages.length)],
    
  • L185

    ts
    183          title: `Sample Content ${i}`,
    184          tradition: traditions[Math.floor(Math.random() * traditions.length)],
    185          content_type: contentTypes[Math.floor(Math.random() * contentTypes.length)],
    186          language: languages[Math.floor(Math.random() * languages.length)],
    187          status: Math.random() > 0.1 ? 'published' : 'draft',
    
  • L186

    ts
    184          tradition: traditions[Math.floor(Math.random() * traditions.length)],
    185          content_type: contentTypes[Math.floor(Math.random() * contentTypes.length)],
    186          language: languages[Math.floor(Math.random() * languages.length)],
    187          status: Math.random() > 0.1 ? 'published' : 'draft',
    188          created_at: new Date(Date.now() - Math.random() * 180 * 24 * 60 * 60 * 1000).toISOString(),
    
  • L187

    ts
    185          content_type: contentTypes[Math.floor(Math.random() * contentTypes.length)],
    186          language: languages[Math.floor(Math.random() * languages.length)],
    187          status: Math.random() > 0.1 ? 'published' : 'draft',
    188          created_at: new Date(Date.now() - Math.random() * 180 * 24 * 60 * 60 * 1000).toISOString(),
    189          updated_at: new Date(Date.now() - Math.random() * 30 * 24 * 60 * 60 * 1000).toISOString(),
    
  • L188

    ts
    186          language: languages[Math.floor(Math.random() * languages.length)],
    187          status: Math.random() > 0.1 ? 'published' : 'draft',
    188          created_at: new Date(Date.now() - Math.random() * 180 * 24 * 60 * 60 * 1000).toISOString(),
    189          updated_at: new Date(Date.now() - Math.random() * 30 * 24 * 60 * 60 * 1000).toISOString(),
    190          metadata: {
    
  • L189

    ts
    187          status: Math.random() > 0.1 ? 'published' : 'draft',
    188          created_at: new Date(Date.now() - Math.random() * 180 * 24 * 60 * 60 * 1000).toISOString(),
    189          updated_at: new Date(Date.now() - Math.random() * 30 * 24 * 60 * 60 * 1000).toISOString(),
    190          metadata: {
    191            duration_minutes: Math.floor(Math.random() * 60) + 5,
    
  • L191

    ts
    189          updated_at: new Date(Date.now() - Math.random() * 30 * 24 * 60 * 60 * 1000).toISOString(),
    190          metadata: {
    191            duration_minutes: Math.floor(Math.random() * 60) + 5,
    192            difficulty_level: Math.floor(Math.random() * 5) + 1,
    193            tags: ['mindfulness', 'wisdom', 'philosophy'].slice(0, Math.floor(Math.random() * 3) + 1),
    
  • L192

    ts
    190          metadata: {
    191            duration_minutes: Math.floor(Math.random() * 60) + 5,
    192            difficulty_level: Math.floor(Math.random() * 5) + 1,
    193            tags: ['mindfulness', 'wisdom', 'philosophy'].slice(0, Math.floor(Math.random() * 3) + 1),
    194            author: `Author ${Math.floor(Math.random() * 10) + 1}`,
    
  • L193

    ts
    191            duration_minutes: Math.floor(Math.random() * 60) + 5,
    192            difficulty_level: Math.floor(Math.random() * 5) + 1,
    193            tags: ['mindfulness', 'wisdom', 'philosophy'].slice(0, Math.floor(Math.random() * 3) + 1),
    194            author: `Author ${Math.floor(Math.random() * 10) + 1}`,
    195            description: `Description for sample content ${i}`,
    
  • L194

    ts
    192            difficulty_level: Math.floor(Math.random() * 5) + 1,
    193            tags: ['mindfulness', 'wisdom', 'philosophy'].slice(0, Math.floor(Math.random() * 3) + 1),
    194            author: `Author ${Math.floor(Math.random() * 10) + 1}`,
    195            description: `Description for sample content ${i}`,
    196            transcript_available: Math.random() > 0.3,
    
  • L196

    ts
    194            author: `Author ${Math.floor(Math.random() * 10) + 1}`,
    195            description: `Description for sample content ${i}`,
    196            transcript_available: Math.random() > 0.3,
    197            audio_available: Math.random() > 0.2
    198          },
    
  • L197

    ts
    195            description: `Description for sample content ${i}`,
    196            transcript_available: Math.random() > 0.3,
    197            audio_available: Math.random() > 0.2
    198          },
    199          content_text: `This is sample content ${i} for the ${traditions[Math.floor(Math.random() * traditions.length)]} tradition. It contains wisdom and guidance for personal development and spiritual growth.`,
    
  • L199

    ts
    197            audio_available: Math.random() > 0.2
    198          },
    199          content_text: `This is sample content ${i} for the ${traditions[Math.floor(Math.random() * traditions.length)]} tradition. It contains wisdom and guidance for personal development and spiritual growth.`,
    200          embedding_vector: Array.from({ length: 384 }, () => Math.random() - 0.5)
    201        });
    
  • L200

    ts
    198          },
    199          content_text: `This is sample content ${i} for the ${traditions[Math.floor(Math.random() * traditions.length)]} tradition. It contains wisdom and guidance for personal development and spiritual growth.`,
    200          embedding_vector: Array.from({ length: 384 }, () => Math.random() - 0.5)
    201        });
    202      }
    
  • L212

    ts
    210
    211      for (let i = 1; i <= 200; i++) {
    212        const userId = userIds[Math.floor(Math.random() * userIds.length)];
    213        const messageCount = Math.floor(Math.random() * 20) + 1;
    214
    
  • L213

    ts
    211      for (let i = 1; i <= 200; i++) {
    212        const userId = userIds[Math.floor(Math.random() * userIds.length)];
    213        const messageCount = Math.floor(Math.random() * 20) + 1;
    214
    215        conversations.push({
    
  • L219

    ts
    217          user_id: userId,
    218          title: `Conversation ${i}`,
    219          created_at: new Date(Date.now() - Math.random() * 60 * 24 * 60 * 60 * 1000).toISOString(),
    220          updated_at: new Date(Date.now() - Math.random() * 7 * 24 * 60 * 60 * 1000).toISOString(),
    221          message_count: messageCount,
    
  • L220

    ts
    218          title: `Conversation ${i}`,
    219          created_at: new Date(Date.now() - Math.random() * 60 * 24 * 60 * 60 * 1000).toISOString(),
    220          updated_at: new Date(Date.now() - Math.random() * 7 * 24 * 60 * 60 * 1000).toISOString(),
    221          message_count: messageCount,
    222          persona: ['zen', 'stoic', 'sufi'][Math.floor(Math.random() * 3)],
    
  • L222

    ts
    220          updated_at: new Date(Date.now() - Math.random() * 7 * 24 * 60 * 60 * 1000).toISOString(),
    221          message_count: messageCount,
    222          persona: ['zen', 'stoic', 'sufi'][Math.floor(Math.random() * 3)],
    223          status: 'active',
    224          metadata: {
    
  • L225

    ts
    223          status: 'active',
    224          metadata: {
    225            language: ['en', 'es', 'zh-CN', 'ar', 'fr'][Math.floor(Math.random() * 5)],
    226            context_length: Math.floor(Math.random() * 4000) + 1000,
    227            total_tokens: Math.floor(Math.random() * 10000) + 2000,
    
  • L226

    ts
    224          metadata: {
    225            language: ['en', 'es', 'zh-CN', 'ar', 'fr'][Math.floor(Math.random() * 5)],
    226            context_length: Math.floor(Math.random() * 4000) + 1000,
    227            total_tokens: Math.floor(Math.random() * 10000) + 2000,
    228            audio_enabled: Math.random() > 0.4,
    
  • L227

    ts
    225            language: ['en', 'es', 'zh-CN', 'ar', 'fr'][Math.floor(Math.random() * 5)],
    226            context_length: Math.floor(Math.random() * 4000) + 1000,
    227            total_tokens: Math.floor(Math.random() * 10000) + 2000,
    228            audio_enabled: Math.random() > 0.4,
    229            citations_count: Math.floor(Math.random() * 10)
    
  • L228

    ts
    226            context_length: Math.floor(Math.random() * 4000) + 1000,
    227            total_tokens: Math.floor(Math.random() * 10000) + 2000,
    228            audio_enabled: Math.random() > 0.4,
    229            citations_count: Math.floor(Math.random() * 10)
    230          }
    
  • L229

    ts
    227            total_tokens: Math.floor(Math.random() * 10000) + 2000,
    228            audio_enabled: Math.random() > 0.4,
    229            citations_count: Math.floor(Math.random() * 10)
    230          }
    231        });
    
  • L245

    ts
    243        media.push({
    244          id: `media_${i.toString().padStart(3, '0')}`,
    245          content_id: contentIds[Math.floor(Math.random() * contentIds.length)],
    246          file_path: `/media/audio/${i.toString().padStart(3, '0')}.${formats[Math.floor(Math.random() * formats.length)]}`,
    247          file_size_bytes: Math.floor(Math.random() * 50000000) + 1000000, // 1-50MB
    
  • L246

    ts
    244          id: `media_${i.toString().padStart(3, '0')}`,
    245          content_id: contentIds[Math.floor(Math.random() * contentIds.length)],
    246          file_path: `/media/audio/${i.toString().padStart(3, '0')}.${formats[Math.floor(Math.random() * formats.length)]}`,
    247          file_size_bytes: Math.floor(Math.random() * 50000000) + 1000000, // 1-50MB
    248          duration_seconds: Math.floor(Math.random() * 3600) + 60, // 1min - 1hour
    
  • L247

    ts
    245          content_id: contentIds[Math.floor(Math.random() * contentIds.length)],
    246          file_path: `/media/audio/${i.toString().padStart(3, '0')}.${formats[Math.floor(Math.random() * formats.length)]}`,
    247          file_size_bytes: Math.floor(Math.random() * 50000000) + 1000000, // 1-50MB
    248          duration_seconds: Math.floor(Math.random() * 3600) + 60, // 1min - 1hour
    249          format: formats[Math.floor(Math.random() * formats.length)],
    
  • L248

    ts
    246          file_path: `/media/audio/${i.toString().padStart(3, '0')}.${formats[Math.floor(Math.random() * formats.length)]}`,
    247          file_size_bytes: Math.floor(Math.random() * 50000000) + 1000000, // 1-50MB
    248          duration_seconds: Math.floor(Math.random() * 3600) + 60, // 1min - 1hour
    249          format: formats[Math.floor(Math.random() * formats.length)],
    250          quality: ['standard', 'high', 'premium'][Math.floor(Math.random() * 3)],
    
  • L249

    ts
    247          file_size_bytes: Math.floor(Math.random() * 50000000) + 1000000, // 1-50MB
    248          duration_seconds: Math.floor(Math.random() * 3600) + 60, // 1min - 1hour
    249          format: formats[Math.floor(Math.random() * formats.length)],
    250          quality: ['standard', 'high', 'premium'][Math.floor(Math.random() * 3)],
    251          created_at: new Date(Date.now() - Math.random() * 90 * 24 * 60 * 60 * 1000).toISOString(),
    
  • L250

    ts
    248          duration_seconds: Math.floor(Math.random() * 3600) + 60, // 1min - 1hour
    249          format: formats[Math.floor(Math.random() * formats.length)],
    250          quality: ['standard', 'high', 'premium'][Math.floor(Math.random() * 3)],
    251          created_at: new Date(Date.now() - Math.random() * 90 * 24 * 60 * 60 * 1000).toISOString(),
    252          metadata: {
    
  • L251

    ts
    249          format: formats[Math.floor(Math.random() * formats.length)],
    250          quality: ['standard', 'high', 'premium'][Math.floor(Math.random() * 3)],
    251          created_at: new Date(Date.now() - Math.random() * 90 * 24 * 60 * 60 * 1000).toISOString(),
    252          metadata: {
    253            bitrate: Math.floor(Math.random() * 320) + 64,
    
  • L253

    ts
    251          created_at: new Date(Date.now() - Math.random() * 90 * 24 * 60 * 60 * 1000).toISOString(),
    252          metadata: {
    253            bitrate: Math.floor(Math.random() * 320) + 64,
    254            sample_rate: [22050, 44100, 48000][Math.floor(Math.random() * 3)],
    255            channels: Math.random() > 0.5 ? 'stereo' : 'mono',
    
  • L254

    ts
    252          metadata: {
    253            bitrate: Math.floor(Math.random() * 320) + 64,
    254            sample_rate: [22050, 44100, 48000][Math.floor(Math.random() * 3)],
    255            channels: Math.random() > 0.5 ? 'stereo' : 'mono',
    256            codec: ['aac', 'mp3', 'opus'][Math.floor(Math.random() * 3)],
    
  • L255

    ts
    253            bitrate: Math.floor(Math.random() * 320) + 64,
    254            sample_rate: [22050, 44100, 48000][Math.floor(Math.random() * 3)],
    255            channels: Math.random() > 0.5 ? 'stereo' : 'mono',
    256            codec: ['aac', 'mp3', 'opus'][Math.floor(Math.random() * 3)],
    257            processing_status: 'completed',
    
  • L256

    ts
    254            sample_rate: [22050, 44100, 48000][Math.floor(Math.random() * 3)],
    255            channels: Math.random() > 0.5 ? 'stereo' : 'mono',
    256            codec: ['aac', 'mp3', 'opus'][Math.floor(Math.random() * 3)],
    257            processing_status: 'completed',
    258            waveform_generated: Math.random() > 0.2,
    
  • L258

    ts
    256            codec: ['aac', 'mp3', 'opus'][Math.floor(Math.random() * 3)],
    257            processing_status: 'completed',
    258            waveform_generated: Math.random() > 0.2,
    259            transcript_extracted: Math.random() > 0.3
    260          }
    
  • L259

    ts
    257            processing_status: 'completed',
    258            waveform_generated: Math.random() > 0.2,
    259            transcript_extracted: Math.random() > 0.3
    260          }
    261        });
    
  • L280

    ts
    278          id: `entity_${i.toString().padStart(3, '0')}`,
    279          name: `Entity ${i}`,
    280          type: entityTypes[Math.floor(Math.random() * entityTypes.length)],
    281          tradition: ['zen', 'stoic', 'sufi', 'general'][Math.floor(Math.random() * 4)],
    282          description: `Description for entity ${i}`,
    
  • L281

    ts
    279          name: `Entity ${i}`,
    280          type: entityTypes[Math.floor(Math.random() * entityTypes.length)],
    281          tradition: ['zen', 'stoic', 'sufi', 'general'][Math.floor(Math.random() * 4)],
    282          description: `Description for entity ${i}`,
    283          properties: {
    
  • L284

    ts
    282          description: `Description for entity ${i}`,
    283          properties: {
    284            importance_score: Math.random(),
    285            frequency_mentioned: Math.floor(Math.random() * 100),
    286            verified: Math.random() > 0.2
    
  • L285

    ts
    283          properties: {
    284            importance_score: Math.random(),
    285            frequency_mentioned: Math.floor(Math.random() * 100),
    286            verified: Math.random() > 0.2
    287          },
    
  • L286

    ts
    284            importance_score: Math.random(),
    285            frequency_mentioned: Math.floor(Math.random() * 100),
    286            verified: Math.random() > 0.2
    287          },
    288          created_at: new Date(Date.now() - Math.random() * 365 * 24 * 60 * 60 * 1000).toISOString()
    
  • L288

    ts
    286            verified: Math.random() > 0.2
    287          },
    288          created_at: new Date(Date.now() - Math.random() * 365 * 24 * 60 * 60 * 1000).toISOString()
    289        });
    290      }
    
  • L294

    ts
    292      // Generate relationships
    293      for (let i = 1; i <= 300; i++) {
    294        const fromEntity = Math.floor(Math.random() * 200) + 1;
    295        const toEntity = Math.floor(Math.random() * 200) + 1;
    296
    
  • L295

    ts
    293      for (let i = 1; i <= 300; i++) {
    294        const fromEntity = Math.floor(Math.random() * 200) + 1;
    295        const toEntity = Math.floor(Math.random() * 200) + 1;
    296
    297        if (fromEntity !== toEntity) {
    
  • L302

    ts
    300            from_entity_id: `entity_${fromEntity.toString().padStart(3, '0')}`,
    301            to_entity_id: `entity_${toEntity.toString().padStart(3, '0')}`,
    302            relationship_type: ['teaches', 'influences', 'practices', 'references'][Math.floor(Math.random() * 4)],
    303            strength: Math.random(),
    304            verified: Math.random() > 0.3,
    
  • L303

    ts
    301            to_entity_id: `entity_${toEntity.toString().padStart(3, '0')}`,
    302            relationship_type: ['teaches', 'influences', 'practices', 'references'][Math.floor(Math.random() * 4)],
    303            strength: Math.random(),
    304            verified: Math.random() > 0.3,
    305            created_at: new Date(Date.now() - Math.random() * 180 * 24 * 60 * 60 * 1000).toISOString()
    
  • L304

    ts
    302            relationship_type: ['teaches', 'influences', 'practices', 'references'][Math.floor(Math.random() * 4)],
    303            strength: Math.random(),
    304            verified: Math.random() > 0.3,
    305            created_at: new Date(Date.now() - Math.random() * 180 * 24 * 60 * 60 * 1000).toISOString()
    306          });
    
  • L305

    ts
    303            strength: Math.random(),
    304            verified: Math.random() > 0.3,
    305            created_at: new Date(Date.now() - Math.random() * 180 * 24 * 60 * 60 * 1000).toISOString()
    306          });
    307        }
    
  • L315

    ts
    313          id: `concept_${i.toString().padStart(3, '0')}`,
    314          name: `Concept ${i}`,
    315          tradition: ['zen', 'stoic', 'sufi'][Math.floor(Math.random() * 3)],
    316          description: `Description for concept ${i}`,
    317          semantic_vector: Array.from({ length: 384 }, () => Math.random() - 0.5),
    
  • L317

    ts
    315          tradition: ['zen', 'stoic', 'sufi'][Math.floor(Math.random() * 3)],
    316          description: `Description for concept ${i}`,
    317          semantic_vector: Array.from({ length: 384 }, () => Math.random() - 0.5),
    318          related_content_ids: Array.from(
    319            { length: Math.floor(Math.random() * 5) + 1 },
    
  • L319

    ts
    317          semantic_vector: Array.from({ length: 384 }, () => Math.random() - 0.5),
    318          related_content_ids: Array.from(
    319            { length: Math.floor(Math.random() * 5) + 1 },
    320            () => `content_${(Math.floor(Math.random() * 100) + 1).toString().padStart(3, '0')}`
    321          ),
    
  • L320

    ts
    318          related_content_ids: Array.from(
    319            { length: Math.floor(Math.random() * 5) + 1 },
    320            () => `content_${(Math.floor(Math.random() * 100) + 1).toString().padStart(3, '0')}`
    321          ),
    322          metadata: {
    
  • L323

    ts
    321          ),
    322          metadata: {
    323            complexity_level: Math.floor(Math.random() * 5) + 1,
    324            practical_applications: Math.floor(Math.random() * 10),
    325            scholarly_references: Math.floor(Math.random() * 20)
    
  • L324

    ts
    322          metadata: {
    323            complexity_level: Math.floor(Math.random() * 5) + 1,
    324            practical_applications: Math.floor(Math.random() * 10),
    325            scholarly_references: Math.floor(Math.random() * 20)
    326          }
    
  • L325

    ts
    323            complexity_level: Math.floor(Math.random() * 5) + 1,
    324            practical_applications: Math.floor(Math.random() * 10),
    325            scholarly_references: Math.floor(Math.random() * 20)
    326          }
    327        });
    
  • L575

    ts
    573        // Seed session data
    574        for (let i = 1; i <= 100; i++) {
    575          const userId = `user_${Math.floor(Math.random() * 50 + 1).toString().padStart(3, '0')}`;
    576          const sessionData = {
    577            user_id: userId,
    
  • L580

    ts
    578            created_at: new Date().toISOString(),
    579            last_activity: new Date().toISOString(),
    580            persona: ['zen', 'stoic', 'sufi'][Math.floor(Math.random() * 3)],
    581            preferences: {
    582              audio_enabled: Math.random() > 0.3,
    
  • L582

    ts
    580            persona: ['zen', 'stoic', 'sufi'][Math.floor(Math.random() * 3)],
    581            preferences: {
    582              audio_enabled: Math.random() > 0.3,
    583              language: ['en', 'es', 'zh-CN', 'ar', 'fr'][Math.floor(Math.random() * 5)]
    584            }
    
  • L583

    ts
    581            preferences: {
    582              audio_enabled: Math.random() > 0.3,
    583              language: ['en', 'es', 'zh-CN', 'ar', 'fr'][Math.floor(Math.random() * 5)]
    584            }
    585          };
    
  • L598

    ts
    596        for (const conversation of this.seedData.conversations.slice(0, 50)) {
    597          await client.setEx(`context:${conversation.id}`, 7200, JSON.stringify({
    598            messages: Math.floor(Math.random() * 20) + 1,
    599            tokens: Math.floor(Math.random() * 4000) + 1000,
    600            last_update: new Date().toISOString()
    
  • L599

    ts
    597          await client.setEx(`context:${conversation.id}`, 7200, JSON.stringify({
    598            messages: Math.floor(Math.random() * 20) + 1,
    599            tokens: Math.floor(Math.random() * 4000) + 1000,
    600            last_update: new Date().toISOString()
    601          }));
    
  • L787

    ts
    785            index: 'audit_logs',
    786            body: {
    787              timestamp: new Date(Date.now() - Math.random() * 30 * 24 * 60 * 60 * 1000).toISOString(),
    788              service: ['auth', 'content', 'conversation', 'media'][Math.floor(Math.random() * 4)],
    789              action: ['create', 'read', 'update', 'delete'][Math.floor(Math.random() * 4)],
    
  • L788

    ts
    786            body: {
    787              timestamp: new Date(Date.now() - Math.random() * 30 * 24 * 60 * 60 * 1000).toISOString(),
    788              service: ['auth', 'content', 'conversation', 'media'][Math.floor(Math.random() * 4)],
    789              action: ['create', 'read', 'update', 'delete'][Math.floor(Math.random() * 4)],
    790              user_id: `user_${Math.floor(Math.random() * 50 + 1).toString().padStart(3, '0')}`,
    
  • L789

    ts
    787              timestamp: new Date(Date.now() - Math.random() * 30 * 24 * 60 * 60 * 1000).toISOString(),
    788              service: ['auth', 'content', 'conversation', 'media'][Math.floor(Math.random() * 4)],
    789              action: ['create', 'read', 'update', 'delete'][Math.floor(Math.random() * 4)],
    790              user_id: `user_${Math.floor(Math.random() * 50 + 1).toString().padStart(3, '0')}`,
    791              resource_type: ['user', 'content', 'conversation', 'media'][Math.floor(Math.random() * 4)],
    
  • L790

    ts
    788              service: ['auth', 'content', 'conversation', 'media'][Math.floor(Math.random() * 4)],
    789              action: ['create', 'read', 'update', 'delete'][Math.floor(Math.random() * 4)],
    790              user_id: `user_${Math.floor(Math.random() * 50 + 1).toString().padStart(3, '0')}`,
    791              resource_type: ['user', 'content', 'conversation', 'media'][Math.floor(Math.random() * 4)],
    792              success: Math.random() > 0.1,
    
  • L791

    ts
    789              action: ['create', 'read', 'update', 'delete'][Math.floor(Math.random() * 4)],
    790              user_id: `user_${Math.floor(Math.random() * 50 + 1).toString().padStart(3, '0')}`,
    791              resource_type: ['user', 'content', 'conversation', 'media'][Math.floor(Math.random() * 4)],
    792              success: Math.random() > 0.1,
    793              ip_address: `192.168.1.${Math.floor(Math.random() * 254) + 1}`,
    
  • L792

    ts
    790              user_id: `user_${Math.floor(Math.random() * 50 + 1).toString().padStart(3, '0')}`,
    791              resource_type: ['user', 'content', 'conversation', 'media'][Math.floor(Math.random() * 4)],
    792              success: Math.random() > 0.1,
    793              ip_address: `192.168.1.${Math.floor(Math.random() * 254) + 1}`,
    794              user_agent: 'Lilith-Client/1.0'
    
  • L793

    ts
    791              resource_type: ['user', 'content', 'conversation', 'media'][Math.floor(Math.random() * 4)],
    792              success: Math.random() > 0.1,
    793              ip_address: `192.168.1.${Math.floor(Math.random() * 254) + 1}`,
    794              user_agent: 'Lilith-Client/1.0'
    795            }
    

scripts/lilith/service-orchestrator.ts#

  • L76

    ts
    74          healthy: true,
    75          port: service.port,
    76          responseTime: Math.floor(Math.random() * 100) + 50
    77        };
    78      } catch (error) {
    

scripts/lilith/test-result-reporter.ts#

  • L88

    ts
    86
    87  function generateRunId(): string {
    88    return `run-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    89  }
    90
    

scripts/lilith/todos-compliance-enforcer.ts#

  • L431

    ts
    429
    430    generateId() {
    431      return 'user_' + Math.random().toString(36).substr(2, 9);
    432    }
    433
    

scripts/lilith/todos-final-implementation.ts#

  • L945

    ts
    943            system: system.name,
    944            success: true,
    945            executionTime: Math.random() * 5000 + 1000,
    946            output: \`\${system.name} completed successfully\`
    947          };
    

serwaa/services/admin-dashboard/src/app/dashboard/knowledge/sources/new/page.tsx#

  • L44

    ts
    42
    43        // Generate a mock source ID
    44        const sourceId = `src_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
    45        setCreatedSourceId(sourceId);
    46        setCreateState('success');
    

serwaa/services/admin-dashboard/src/app/dashboard/knowledge/upload/page.tsx#

  • L65

    ts
    63      onProgress(i);
    64    }
    65    return { documentId: `doc_${Date.now()}_${Math.random().toString(36).substr(2, 9)}` };
    66  }
    67
    
  • L93

    ts
    91          status === 'ready'
    92            ? {
    93                chunksCreated: Math.floor(Math.random() * 50) + 10,
    94                embeddingsGenerated: Math.floor(Math.random() * 50) + 10,
    95                processingTimeMs: Math.floor(Math.random() * 5000) + 2000,
    
  • L94

    ts
    92            ? {
    93                chunksCreated: Math.floor(Math.random() * 50) + 10,
    94                embeddingsGenerated: Math.floor(Math.random() * 50) + 10,
    95                processingTimeMs: Math.floor(Math.random() * 5000) + 2000,
    96              }
    
  • L95

    ts
    93                chunksCreated: Math.floor(Math.random() * 50) + 10,
    94                embeddingsGenerated: Math.floor(Math.random() * 50) + 10,
    95                processingTimeMs: Math.floor(Math.random() * 5000) + 2000,
    96              }
    97            : undefined,
    
  • L117

    ts
    115      // Initialize upload progress for all files
    116      const initialProgress: UploadProgress[] = data.files.map((file) => ({
    117        fileId: `file_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
    118        fileName: file.name,
    119        progress: 0,
    

serwaa/services/admin-dashboard/src/components/forms/persona/avatar-form.tsx#

  • L152

    ts
    150    // Simulate random but reasonable quality scores
    151    const generateScore = (min: number, max: number): number =>
    152      Math.floor(Math.random() * (max - min + 1)) + min;
    153
    154    const getStatus = (score: number, minRequired: number, warningThreshold: number): QualityStatus => {
    
  • L933

    ts
    931            return 100;
    932          }
    933          return prev + Math.random() * 2;
    934        });
    935      }, 200);
    

serwaa/services/admin-dashboard/src/components/forms/persona/voice-form.tsx#

  • L289

    ts
    287                            className="w-1 rounded-full bg-primary animate-pulse"
    288                            style={{
    289                              height: `${Math.random() * 100}%`,
    290                              animationDelay: `${i * 50}ms`,
    291                            }}
    

testing/utils/test-utils.ts#

  • L208

    ts
    206    let result = '';
    207    for (let i = 0; i < length; i++) {
    208      result += chars.charAt(Math.floor(Math.random() * chars.length));
    209    }
    210    return result;
    
  • L218

    ts
    216  export function randomUUID(): string {
    217    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
    218      const r = (Math.random() * 16) | 0;
    219      const v = c === 'x' ? r : (r & 0x3) | 0x8;
    220      return v.toString(16);
    
  • L228

    ts
    226   */
    227  export function randomInt(min: number = 0, max: number = 100): number {
    228    return Math.floor(Math.random() * (max - min + 1)) + min;
    229  }
    230
    
  • L242

    ts
    240   */
    241  export function randomDate(start: Date = new Date(2020, 0, 1), end: Date = new Date()): Date {
    242    return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
    243  }
    244
    

tests/integration/fixtures/test-event-bus.ts#

  • L216

    ts
    214      },
    215      async publish(event) {
    216        if (failureRate > 0 && Math.random() < failureRate) {
    217          throw new Error('Simulated publish failure (local test bus)');
    218        }
    

tests/integration/utils/test-helpers.ts#

  • L102

    ts
    100    async publish(event: EventEnvelope): Promise<void> {
    101      // Simulate random failures
    102      if (Math.random() < this.options.failureRate) {
    103        throw new Error('Simulated publish failure');
    104      }
    

yaa/packages/ai/agents/agents/content-strategist/db.ts#

  • L300

    ts
    298  export function createAbTest(db: ContentStrategistDB, input: AbTestCreateInput, now: Date): { ok: true; experimentId: string } | { ok: false } {
    299    const nowIso = now.toISOString();
    300    const experimentId = input.experimentId?.trim().length ? input.experimentId.trim() : `ab_${Math.random().toString(16).slice(2, 10)}`;
    301    if (db.experiments[experimentId]) return { ok: false };
    302
    

yaa/packages/ai/original-content/src/pitch-generation.ts#

  • L334

    ts
    332
    333    const angles = categoryAngles[category] || ['Provide comprehensive coverage with multiple perspectives'];
    334    const selectedAngle = angles[0] || angles[Math.floor(Math.random() * angles.length)];
    335
    336    if (isGhana) {
    

yaa/packages/ingestion/rss-collector/src/backoff.ts#

  • L2

    ts
    1  function jitterFactor(): number {
    2    return 0.8 + Math.random() * 0.4;
    3  }
    4
    

yaa/packages/ingestion/sitemap-collector/src/backoff.ts#

  • L2

    ts
    1  function jitterFactor(): number {
    2    return 0.8 + Math.random() * 0.4;
    3  }
    4
    

yaa/packages/ingestion/social-x/src/backoff.ts#

  • L2

    ts
    1  function jitterFactor(): number {
    2    return 0.8 + Math.random() * 0.4;
    3  }
    4
    

yaa/packages/ingestion/source-discovery/src/wire-service-automation.ts#

  • L1378

    ts
    1376
    1377    // Add jitter
    1378    const jitter = (Math.random() - 0.5) * 2 * config.jitterSeconds;
    1379    interval += jitter;
    1380
    

yaa/packages/nlp/ghana-nlp/src/ner-client.ts#

  • L178

    ts
    176
    177    if (config.jitter) {
    178      delay = delay * (0.5 + Math.random() * 0.5);
    179    }
    180
    

yaa/packages/nlp/ghana-nlp/src/stt-client.ts#

  • L130

    ts
    128
    129    if (config.jitter) {
    130      delay = delay * (0.5 + Math.random() * 0.5);
    131    }
    132
    

yaa/packages/nlp/ghana-nlp/src/translation-client.ts#

  • L208

    ts
    206
    207    if (config.jitter) {
    208      delay = delay * (0.5 + Math.random() * 0.5);
    209    }
    210
    

yaa/packages/nlp/ghana-nlp/src/tts-client.ts#

  • L230

    ts
    228
    229    if (config.jitter) {
    230      delay = delay * (0.5 + Math.random() * 0.5);
    231    }
    232
    

yaa/packages/nlp/ghana-nlp/src/twi-audio-queue.ts#

  • L300

    ts
    298
    299  function generateJobId(): string {
    300    return `twi-audio-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
    301  }
    302
    

yaa/packages/social/analytics-dashboard/src/mock-datasource.ts#

  • L163

    ts
    161      for (const day of interval) {
    162        // Generate 1-3 posts per day
    163        const postsToday = Math.floor(Math.random() * 3) + 1;
    164
    165        for (let i = 0; i < postsToday; i++) {
    
  • L166

    ts
    164
    165        for (let i = 0; i < postsToday; i++) {
    166          const contentType = contentTypes[Math.floor(Math.random() * contentTypes.length)]!;
    167          const impressions = Math.round(account.followers * (0.2 + Math.random() * 0.3));
    168          const reach = Math.round(impressions * (0.5 + Math.random() * 0.3));
    
  • L167

    ts
    165        for (let i = 0; i < postsToday; i++) {
    166          const contentType = contentTypes[Math.floor(Math.random() * contentTypes.length)]!;
    167          const impressions = Math.round(account.followers * (0.2 + Math.random() * 0.3));
    168          const reach = Math.round(impressions * (0.5 + Math.random() * 0.3));
    169          const engagementRate = account.avgEngagementRate * (0.5 + Math.random());
    
  • L168

    ts
    166          const contentType = contentTypes[Math.floor(Math.random() * contentTypes.length)]!;
    167          const impressions = Math.round(account.followers * (0.2 + Math.random() * 0.3));
    168          const reach = Math.round(impressions * (0.5 + Math.random() * 0.3));
    169          const engagementRate = account.avgEngagementRate * (0.5 + Math.random());
    170          const engagements = Math.round(reach * engagementRate);
    
  • L169

    ts
    167          const impressions = Math.round(account.followers * (0.2 + Math.random() * 0.3));
    168          const reach = Math.round(impressions * (0.5 + Math.random() * 0.3));
    169          const engagementRate = account.avgEngagementRate * (0.5 + Math.random());
    170          const engagements = Math.round(reach * engagementRate);
    171          const likes = Math.round(engagements * (0.5 + Math.random() * 0.3));
    
  • L171

    ts
    169          const engagementRate = account.avgEngagementRate * (0.5 + Math.random());
    170          const engagements = Math.round(reach * engagementRate);
    171          const likes = Math.round(engagements * (0.5 + Math.random() * 0.3));
    172          const comments = Math.round(engagements * (0.1 + Math.random() * 0.15));
    173          const shares = Math.round(engagements * (0.05 + Math.random() * 0.1));
    
  • L172

    ts
    170          const engagements = Math.round(reach * engagementRate);
    171          const likes = Math.round(engagements * (0.5 + Math.random() * 0.3));
    172          const comments = Math.round(engagements * (0.1 + Math.random() * 0.15));
    173          const shares = Math.round(engagements * (0.05 + Math.random() * 0.1));
    174          const saves = Math.round(engagements * (0.02 + Math.random() * 0.05));
    
  • L173

    ts
    171          const likes = Math.round(engagements * (0.5 + Math.random() * 0.3));
    172          const comments = Math.round(engagements * (0.1 + Math.random() * 0.15));
    173          const shares = Math.round(engagements * (0.05 + Math.random() * 0.1));
    174          const saves = Math.round(engagements * (0.02 + Math.random() * 0.05));
    175          const clicks = Math.round(engagements * (0.1 + Math.random() * 0.1));
    
  • L174

    ts
    172          const comments = Math.round(engagements * (0.1 + Math.random() * 0.15));
    173          const shares = Math.round(engagements * (0.05 + Math.random() * 0.1));
    174          const saves = Math.round(engagements * (0.02 + Math.random() * 0.05));
    175          const clicks = Math.round(engagements * (0.1 + Math.random() * 0.1));
    176
    
  • L175

    ts
    173          const shares = Math.round(engagements * (0.05 + Math.random() * 0.1));
    174          const saves = Math.round(engagements * (0.02 + Math.random() * 0.05));
    175          const clicks = Math.round(engagements * (0.1 + Math.random() * 0.1));
    176
    177          posts.push({
    
  • L185

    ts
    183              day.getMonth(),
    184              day.getDate(),
    185              9 + Math.floor(Math.random() * 12),
    186              Math.floor(Math.random() * 60)
    187            ).toISOString(),
    
  • L186

    ts
    184              day.getDate(),
    185              9 + Math.floor(Math.random() * 12),
    186              Math.floor(Math.random() * 60)
    187            ).toISOString(),
    188            contentPreview: this.generateMockContent(contentType),
    
  • L227

    ts
    225        switch (metric) {
    226          case 'impressions':
    227            value = Math.round(account.followers * (0.2 + Math.random() * 0.2));
    228            break;
    229          case 'reach':
    
  • L230

    ts
    228            break;
    229          case 'reach':
    230            value = Math.round(account.followers * (0.1 + Math.random() * 0.15));
    231            break;
    232          case 'engagement':
    
  • L233

    ts
    231            break;
    232          case 'engagement':
    233            value = Math.round(account.followers * account.avgEngagementRate * (0.8 + Math.random() * 0.4));
    234            break;
    235          case 'likes':
    
  • L236

    ts
    234            break;
    235          case 'likes':
    236            value = Math.round(account.followers * account.avgEngagementRate * 0.6 * (0.8 + Math.random() * 0.4));
    237            break;
    238          case 'comments':
    
  • L239

    ts
    237            break;
    238          case 'comments':
    239            value = Math.round(account.followers * account.avgEngagementRate * 0.2 * (0.8 + Math.random() * 0.4));
    240            break;
    241          case 'followers':
    
  • L242

    ts
    240            break;
    241          case 'followers':
    242            value = account.followers + Math.round(Math.random() * 50 - 10);
    243            break;
    244          case 'followerGrowth':
    
  • L245

    ts
    243            break;
    244          case 'followerGrowth':
    245            value = Math.round(Math.random() * 40 - 5);
    246            break;
    247          default:
    
  • L248

    ts
    246            break;
    247          default:
    248            value = Math.round(Math.random() * 100);
    249        }
    250
    
  • L351

    ts
    349        'Business: New investment opportunity announced #GhanaBusiness',
    350      ];
    351      return headlines[Math.floor(Math.random() * headlines.length)]!;
    352    }
    353  }
    

yaa/packages/video/avatar-profiles/src/twi-anchors.ts#

  • L1175

    ts
    1173    const timeIntros = branding.introByTime?.[time];
    1174    if (timeIntros && timeIntros.length > 0) {
    1175      return timeIntros[Math.floor(Math.random() * timeIntros.length)];
    1176    }
    1177
    
  • L1179

    ts
    1177
    1178    // Fall back to general intros
    1179    return branding.intro[Math.floor(Math.random() * branding.intro.length)];
    1180  }
    1181
    
  • L1195

    ts
    1193    const contextOutros = branding.outroByContext?.[context];
    1194    if (contextOutros && contextOutros.length > 0) {
    1195      return contextOutros[Math.floor(Math.random() * contextOutros.length)];
    1196    }
    1197
    
  • L1199

    ts
    1197
    1198    // Fall back to general outros
    1199    return branding.outro[Math.floor(Math.random() * branding.outro.length)];
    1200  }
    1201
    
  • L1211

    ts
    1209    const breakingIntros = branding.breakingNewsIntro;
    1210    if (breakingIntros && breakingIntros.length > 0) {
    1211      return breakingIntros[Math.floor(Math.random() * breakingIntros.length)];
    1212    }
    1213
    
  • L1274

    ts
    1272
    1273    if (featured.length > 0) {
    1274      return featured[Math.floor(Math.random() * featured.length)];
    1275    }
    1276
    
  • L1277

    ts
    1275    }
    1276
    1277    return candidates[Math.floor(Math.random() * candidates.length)];
    1278  }
    1279
    

yaa/packages/video/instagram-reels-producer/src/producer.ts#

  • L125

    ts
    123
    124    // Pick a CTA
    125    const cta = CTA_TEMPLATES[Math.floor(Math.random() * CTA_TEMPLATES.length)];
    126
    127    // Build caption
    

yaa/packages/video/instagram-stories-producer/src/producer.ts#

  • L110

    ts
    108    const hook = firstSentence.length > 80 ? firstSentence.substring(0, 77) + '...' : firstSentence;
    109
    110    const cta = STORY_CTA_TEMPLATES[Math.floor(Math.random() * STORY_CTA_TEMPLATES.length)];
    111
    112    const lines = [hook || 'Check this out!'];
    

yaa/packages/video/tiktok-sound-trends/src/analysis.ts#

  • L316

    ts
    314    // Estimate based on historical patterns
    315    // Typical TikTok sound peaks last 2-7 days
    316    const peakDuration = 3 + Math.random() * 4; // 3-7 days estimate
    317    return Math.round(peakDuration);
    318  }
    

yaa/packages/web/src/app/api/v1/factcheck/[id]/route.ts#

  • L139

    ts
    137
    138  function generateRequestId(): string {
    139    return `req_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 9)}`;
    140  }
    141
    

yaa/packages/web/src/app/api/v1/factcheck/batch/route.ts#

  • L240

    ts
    238
    239  function generateRequestId(): string {
    240    return `req_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 9)}`;
    241  }
    242
    

yaa/packages/web/src/app/api/v1/factcheck/route.ts#

  • L261

    ts
    259
    260  function generateRequestId(): string {
    261    return `req_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 9)}`;
    262  }
    263
    

yaa/packages/web/src/app/api/v1/factcheck/stats/route.ts#

  • L81

    ts
    79
    80  function generateRequestId(): string {
    81    return `req_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 9)}`;
    82  }
    

yaa/packages/web/src/lib/push/pushTokenClient.ts#

  • L58

    ts
    56      const existing = window.localStorage.getItem(STORAGE_DEVICE_ID_KEY);
    57      if (existing && existing.trim()) return existing;
    58      const next = typeof crypto?.randomUUID === 'function' ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}`;
    59      window.localStorage.setItem(STORAGE_DEVICE_ID_KEY, next);
    60      return next;