Inspiration

I wanted to create my method that generates a random number and also part of the challenge for MLH GHW Beginner's Week

How it works

  1. Linear Congruential Generator: The random number generator is based on the Linear Congruential Generator algorithm, a simple and well-known method for generating pseudo-random numbers.
  2. Range Calculation: The my_random_range function calculates the random number by adjusting the result from my_random() within the specified range [min, max].
  3. Modulo Operation: The formula uses the modulo operator % to ensure the result stays within the bounds of the modulus m.
  4. main() function: In main(), the code generates 10 random numbers in the range 0 to 100 and prints them to the console.

How I built it

Using C program

Challenges I ran into

Not familiar with the algorithms involved, Lack of logic and implementation techniques

Accomplishments that I am proud of

I learned something new and I SHOWEDD UPP

What I learned

Algorithms like Linear Congruential Generator (LCG) used and its implementation

Output example

Random number: 72 Random number: 58 Random number: 25 Random number: 40 Random number: 93 Random number: 17 Random number: 79 Random number: 45 Random number: 100 Random number: 61

Built With

Share this project:

Updates