* Generate batch of test data
(startX: number, count: number)
| 64 | * Generate batch of test data |
| 65 | */ |
| 66 | function generateBatch(startX: number, count: number): ReadonlyArray<DataPoint> { |
| 67 | const batch: DataPoint[] = new Array(count); |
| 68 | for (let i = 0; i < count; i++) { |
| 69 | const x = startX + i * 0.01; |
| 70 | const y = |
| 71 | Math.sin(x * 0.5) * 0.6 + |
| 72 | Math.sin(x * 1.3) * 0.3 + |
| 73 | Math.sin(x * 3.7) * 0.15 + |
| 74 | (Math.random() - 0.5) * 0.05; |
| 75 | batch[i] = [x, y] as const; |
| 76 | } |
| 77 | return batch; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * FPS tracker |