1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Creating a random combination

  1. Dec 3, 2012 #1
    I am creating a random combination(code) for a client. I need to see what the total number of combinations there can be.

    Please let me know if I am using the wrong word Combination vs Permutations.

    2 letters + 2 numbers + 2 letters
    example: TR12FR

    The random letters are taken from 24 values:

    The random Numbers are taken from 8 Values:

    Any help would be greatly appreciated.

    Last edited by a moderator: Feb 5, 2013
  2. jcsd
  3. Dec 3, 2012 #2


    Staff: Mentor

    Re: Combinations

    combination is right you're selecting letters, numbers and more letters:

    Choices for each character of your 6 charcter code:

    24 * 24 * 8 * 8 * 24 * 24 = total number of codes possible

    Now if these could be rearranged then you'd have to worry about permutations to elimnate repeats in your counts.
  4. Dec 3, 2012 #3
    Re: Combinations

    Thank you -

    So de-duping these down to create 2.5 million unique codes using this formula will not be an issue, sense there are 21,233,664 possibilities.
    Last edited: Dec 3, 2012
  5. Dec 3, 2012 #4


    Staff: Mentor

    Re: Combinations

    okay what do you mean by de-duping?
  6. Dec 3, 2012 #5
    Re: Combinations

    Well sense this is just a random generator out of excel the possibility of it creating a duplicate is there, so i will need to just remove dupes, or nth select down to 2.5 million unique codes.

    Just needed to make sure that the 6 digit using that formula could create that many unique codes.
  7. Dec 3, 2012 #6


    User Avatar
    Gold Member

    Re: Combinations

    So you have a belief that "true" random would not include any dupes?

    How would you create 100000 consecutive random numbers from 1 to 100 ?
  8. Dec 3, 2012 #7


    Staff: Mentor

    Re: Combinations

    this reminds of how new programmers used to construct a deck of randomly sorted cards.

    generate a number from 0-51 check if its present in the crd deck array if so then generate another.

    The better approach is to generate a sorted sequence of cards into an array and then to randomly shuffle two cards by selecting two indexes at random and swapping the cards.
  9. Dec 3, 2012 #8
    Re: Combinations

    No belief, was just stating that there could be duplicate codes during the random selection and i would need to remove the duplicates until reaching my goal of 2.5 unique codes...
  10. Dec 3, 2012 #9
    Re: Combinations

    Thanks for the help.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook