I have ten men who each are assigned a number(obviously 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.
11 1237
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.
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.
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.
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.
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.
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?
Modulo is an operator that returns the remainder of a division. In VBA it's Mod, in C++ i believe it's %.
Personally, I think this discussion sounds suspiciously "homeworkish".
They didn't specify a programming language so I was inclined to believe it was some sort of work schedule.
They didn't specify a programming language so I was inclined to believe it was some sort of work schedule.
Yeah, could be.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Imbaud Pierre |
last post by:
integer division and modulo gives different results in c and python,
when negative numbers
are involved. take gdb as a widely available c interpreter
print -2 /3
0 for c, -1 for python.
more...
|
by: Daniel Lidström |
last post by:
Hello!
I want to work with individual bytes of integers. I know that ints are
32-bit and will always be. Sometimes I want to work with the entire
32-bits, and other times I want to modify just...
|
by: TC |
last post by:
What does it mean for an integer to have a null value? I am trying to use
the DataView.Find method. That method has an integer return type which
contains the "index of the row in the DataView...
|
by: Peter Ignarson |
last post by:
Hi, simple question
Is there a syntax (other than the one below that is invalid) that will let
me declare and initialize two variables at the same time (using VS 2003,
1.1) ?
Thank you
Pete
...
|
by: Mike S |
last post by:
Does anyone know the logic behind why in VB.NET the result of a
floating-point division ('/') is -rounded- on being converted to an
integer type, such as with statements like
Dim x As Integer =...
|
by: John Dann |
last post by:
I'm trying to use a third party .Net charting control. One of its
methods takes a standard 4-byte integer as a parameter (to specify a
colour actually, but it's done as a standard integer value and...
|
by: Syd_Man |
last post by:
I have a Gridview that is passing value to a detailsview controls using
DefaultValue="EmployeeID = {0}" syntax however if I use the same syntax
for the Integer it raises some Conversion error.
...
|
by: robert maas, see http://tinyurl.com/uh3t |
last post by:
I'm working on examples of programming in several languages, all
(except PHP) running under CGI so that I can show both the source
files and the actually running of the examples online. The first...
|
by: chutsu |
last post by:
I'm trying to compare between pointer and integer in an "IF" statement
how do I make this work?
if(patient.id != NULL){
}
Thanks
Chris
|
by: =?iso-8859-1?q?Tom=E1s_=D3_h=C9ilidhe?= |
last post by:
I posted an article of similar effect to this to comp.std.c++ but for some
reason it hasn't shown up in the newsgroup.
Anyway, instead of having a system in C++ whereby each integer type has a...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |