[SOLVED] Looking for code to generate 6 random numbers between 1 and 47.
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
if you use on set of numbers and the odds are say: 3000 to 1
you play that set of numbers, it does NOT hit. So you pick a different set of numbers, the odds still stay the same. 3000 to 1
but what if you keep that same set of numbers and play them again. Will that change the odds to 2999 to 1 because one of them was already used?
in other words if one keep playing the odds using the same set of numbers, are the odds of wining increased due to it has to hit eventually because of the process of elimination?
if you use on set of numbers and the odds are say: 3000 to 1
you play that set of numbers, it does NOT hit. So you pick a different set of numbers, the odds still stay the same. 3000 to 1
but what if you keep that same set of numbers and play them again. Will that change the odds to 2999 to 1 because one of them was already used?
in other words if one keep playing the odds using the same set of numbers, are the odds of wining increased due to it has to hit eventually because of the process of elimination?
I would say that if fresh random numbers were used to play the lotto every week vs using the same randomly picked numbers every week -- the odds of winning the jackpot would be the same.
if you use on set of numbers and the odds are say: 3000 to 1
you play that set of numbers, it does NOT hit. So you pick a different set of numbers, the odds still stay the same. 3000 to 1
but what if you keep that same set of numbers and play them again. Will that change the odds to 2999 to 1 because one of them was already used?
in other words if one keep playing the odds using the same set of numbers, are the odds of wining increased due to it has to hit eventually because of the process of elimination?
No, the odds of winning are exactly the same. The probability of certain numbers being chosen in any draw is independent of any previous results.
No, the odds of winning are exactly the same. The probability of certain numbers being chosen in any draw is independent of any previous results.
that sound so "text book" convincing.
though that was the other side of my thought, I just didn't add it in here. Because the rationalization of "if you play that same number long enough it will hit eventually". can be a true statement.
I do suppose the rationalization falls into that is the same as the pool table theory.
If you hit the ball hard enough, it will eventually fall into the hole (pocket).
though that was the other side of my thought, I just didn't add it in here. Because the rationalization of "if you play that same number long enough it will hit eventually". can be a true statement.
I do suppose the rationalization falls into that is the same as the pool table theory.
If you hit the ball hard enough, it will eventually fall into the hole (pocket).
I think it all depends on the method how the random numbers are generated.
Given a bowl with 47 balls numbered 1 - 47, there's no chance you'll have a duplicate, unless balls are thrown back in the bowl.
The shuf command resembles this method, and that makes it a nice and quick method.
On the other hand; if each time a number is generated is equal and completely random, there's an increasing chance that there will be duplicates.
The issue with this kind of thing is indeed the duplicates; are they possible, how do they affect the outcome... I've never been one for lotteries, so actually I have no idea what the real question is... I find this initial question intriguing in that aspect, one I often detect at work as well; people think they have one question... until they speak with us... they return with more questions. All because the question has to be exact, because the answer needs to be exact.
The odds of a six-digit draw from 47 is (1/47) + (1/46) + (1/45) + (1/44) + (1/43) + (1/42). As each digit is drawn, the size of the remaining pool of numbers decreases by one.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.