Thread: Random # Generator.

  1. #16
    Registered User GrafixFairy's Avatar
    Join Date
    Mar 2014
    Posts
    45
    We dont use C, its my first semester doing it, we start at c++ and move up each semester.

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    rand and srand are C. C++ has newer facilities for dealing with random number generation.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Here you go... (pseudo) random numbers

    Hodor Wears Shoes

  4. #19
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Why the heck are you advertising custom written C code to generate random numbers on the C++ board when there exists a standard library facility that does the exact same thing?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #20
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Quote Originally Posted by Elysia View Post
    Why the heck are you advertising custom written C code to generate random numbers on the C++ board when there exists a standard library facility that does the exact same thing?
    Well, the answer is quite simple really... it's "hodor".

  6. #21
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by Hodor View Post
    Well, the answer is quite simple really... it's "hodor".
    that's your answer to everything :P
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  7. #22
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Elkvis View Post
    that's your answer to everything :P
    Except in this case... it's not funny.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #23
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Quote Originally Posted by Elysia View Post
    Except in this case... it's not funny.
    To be quite honest, I didn't notice that the thread was in the C++ section. I apologise. But I still maintain "hodor" is a good reason, so I won't apologise for that

  9. #24
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Can I post a Modula-2 solution?

  10. #25
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Hodor View Post
    To be quite honest, I didn't notice that the thread was in the C++ section. I apologise. But I still maintain "hodor" is a good reason, so I won't apologise for that
    That makes things different, then. I will accept that apology.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #26
    Registered User GrafixFairy's Avatar
    Join Date
    Mar 2014
    Posts
    45
    Am i not able to make my own choice? leave it alone, thts the way i learn it using Dev C++ so tht is the way its going to get done! As i said FIRST YEAR!

  12. #27
    Registered User GrafixFairy's Avatar
    Join Date
    Mar 2014
    Posts
    45
    It works perfectly fine! So thank you but i will do this the way i know how and the way laserlight and Mario F helped me to figure out.

  13. #28
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by GrafixFairy View Post
    Am i not able to make my own choice? leave it alone, thts the way i learn it using Dev C++ so tht is the way its going to get done! As i said FIRST YEAR!
    No one said you were required to use it.
    Though you should maybe understand that, for future reference, <rand> makes it easier to generate random numbers without disturbing the distributions, and much more.
    But you don't need to go through it right now. Considering your idiot teacher, I wouldn't be surprised if you got a 0 for it. So just remember it for future reference in case you get intrigued.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  14. #29
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Quote Originally Posted by GrafixFairy View Post
    Am i not able to make my own choice? leave it alone, thts the way i learn it using Dev C++ so tht is the way its going to get done! As i said FIRST YEAR!
    Quote Originally Posted by GrafixFairy View Post
    It works perfectly fine! So thank you but i will do this the way i know how and the way laserlight and Mario F helped me to figure out.
    You know... just because something works doesn't mean it's "good". It's great that you've got a solution that works. But, now that the pressure is off (at least you have something to hand in) have a short break. After your break, revisit the code and make it better. There's no pressure now so take other peoples' advice and see what you can do. Don't be satisfied with your first solution; you're learning and so am I... part of learning is looking at what you've done and asking yourself "can I do this better?" Usually the answer is "yes."

  15. #30
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by GrafixFairy View Post
    Am i not able to make my own choice? leave it alone, thts the way i learn it using Dev C++ so tht is the way its going to get done! As i said FIRST YEAR!
    If your teacher requires you to use Dev-C++, then it may be a moot point, but I would suggest that you use just about any other C++ IDE out there. Eclipse is great. So is Code::Blocks. Both run on many platforms, including mac, windows, and linux, and they are under current development, unlike Dev-C++, which hasn't seen an update in many years, and is full of bugs.

    On a side note, you seem very argumentative and stubborn. If you're here to learn, this personality trait is not going to help you. One of your threads has already been closed by an admin for this very reason. The people on this forum, while sometimes sarcastic and a bit abrasive, are taking their free time to help you, with no expectation of compensation, despite your attitude. I suggest that you try to remember that, and accept the help that they offer graciously.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need a random number generator thats not compleatly random
    By thedodgeruk in forum C++ Programming
    Replies: 1
    Last Post: 06-05-2011, 06:48 AM
  2. Random Generator
    By jpjpolski in forum C Programming
    Replies: 4
    Last Post: 05-29-2011, 12:56 AM
  3. Random generator 0 1
    By Dedalus in forum C Programming
    Replies: 3
    Last Post: 06-30-2009, 08:44 AM
  4. looking for a random # generator
    By w/ possion? in forum C Programming
    Replies: 4
    Last Post: 02-28-2003, 07:58 AM
  5. Random Name Generator
    By jdinger in forum C++ Programming
    Replies: 6
    Last Post: 04-11-2002, 11:36 AM

Tags for this Thread