PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/System Design/SoFi

Design a Random Number Generation API

Last updated: Mar 29, 2026

Quick Overview

Design a Random Number Generation API evaluates requirements, scale assumptions, API/data design, architecture, trade-offs, failure modes, and rollout in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.

  • hard
  • SoFi
  • System Design
  • Software Engineer

Design a Random Number Generation API

Company: SoFi

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Onsite

Design a service exposing REST and streaming endpoints for generating random numbers at scale. Specify API contracts and versioning, entropy sources and CSPRNG vs. PRNG choices, seeding and reproducibility, rate limiting and quotas, multi-tenant isolation, security and abuse prevention, observability, deployment and scaling strategy, and SLAs for latency and availability.

Quick Answer: Design a Random Number Generation API evaluates requirements, scale assumptions, API/data design, architecture, trade-offs, failure modes, and rollout in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.

Related Interview Questions

  • Design market price change notifications - SoFi (medium)
  • Design a Real-Time Suggestions Service - SoFi (hard)
  • Scale a key-value store with consistent hashing - SoFi (hard)
|Home/System Design/SoFi

Design a Random Number Generation API

SoFi logo
SoFi
Jul 16, 2025, 12:00 AM
hardSoftware EngineerOnsiteSystem Design
19
0

Design a Random Number Generation API

System Design: Random Number Service (REST + Streaming)

You are designing a high-scale service that generates random numbers and exposes both REST and streaming interfaces. The service must support secure and non-secure modes, per-tenant isolation, and strong observability. Assume internet-facing clients and multi-region deployment.

Specify the following:

  1. API Contracts and Versioning
  • Define REST endpoints for generating bytes, integers, and floats (bulk requests). Include request/response schemas, error codes, idempotency, and content types.
  • Define streaming endpoints (e.g., SSE, WebSocket, gRPC) for continuous random data. Include connection setup, backpressure, and chunking.
  • Describe versioning strategy and backward compatibility guarantees.
  1. Entropy Sources and RNG Choices
  • Choose CSPRNG(s) for secure mode and PRNG(s) for fast mode. Justify choices and any FIPS-validated options.
  • Describe entropy sources (OS/HW) and reseed strategy.
  1. Seeding and Reproducibility
  • Define how clients can request deterministic sequences (e.g., seed + stream_id + offset).
  • Describe unbiased range mapping for integers, precision for floats, and guarantees for identical output across regions/instances.
  1. Rate Limiting, Quotas, and Multi-Tenant Isolation
  • Specify per-tenant and per-token rate limits and quotas, burst behavior, headers, and error handling.
  • Describe isolation of RNG state and keys so tenants cannot affect or infer each other’s output.
  1. Security and Abuse Prevention
  • Define authentication/authorization, transport security, request validation, and DDoS/WAF controls.
  • Address storage/handling of seeds and audit considerations.
  1. Observability
  • Define metrics, logs, and traces. Include RNG health checks, entropy pool telemetry, and quality testing (e.g., periodic Dieharder/NIST STS).
  1. Deployment and Scaling Strategy
  • Propose a multi-region architecture, autoscaling, failover, and zero-downtime rollout plan.
  • Include worker design (e.g., vectorized generation, prefetch buffers), state placement, and stream stickiness.
  1. SLAs/SLOs
  • Propose latency and availability targets for REST and streaming, including startup latency, sustained throughput, and error budgets.

Assume peak scale of 100k REST requests/sec per region and up to 5 Gbps of streaming throughput per region. Note any assumptions you make.

Constraints & Assumptions

  • Preserve the scope, facts, inputs, and requested outputs from the prompt above.
  • If the prompt leaves a detail unspecified, state a reasonable assumption before relying on it.
  • Keep the answer interview-ready: concise enough to present, but concrete enough to implement or evaluate.

Clarifying Questions to Ask

  • Clarify users, core use cases, read/write patterns, scale, latency, availability, and data retention.
  • State explicit assumptions before making sizing or architecture decisions.
  • Prioritize the functional path first, then address reliability, security, observability, and rollout.

What a Strong Answer Covers

  • A scoped requirements summary with concrete non-goals and success metrics.
  • API, data model, architecture, consistency, capacity, and operations.
  • Reasoned trade-offs among simple and scalable designs, including bottlenecks and failure modes.
  • A validation, monitoring, migration, and launch plan appropriate for the risk level.

Follow-up Questions

  • What breaks first at 10x traffic or data volume?
  • How would you degrade gracefully during dependency failures?
  • What metrics and alerts would prove the design is healthy after launch?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More SoFi•More Software Engineer•SoFi Software Engineer•SoFi System Design•Software Engineer System Design

Your design canvas — auto-saved

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.