CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25
  1. #16
    Join Date
    Apr 2005
    Posts
    107

    Re: SRAND Number Generation Help

    Quote Originally Posted by TruthSpeaker View Post
    But when the other commands in main are using the same formula, gameTime should be taking the value from when it last was, so the countdown should keep going down.

    I do not know if you people are helping and being funny or criticizing. If you want the whole code, say so. Do not act like this please.

    The way I have the code set up, it is supposed to keep looping using the new gameTime each time in each pass and hit 0 eventually.
    Well, from what you posted, I don't see additional calls to rand(), which you may not want anyway, but I demonstrated how with a single call, and a single number, exactly WHY you were alternating between two discrete values.

    I can only base a guess on what you posted. I just followed the math, assuming your:
    gameTime = randomTime - gameTime;
    statement is what is being executed in your loop.

    If you consider that criticism, fine.

  2. #17
    Join Date
    Jan 2009
    Location
    NC, USA
    Posts
    23

    Re: SRAND Number Generation Help

    It is just that there were 2-3 comments that were uncalled for. Not the examples or the help the person is offering, but the way the person presented them. I forgive the person if it is his/her personality and just habit, and I always welcome help, but when I see wording that looks uncalled for, I state so. Am sure it is because of my lack of humor as well. If all is good between us parties, then all is good.
    I am going to soon try everyone's suggestions so I can get this simple little bit to generate correct.
    Thank you.
    > Christian. Italian. Warrior. BS-GSP major. Gamer. Borg... I am that hero!
    > La resistenza è, ed è stato sempre, inutile.
    > Christianity is a lifestyle, not a “religion", with Jesus the Christ, Lord & Savior. Nothing has disproved any Biblical facts. In fact, science & archeology have done nothing but proved it all instead. Therefore, pizza party with the Man & I bring the colas!
    > POSTING COMMENT * I may reply back in hours to months (unless improperly locked on me) due to duty schedule. I reply as fast as I can to anything still open I am involved in. Thank you.

  3. #18
    Join Date
    Aug 2009
    Posts
    38

    Re: SRAND Number Generation Help

    Quote Originally Posted by TruthSpeaker View Post
    dc, if your rude comments are going to continue, please do not post. I do not know if you trying to be funny but I see no humor. I came here looking for helpful comments, not criticism. go elsewhere for that please.
    You will get no end of offensive people being rude to you - they come on this board to pontificate, not to be helpful.

    By the way, I'd use Mersenne Twister, rather than the standard library for random generation.

    See wikipedia for a downlink for MT.

    Code:
    init_genrand((unsigned)time(0));
    
    unsigned long genrand_int32(void);
    
    int random_number(int range)
    {
        if (range < 1) return 0;
        return(genrand_int32()&#37;range)+1;
    }
    Last edited by mwoods; October 14th, 2009 at 10:26 AM.

  4. #19
    Join Date
    Nov 2002
    Location
    Los Angeles, California
    Posts
    3,863

    Re: SRAND Number Generation Help

    Hmmm... I am really having a hard time finding any "rude" comments and in fact find the over-sensitivity annoying. Maybe you should try and understand what is being said instead of getting your feelings hurt.

    C++ now supports more sophisticated random number generators, Mersenne twister being one of them. So stop fooling around with rand()

    http://www.johndcook.com/cpp_TR1_random.html

    http://www.boost.org/doc/libs/1_40_0...dom/index.html
    Wakeup in the morning and kick the day in the teeth!! Or something like that.

    "i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."

  5. #20
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: SRAND Number Generation Help

    Quote Originally Posted by mwoods View Post
    You will get no end of offensive people being rude to you - they come on this board to pontificate, not to be helpful.
    You've been a member for two months and have 22 posts to your name. I don't think you really have the experience to make that statement. You've got a group of very experienced programmers donating their time and assistance at no charge. What you will find is a very low tolerance for people asking to have work done for them.

    The goal of this board is to help make people better programmers, not to help them pass their IT classes with minimal effort. Approach this board with the right attitude and you'll find a great bunch of very helpful people. Come in here like the world owes you something and you'll get your attitude adjusted in short order. To the people who find that rude, all I can say is welcome to the real world.

  6. #21
    Join Date
    Jan 2009
    Location
    NC, USA
    Posts
    23

    Re: SRAND Number Generation Help

    I can not believe people are still looking for (what looks like) rude/criticism type comments (to me) when they are plain on page one. If I need to point them out, fine:

    "In despite of the fact that your code makes absolutely no sense..."
    Saying I have no idea what I am doing? One reason why I came here in the first place, but I did not need to be have it told to me like that. Maybe JUST point out the error and solution instead of this method.

    "What do you expect?"
    I do not know. That is why I was asking in the first place.

    "TruthSpeaker, your common sense is not with you, is it?"
    My common sense is actually well, but thanks.

    Whether other people see these as fine, great. Me, I do not. Whether my method of responding was too strong for some, then that I can apologize for.

    GCDEF, you say about the real world. I have been in it for decades longer than I should, does not mean I have to accept society in any way others do. Does not mean I have to accept something negative, directly or unintentionally, from someone else if I choose not to. People will say the same thing to me when I am just ordering a sub at Subway.

    If it helps, this was not for a class. This little thing I am doing is for myself trying to make a quick little text game to practice code on. This is where your statement "better programmers" come in for me, but I come here without needing what I see as witty type remarks from some. For anytime I am incorrect on someone's statements, all they need to do is explain their remarks and I may apologize if the situation is called. I never have time for text fights, even accidental ones. So again, if my methods of responding was too strong for some, then that I can apologize for.

    This point on, please stay on topic about the generator. No more need to talk about other peoples comments at this point. Well, I see some other posts above I need to try out. Finding the time to try other methods, along with finding time to sleep, is a task, so please bare with me for responses once I have some about the new tips mentioned. It takes me weeks/months to get around to even play with a single line of code. Bare with me as I will come back in time and respond.

    Thank you.
    > Christian. Italian. Warrior. BS-GSP major. Gamer. Borg... I am that hero!
    > La resistenza è, ed è stato sempre, inutile.
    > Christianity is a lifestyle, not a “religion", with Jesus the Christ, Lord & Savior. Nothing has disproved any Biblical facts. In fact, science & archeology have done nothing but proved it all instead. Therefore, pizza party with the Man & I bring the colas!
    > POSTING COMMENT * I may reply back in hours to months (unless improperly locked on me) due to duty schedule. I reply as fast as I can to anything still open I am involved in. Thank you.

  7. #22
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: SRAND Number Generation Help

    Quote Originally Posted by TruthSpeaker View Post
    It takes me weeks/months to get around to even play with a single line of code. Bare with me as I will come back in time and respond.

    Thank you.
    I'd suggest using that time to thicken your skin a little. Nobody was rude to you and to come back after the post has been dormant for two weeks seems a little . You want love, call your mother. You want help, here we are.

  8. #23
    Join Date
    Jan 2009
    Location
    NC, USA
    Posts
    23

    Re: SRAND Number Generation Help

    Sorry you think that, GCDEF, but your comment just now was also rude. Why do you people persist? Just talk to me with respect, not insults or negative comments, show me what I did wrong, not criticize, and all is good.
    No worries. I forgave you all, just keep the topic in hand on hand and stop your fussing, all of you.
    Dormant, like I said, it takes me a long time sometimes because I am always flying. That comment of yours was unnecessary too.
    Like I said, knock it all off. If you want to complain, go to your parents please (just to throw in your advice which seems silly anyway considering my parents are deceased now).
    As for the past suggestions, when I get to that computer, I will try them out and post back when I can.
    Thank you.
    > Christian. Italian. Warrior. BS-GSP major. Gamer. Borg... I am that hero!
    > La resistenza è, ed è stato sempre, inutile.
    > Christianity is a lifestyle, not a “religion", with Jesus the Christ, Lord & Savior. Nothing has disproved any Biblical facts. In fact, science & archeology have done nothing but proved it all instead. Therefore, pizza party with the Man & I bring the colas!
    > POSTING COMMENT * I may reply back in hours to months (unless improperly locked on me) due to duty schedule. I reply as fast as I can to anything still open I am involved in. Thank you.

  9. #24
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: SRAND Number Generation Help

    Quote Originally Posted by TruthSpeaker
    Dormant, like I said, it takes me a long time sometimes because I am always flying. That comment of yours was unnecessary too.
    You might to know that in some online communities, which I think includes this one, it is generally considered rude to revive a dormant thread.

    What exactly constitutes rudeness depends on culture as well as the individuals involved. It so happens that the culture of various online communities tends to require "thick skin", perhaps because when people do not meet face to face and are relatively anonymous, they tend to speak more freely. So, just adapt to the culture, i.e., when in Rome, do as the Romans do.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  10. #25
    Join Date
    Jan 2009
    Location
    NC, USA
    Posts
    23

    Re: SRAND Number Generation Help

    If you say so, but I do not see anything wrong with reviving a topic of my own for the ongoing issue I may/still have. If you do not approve, then do not worry about it.
    In America, people like me see comments like others as "uncalled for" just because of the reality of experience.
    Do not worry about it.
    > Christian. Italian. Warrior. BS-GSP major. Gamer. Borg... I am that hero!
    > La resistenza è, ed è stato sempre, inutile.
    > Christianity is a lifestyle, not a “religion", with Jesus the Christ, Lord & Savior. Nothing has disproved any Biblical facts. In fact, science & archeology have done nothing but proved it all instead. Therefore, pizza party with the Man & I bring the colas!
    > POSTING COMMENT * I may reply back in hours to months (unless improperly locked on me) due to duty schedule. I reply as fast as I can to anything still open I am involved in. Thank you.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured