I created a lottery-type program that you pick 6 numbers from a given range.

The program randomly selects 6 numbers from the same range and determines how many tries it takes to choose 6 numbers that match the your 6 numbers.

I used rand() and srand() to generate the random numbers that the computers uses to try and match your six numbers.

I am experienceing patterns with the random number drawing of rand().

If I chose 6 numbers from a max range of 47 numbers.

The computer matched my numbers in the same amount of attempts in a serries of 37 tries.

Example:

Attempt 1: match in 2277042 tries

Attempts: 2 - 36

Attempt 37: match in 4817236 tries

Attempt 38: match in 2277042 tries

Attempts: 39 - 74 (same as attempts 2 - 36)

attempt 75: match in 4817236 tries

Any answers on why the patterns when it should be random?

Is there a way to prevent this pattern forming in random number drawing?