need help plz

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #31
    Originally posted by Bigj0410
    ?? (shrugs my shoulders)
    14th line in their example.

    Comment

    • Bigj0410
      New Member
      • Feb 2007
      • 25

      #32
      Originally posted by sicarie
      14th line in their example.
      14th line?

      Comment

      • sicarie
        Recognized Expert Specialist
        • Nov 2006
        • 4677

        #33
        Originally posted by Bigj0410
        14th line?
        In the example code of the link I posted.

        Comment

        • sicarie
          Recognized Expert Specialist
          • Nov 2006
          • 4677

          #34
          Originally posted by sicarie
          In the example code of the link I posted.
          You would assign it the way you assign anything. As long as the library (stdlib) is included, you can just assign a random number to any other number (say tmp_rand).

          Comment

          • Bigj0410
            New Member
            • Feb 2007
            • 25

            #35
            Originally posted by sicarie
            In the example code of the link I posted.
            u mean "rand() % 10 + 1;"?

            Comment

            • sicarie
              Recognized Expert Specialist
              • Nov 2006
              • 4677

              #36
              Originally posted by Bigj0410
              u mean "rand() % 10 + 1;"?
              Well, I was talking more how they assign it.

              variable = rand() % 10 + 1;

              gives variable (I dont' remember what they used) a random value.

              The mod (%) 10 is what you're going to be interested in next - this returns a number between 0 and 10. So you just have to change that to give you one between 1 and 100.

              Comment

              • Bigj0410
                New Member
                • Feb 2007
                • 25

                #37
                Originally posted by sicarie
                Well, I was talking more how they assign it.

                variable = rand() % 10 + 1;

                gives variable (I dont' remember what they used) a random value.

                The mod (%) 10 is what you're going to be interested in next - this returns a number between 0 and 10. So you just have to change that to give you one between 1 and 100.
                oooo ok....i see

                Comment

                Working...