PDA

View Full Version : Random Date Generator Help Please



Ajaman
05-13-2012, 09:21 PM
Hi,

I am trying to write a code that will give a random group of 23 people,how likely is it that two people have the same birthday. i need to write a program that creates a random date array from 1 to 23 (being the number of people) and to assign each of the 23 people a random date integer from 1 to 365 the program needs to check all the dates to see if theres are any matching dates and to be repated 100 times for how many matching birthdays there would be and i need the answer to be around 50 to 60%.

so far i have got a code that will randomly display a date but im not to sure on the rest would some one be able to help me out
thanks


this is the code i have so far

Sub GenerateRandomNumberInRange()
Dim MaxNumber As Integer
Dim MinNumber As Integer
Dim RandomNumber As Integer
MinNumber = 1
MaxNumber = 365
RandomNumber = Int((Rnd * (MaxNumber - MinNumber + 1)) + MinNumber)
Debug.Print DateSerial(1983, 1, RandomNumber)
'
msg = DateSerial(1983, 1, RandomNumber)
MsgBox msg
End Sub

fumei
05-13-2012, 11:24 PM
You have already posted this question.

http://www.vbaexpress.com/forum/showthread.php?t=41854

So...read that post. I do not think anyone will help you with this. At least I hope not.

Ajaman
05-13-2012, 11:36 PM
You have already posted this question.

http://www.vbaexpress.com/forum/showthread.php?t=41854

So...read that post. I do not think anyone will help you with this. At least I hope not.

do u seriously go through peoples profiles to see if they have posted about it?

i am asking a question and need help why cant you help me

macropod
05-13-2012, 11:57 PM
Cross-posted at: http://www.tek-tips.com/viewthread.cfm?qid=1683040
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184

Ajaman
05-14-2012, 12:00 AM
Cross-posted at: http://www.tek-tips.com/viewthread.cfm?qid=1683040
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184

and?

macropod
05-14-2012, 12:02 AM
Did you read the material in the link? Somehow I think not. At this rate, you're on a short path to being banned from at least one forum...

Ajaman
05-14-2012, 12:03 AM
Did you read the material in the link? Somehow I think not. At this rate, you're on a short path to being banned from at least one forum...

there no rule saying just because i post on ur site i cant post on others

fumei
05-14-2012, 12:23 AM
No, that is true. BUT if you read the link on cross-posting (and I agree with macropod that you probably have not), then you would understand why it is being mentioned.

We do this for free, and we do not like wasting our time. You can do multiple posts in different forums but tell us. To do otherwise is rude.

As stated, you have asked this before. You got a response, and a link. You did not do much with it it seems. So you just asked again. You are wasting our time. We are not here to just to give you answers.

Ajaman
05-14-2012, 12:27 AM
i ask again because i dont get the answer

macropod
05-14-2012, 12:33 AM
Given that there's been no indication from you in the other thread that you tried to apply the logic in the link there, how was anyone to know you didn't have the answer you needed? And why start a new thread? If you have unresolved issues with the advice you've already been given, then ask more questions in the same thread. Don't just start new threads in this or other forums and pretend no-one's going to notice.

fumei
05-14-2012, 01:30 PM
We are not here to give you an answer. We are here to help you (if you are willing) to find an answer. Yes, sometimes we give straight answers, but you question does not have one. We gave you something to start with, and you have little with that. As macropod states, if you are still struggling with it, ask for more help IN THE SAME THREAD.

This is not a free-for-all. There are established rules of behaviour and etiquette. Please follow them or you will be possibly banned.