Author Topic: rand() without double results  (Read 1119 times)

Offline elico1

  • Single posting newcomer
  • *
  • Posts: 5
rand() without double results
« on: January 16, 2020, 11:27:42 pm »
Hiu all

In case of RAND() C command is it possible to avoid double same results like
4 1 1 3 5 in case of randon of 5 numbers generated by rand()

Thanks
eliko

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7018
    • My Best Post
Re: rand() without double results
« Reply #1 on: January 16, 2020, 11:29:10 pm »
So, you wish me to ask you to be banned, correct?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline elico1

  • Single posting newcomer
  • *
  • Posts: 5
Re: rand() without double results
« Reply #2 on: January 18, 2020, 05:10:20 pm »
What is wrong with you ?
Elico

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2850
Re: rand() without double results
« Reply #3 on: January 18, 2020, 05:21:00 pm »
In the rules of this forum is written, that this forum is not for general c questions and only for codeblocks questions. Not reading the forum rules is a reason for a ban, so stahta is (a bit rudely) saying you should read and follow the forum rules and not ask this kind of questions on this forum.

Quote
In case of RAND() C command is it possible to avoid double same results like
4 1 1 3 5 in case of randon of 5 numbers generated by rand()
No, because you want to have random numbers....

basically this is also a random sequence:
Code: [Select]
1 1 1 1 1 1 1 1
obligatory XKCD for reference:
https://www.xkcd.com/221/

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7018
    • My Best Post
Re: rand() without double results
« Reply #4 on: January 18, 2020, 08:40:06 pm »
What is wrong with you ?
Elico

I posted the rules to your last post and you either are unable to follow hyper links or are unable to understand the rules. Or you are a Help Vampire who needs to be stopped!

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org