Integer syntax

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JJN
    New Member
    • Mar 2007
    • 4

    Integer syntax

    I have ten men who each are assigned a number(obviousl y 1-10). I need to randomize them so that each man's number corresponds to each day of the month for the year. The days that the men are assigned have to be equal. The weekends have to be equal as well.
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    OK. Did you need help trying to do this?

    The numbers won't end up being exactly equal, as 365 / 10 is 36.5, so some men will have 36 days and 37 days.

    Comment

    • JJN
      New Member
      • Mar 2007
      • 4

      #3
      Originally posted by Ganon11
      OK. Did you need help trying to do this?

      The numbers won't end up being exactly equal, as 365 / 10 is 36.5, so some men will have 36 days and 37 days.

      If you have the time I would appreciate it.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        What I would do is assign each person a number from 0 - 9 and then use a Modulo 10 to assign days to each person. This isn't entirely random as each person will come up every 10th day.

        Comment

        • JJN
          New Member
          • Mar 2007
          • 4

          #5
          Originally posted by Rabbit
          What I would do is assign each person a number from 0 - 9 and then use a Modulo 10 to assign days to each person. This isn't entirely random as each person will come up every 10th day.
          Could you show me an example of this, let us say for the month of April.

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Day 1 = 1, Day 2 = 2, Day 3 = 3, etc.
            1 Mod 10 = 1 = Person 1
            2 Mod 10 = 2 = Person 2
            .
            .
            .
            10 Mod 10 = 0 = Person 0
            11 Mod 10 = 1 = Person 1
            12 Mod 10 = 2 = Person 2
            .
            .
            .
            20 Mod 10 = 0 = Person 0
            .
            .
            .
            30 Mod 10 = 0 = Person 0

            So with some sort of loop, you can loop through all the days and assign them accordingly.

            Comment

            • MMcCarthy
              Recognized Expert MVP
              • Aug 2006
              • 14387

              #7
              I am moving this to Miscellaneous Discussions as I don't think it's appropriate for the cafe.

              ADMIN

              Comment

              • JJN
                New Member
                • Mar 2007
                • 4

                #8
                Originally posted by Rabbit
                Day 1 = 1, Day 2 = 2, Day 3 = 3, etc.
                1 Mod 10 = 1 = Person 1
                2 Mod 10 = 2 = Person 2
                .
                .
                .
                10 Mod 10 = 0 = Person 0
                11 Mod 10 = 1 = Person 1
                12 Mod 10 = 2 = Person 2
                .
                .
                .
                20 Mod 10 = 0 = Person 0
                .
                .
                .
                30 Mod 10 = 0 = Person 0

                So with some sort of loop, you can loop through all the days and assign them accordingly.
                Thank you, but I do not understand. What is Mod?

                Comment

                • Rabbit
                  Recognized Expert MVP
                  • Jan 2007
                  • 12517

                  #9
                  Modulo is an operator that returns the remainder of a division. In VBA it's Mod, in C++ i believe it's %.

                  Comment

                  • Killer42
                    Recognized Expert Expert
                    • Oct 2006
                    • 8429

                    #10
                    Personally, I think this discussion sounds suspiciously "homeworkis h".

                    Comment

                    • Rabbit
                      Recognized Expert MVP
                      • Jan 2007
                      • 12517

                      #11
                      They didn't specify a programming language so I was inclined to believe it was some sort of work schedule.

                      Comment

                      • Killer42
                        Recognized Expert Expert
                        • Oct 2006
                        • 8429

                        #12
                        Originally posted by Rabbit
                        They didn't specify a programming language so I was inclined to believe it was some sort of work schedule.
                        Yeah, could be.

                        Comment

                        Working...