473,396 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Integer syntax

4
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.
Mar 1 '07 #1
11 1237
Ganon11
3,652 Expert 2GB
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.
Mar 1 '07 #2
JJN
4
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.
Mar 1 '07 #3
Rabbit
12,516 Expert Mod 8TB
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.
Mar 1 '07 #4
JJN
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.
Could you show me an example of this, let us say for the month of April.
Mar 1 '07 #5
Rabbit
12,516 Expert Mod 8TB
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.
Mar 1 '07 #6
MMcCarthy
14,534 Expert Mod 8TB
I am moving this to Miscellaneous Discussions as I don't think it's appropriate for the cafe.

ADMIN
Mar 1 '07 #7
JJN
4
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?
Mar 1 '07 #8
Rabbit
12,516 Expert Mod 8TB
Modulo is an operator that returns the remainder of a division. In VBA it's Mod, in C++ i believe it's %.
Mar 1 '07 #9
Killer42
8,435 Expert 8TB
Personally, I think this discussion sounds suspiciously "homeworkish".
Mar 2 '07 #10
Rabbit
12,516 Expert Mod 8TB
They didn't specify a programming language so I was inclined to believe it was some sort of work schedule.
Mar 2 '07 #11
Killer42
8,435 Expert 8TB
They didn't specify a programming language so I was inclined to believe it was some sort of work schedule.
Yeah, could be.
Mar 3 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

19
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...
27
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...
15
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...
2
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 ...
10
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 =...
6
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...
0
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. ...
232
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...
20
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
9
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...
0
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...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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...
0
Oralloy
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,...
0
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...
0
tracyyun
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.