#!/usr/bin/env bash # Run 3 streams in parallel; each prints 5 random hex lines with a label. # Proves each stream gets different random (no duplicates across streams). # Requires server running: cargo run (or ./scripts/release-camera.sh first if camera locked) PORT="${PORT:-8787}" N="${1:-5}" echo "Three streams, ${N} lines each — verify no line is repeated across streams." echo "" ( echo "--- Stream-A ---"; for ((i=1;i<=N;i++)); do curl -s "http://127.0.0.1:${PORT}/random?bytes=32&hex=true"; echo ""; done ) | tee /tmp/stream-a.$$ & ( echo "--- Stream-B ---"; for ((i=1;i<=N;i++)); do curl -s "http://127.0.0.1:${PORT}/random?bytes=32&hex=true"; echo ""; done ) | tee /tmp/stream-b.$$ & ( echo "--- Stream-C ---"; for ((i=1;i<=N;i++)); do curl -s "http://127.0.0.1:${PORT}/random?bytes=32&hex=true"; echo ""; done ) | tee /tmp/stream-c.$$ & wait echo "" echo "--- Verification: total unique hex lines (should be ${N} per stream = $((N*3)) total) ---" total=$(cat /tmp/stream-a.$$ /tmp/stream-b.$$ /tmp/stream-c.$$ 2>/dev/null | grep -E '^[0-9a-f]{64}$' | sort -u | wc -l) expected=$((N*3)) echo "Unique 64-char hex lines: $total (expected $expected)" rm -f /tmp/stream-a.$$ /tmp/stream-b.$$ /tmp/stream-c.$$