Generate Random Regional Records
Last updated: August 25, 2026
Quick Overview
Design a function to generate N random integers, and then extend it to create instances of a class that includes these integers along with a randomly selected region.
Icapital
August 25, 20260
0
3 solved
Design a function to generate N random integers, and then extend it to create instances of a class that includes these integers along with a randomly selected region.
This question is typically asked in the technical screen round to assess a candidate's understanding of random number generation and object-oriented programming. The interviewer evaluates the candidate's coding skills, ability to follow requirements, and their approach to problem-solving in a structured manner.
What the Interviewer Expects
- Clearly define a function that generates random integers.
- Implement functionality to generate integers within a specified range.
- Create a class that encapsulates the random number and region.
- Demonstrate understanding of random selection for regions.
- Showcase the ability to instantiate multiple objects and print their values.
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- How would you modify your function to handle edge cases?
- Can you explain the importance of using randomization in software applications?
- What other data types could you include in your class design?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
The task requires creating a function that generates N random integers. Initially, these integers can be generated without any constraints. The second part of the task involves modifying the function ...
High-Level Design
- Function to Generate Random Integers: Create a function that accepts N as an argument and returns a list of N random integers.
- Range Specification: Modify the function to accept two ad...