How many unique passwords can be made from 6 digits (0 to 9) if repeats are possible?
For those of you who enjoy functional python: Show
It generates an indefinite [infinite] iterator, of joined random sequences, by first generating an indefinite sequence of randomly selected symbol from the giving pool, then breaking this sequence into length parts which is then joined, it should work with any sequence that supports getitem, by default it simply generates a random sequence of alpha numeric letters, though you can easily modify to generate other things: for example to generate random tuples of digits:
if you don't want to use next for generation you can simply make it callable:
if you want to generate the sequence on the fly simply set join to identity.
As others have mentioned if you need more security then set the appropriate select function:
the default selector is
we use Learning Outcomes
We can use permutations and combinations to help us answer more complex probability questions. examplesA 4 digit PIN number is selected. What is the probability that there are no repeated digits? Try ItExampleIn a certain state’s lottery, 48 balls numbered 1 through 48 are placed in a machine and six of them are drawn at random. If the six numbers drawn match the numbers that a player had chosen, the player wins $1,000,000. In this lottery, the order the numbers are drawn in doesn’t matter. Compute the probability that you win the million-dollar prize if you purchase a single lottery ticket. ExampleIn the state lottery from the previous example, if five of the six numbers drawn match the numbers that a player has chosen, the player wins a second prize of $1,000. Compute the probability that you win the second prize if you purchase a single lottery ticket. The previous examples are worked in the following video. examplesCompute the probability of randomly drawing five cards from a deck and getting exactly one Ace. ExampleCompute the probability of randomly drawing five cards from a deck and getting exactly two Aces. View the following for further demonstration of these examples. Try ItBirthday ProblemLet’s take a pause to consider a famous problem in probability theory: Suppose you have a room full of 30 people. What is the probability that there is at least one shared birthday? Take a guess at the answer to the above problem. Was your guess fairly low, like around 10%? That seems to be the intuitive answer (30/365, perhaps?). Let’s see if we should listen to our intuition. Let’s start with a simpler problem, however. exampleSuppose three people are in a room. What is the probability that there is at least one shared birthday among these three people? Suppose five people are in a room. What is the probability that there is at least one shared birthday among these five people? Suppose 30 people are in a room. What is the probability that there is at least one shared birthday among these 30 people? The birthday problem is examined in detail in the following. If you like to bet, and if you can convince 30 people to reveal their birthdays, you might be able to win some money by betting a friend that there will be at least two people with the same birthday in the room anytime you are in a room of 30 or more people. (Of course, you would need to make sure your friend hasn’t studied probability!) You wouldn’t be guaranteed to win, but you should win more than half the time. This is one of many results in probability theory that is counterintuitive; that is, it goes against our gut instincts. Try ItSuppose 10 people are in a room. What is the probability that there is at least one shared birthday among these 10 people? How many 6So, starting from the left, you would have 9 choices for the leftmost digit (not allowing 0), then 9 choices again for the next digit (0 is now allowable but not the previous digit), then 8 choices for the next digit and so on, for a result of 9*9*8*7*6*5 = 136080.
How many combinations are there for a 6"Mathematically speaking, there is a huge difference, of course," says Philipp Markert. A four-digit PIN can be used to create 10,000 different combinations, while a six-digit PIN can be used to create one million.
How many unique numbers are there in 6 digits?∴ In total, there are 900,000 6-digit numbers.
How many six digit passwords are possible if repetition of digits is allowed?This is simply 999999 - 0 + 1 = 1000000 (1 million) possible passwords.
|