Simple uniform dataset
Use-case: Generate a quick dataset of user events with random timestamps and event types.rand() % 10000: uniform distribution of 10k usersarrayElement(...): randomly selects one of three event types- Timestamps spread over the previous 24 hours
Exponential distribution
Use-case: Simulate purchase amounts where most values are low, but a few are high.- Uniform timestamps over recent period
randExponential(1/10)— most totals near 0, offset by 15 as a minimum ([ClickHouse][1], [ClickHouse][2], [Atlantic.Net][3], [GitHub][4])
Time-distributed events (Poisson)
Use-case: Simulate event arrivals that cluster around a specific period (e.g., peak hour).- Events peak around noon, with Poisson-distributed deviation
Time-varying normal distribution
Use-case: Emulate system metrics (e.g., CPU usage) that vary over time.usagefollows a diurnal sine wave + randomness- Values bounded to [0,100]
Categorical and nested data
Use-case: Create user profiles with multi-valued interests.- Random array length between 1–3
- Three per-user scores for each interest
Generating random tables
ThegenerateRandomStructure function is particularly useful when combined with the generateRandom table engine for testing, benchmarking, or creating mock data with arbitrary schemas.
Let’s start by just seeing what a random structure looks like using the generateRandomStructure function:
DESCRIBE statement to see what we created: