Author Topic: problem with random function  (Read 363 times)

Offline thebestitme

  • Single posting newcomer
  • *
  • Posts: 2
problem with random function
« on: April 12, 2019, 11:16:17 am »
Hello , I have a problem with random function. First, I have to explain that I make a question and random it.
I  use 
srand(time(NULL));
QUIZ = rand()%38;
but it always show question no. 36 then I answer it shows another question.

If I delete it to have only question no. 0-35 , it doesn't has any problem although I use the same code.

https://www.img.in.th/images/51327cfda1b4948729a1f110f72f6842.png

https://www.img.in.th/images/639216882954c3b51809100ccb6dc936.png

thank you

Offline thebestitme

  • Single posting newcomer
  • *
  • Posts: 2
Re: problem with random function
« Reply #1 on: April 12, 2019, 11:52:40 am »
I try not to use (Z==36)  so I skip it to the next number and it works !

Offline sodev

  • Almost regular
  • **
  • Posts: 242
Re: problem with random function
« Reply #2 on: April 12, 2019, 06:56:32 pm »
This is not a Solve-My-Homework forum, as can be seen on the screenshots your CodeBlocks is working fine. So not a CodeBlocks problem, wrong forum, you have to look somewhere else.