Post History
#3: Post edited
- Output a random digit, with no 2 subsets having equal probability.
- ## Input
- There is no input for this challenge.
- ## Output
- - A single digit from 0 to 9.
- - The output must have a distinct probability of being in each subset of the digits 0 to 9.
- - It follows that every digit must have a non-zero probability of being output.
- ## Examples
- ### Probabilities not unique per digit
- Digit|Probability
- -|-
- 0|0.1
- 1|0.1
- 2|0.1
- 3|0.1
- 4|0.1
- 5|0.1
- 6|0.1
- 7|0.1
- 8|0.1
- 9|0.1
- The digits have equal probabilities of being output. For example:
- - The probability of the output being 0 is 0.1
- - The probability of the output being 1 is 0.1
- So code that results in these probabilities would not be valid.
- ### Probabilities unique per digit but not per subset
- Digit|Probability
- -|-
- 0|0.01
- 1|0.03
- 2|0.05
- 3|0.07
- 4|0.09
- 5|0.11
- 6|0.13
- 7|0.15
- 8|0.17
- 9|0.19
- Every digit has a unique probability of being output. However, some subsets have equal total probability. For example:
- - the probability of the output being a 0 or a 3 is 0.01 + 0.07 = 0.08
- - the probability of the output being a 1 or a 2 is 0.03 + 0.05 = 0.08
- So code that results in these probabilities would not be valid.
- ## Test cases?
- As every answer may take a different approach, and the output is random, there can be no set test cases. Please include an explanation of why the probabilities are distinct for every subset.
- It may help to also include the frequency of each digit over a large number of runs, or the theoretical long term frequencies. If the answer satisfies the requirements then the sum of the frequencies for any subset of the digits 0 to 9 will be unique (no other subset's frequencies will sum to the same total).
There are 1024 possible subsets of the digits 0 to 9. If you have the frequencies for each of the individual digits, you can use [ THIS PAGE - TODO ] to see the frequencies for all 1024 subsets, sorted by frequency, along with an indication of any which are identical. Note that only theoretical long term frequencies will be exactly equal. For estimated frequencies from a large number of runs, the sorted frequencies will help spot where two frequencies are close enough to suspect they might be equal in the theoretical limit (which would make the answer invalid).- ## Scoring
- This is a [code golf challenge]. Your score is the number of bytes in your code. Lowest score for each language wins.
- > Explanations are optional, but I'm more likely to upvote answers that have one.
- [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
- Output a random digit, with no 2 subsets having equal probability.
- ## Input
- There is no input for this challenge.
- ## Output
- - A single digit from 0 to 9.
- - The output must have a distinct probability of being in each subset of the digits 0 to 9.
- - It follows that every digit must have a non-zero probability of being output.
- ## Examples
- ### Probabilities not unique per digit
- Digit|Probability
- -|-
- 0|0.1
- 1|0.1
- 2|0.1
- 3|0.1
- 4|0.1
- 5|0.1
- 6|0.1
- 7|0.1
- 8|0.1
- 9|0.1
- The digits have equal probabilities of being output. For example:
- - The probability of the output being 0 is 0.1
- - The probability of the output being 1 is 0.1
- So code that results in these probabilities would not be valid.
- ### Probabilities unique per digit but not per subset
- Digit|Probability
- -|-
- 0|0.01
- 1|0.03
- 2|0.05
- 3|0.07
- 4|0.09
- 5|0.11
- 6|0.13
- 7|0.15
- 8|0.17
- 9|0.19
- Every digit has a unique probability of being output. However, some subsets have equal total probability. For example:
- - the probability of the output being a 0 or a 3 is 0.01 + 0.07 = 0.08
- - the probability of the output being a 1 or a 2 is 0.03 + 0.05 = 0.08
- So code that results in these probabilities would not be valid.
- ## Test cases?
- As every answer may take a different approach, and the output is random, there can be no set test cases. Please include an explanation of why the probabilities are distinct for every subset.
- It may help to also include the frequency of each digit over a large number of runs, or the theoretical long term frequencies. If the answer satisfies the requirements then the sum of the frequencies for any subset of the digits 0 to 9 will be unique (no other subset's frequencies will sum to the same total).
- There are 1024 possible subsets of the digits 0 to 9. If you have the frequencies for each of the individual digits, you can use [ THIS PAGE - TODO ] to see the frequencies for all 1024 subsets, sorted by frequency, along with an indication of any which are identical. Note that only theoretical long term frequencies will be exactly equal for an invalid answer. For estimated frequencies from a large number of runs, the sorted frequencies will help spot where two frequencies are close enough to suspect they might be equal in the theoretical limit (which would make the answer invalid).
- ## Scoring
- This is a [code golf challenge]. Your score is the number of bytes in your code. Lowest score for each language wins.
- > Explanations are optional, but I'm more likely to upvote answers that have one.
- [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
#2: Post edited
- Output a random digit, with no 2 subsets having equal probability.
- ## Input
- There is no input for this challenge.
- ## Output
- - A single digit from 0 to 9.
- The output must have a distinct probability of being in each non-empty subset of the digits 0 to 9.- - It follows that every digit must have a non-zero probability of being output.
- ## Examples
- ### Probabilities not unique per digit
- Digit|Probability
- -|-
- 0|0.1
- 1|0.1
- 2|0.1
- 3|0.1
- 4|0.1
- 5|0.1
- 6|0.1
- 7|0.1
- 8|0.1
- 9|0.1
- The digits have equal probabilities of being output. For example:
- - The probability of the output being 0 is 0.1
- - The probability of the output being 1 is 0.1
- So code that results in these probabilities would not be valid.
- ### Probabilities unique per digit but not per subset
- Digit|Probability
- -|-
- 0|0.01
- 1|0.03
- 2|0.05
- 3|0.07
- 4|0.09
- 5|0.11
- 6|0.13
- 7|0.15
- 8|0.17
- 9|0.19
- Every digit has a unique probability of being output. However, some subsets have equal total probability. For example:
- - the probability of the output being a 0 or a 3 is 0.01 + 0.07 = 0.08
- - the probability of the output being a 1 or a 2 is 0.03 + 0.05 = 0.08
- So code that results in these probabilities would not be valid.
- ## Test cases?
- As every answer may take a different approach, and the output is random, there can be no set test cases. Please include an explanation of why the probabilities are distinct for every subset.
- It may help to also include the frequency of each digit over a large number of runs, or the theoretical long term frequencies. If the answer satisfies the requirements then the sum of the frequencies for any subset of the digits 0 to 9 will be unique (no other subset's frequencies will sum to the same total).
- There are 1024 possible subsets of the digits 0 to 9. If you have the frequencies for each of the individual digits, you can use [ THIS PAGE - TODO ] to see the frequencies for all 1024 subsets, sorted by frequency, along with an indication of any which are identical. Note that only theoretical long term frequencies will be exactly equal. For estimated frequencies from a large number of runs, the sorted frequencies will help spot where two frequencies are close enough to suspect they might be equal in the theoretical limit (which would make the answer invalid).
- ## Scoring
- This is a [code golf challenge]. Your score is the number of bytes in your code. Lowest score for each language wins.
- > Explanations are optional, but I'm more likely to upvote answers that have one.
- [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
- Output a random digit, with no 2 subsets having equal probability.
- ## Input
- There is no input for this challenge.
- ## Output
- - A single digit from 0 to 9.
- - The output must have a distinct probability of being in each subset of the digits 0 to 9.
- - It follows that every digit must have a non-zero probability of being output.
- ## Examples
- ### Probabilities not unique per digit
- Digit|Probability
- -|-
- 0|0.1
- 1|0.1
- 2|0.1
- 3|0.1
- 4|0.1
- 5|0.1
- 6|0.1
- 7|0.1
- 8|0.1
- 9|0.1
- The digits have equal probabilities of being output. For example:
- - The probability of the output being 0 is 0.1
- - The probability of the output being 1 is 0.1
- So code that results in these probabilities would not be valid.
- ### Probabilities unique per digit but not per subset
- Digit|Probability
- -|-
- 0|0.01
- 1|0.03
- 2|0.05
- 3|0.07
- 4|0.09
- 5|0.11
- 6|0.13
- 7|0.15
- 8|0.17
- 9|0.19
- Every digit has a unique probability of being output. However, some subsets have equal total probability. For example:
- - the probability of the output being a 0 or a 3 is 0.01 + 0.07 = 0.08
- - the probability of the output being a 1 or a 2 is 0.03 + 0.05 = 0.08
- So code that results in these probabilities would not be valid.
- ## Test cases?
- As every answer may take a different approach, and the output is random, there can be no set test cases. Please include an explanation of why the probabilities are distinct for every subset.
- It may help to also include the frequency of each digit over a large number of runs, or the theoretical long term frequencies. If the answer satisfies the requirements then the sum of the frequencies for any subset of the digits 0 to 9 will be unique (no other subset's frequencies will sum to the same total).
- There are 1024 possible subsets of the digits 0 to 9. If you have the frequencies for each of the individual digits, you can use [ THIS PAGE - TODO ] to see the frequencies for all 1024 subsets, sorted by frequency, along with an indication of any which are identical. Note that only theoretical long term frequencies will be exactly equal. For estimated frequencies from a large number of runs, the sorted frequencies will help spot where two frequencies are close enough to suspect they might be equal in the theoretical limit (which would make the answer invalid).
- ## Scoring
- This is a [code golf challenge]. Your score is the number of bytes in your code. Lowest score for each language wins.
- > Explanations are optional, but I'm more likely to upvote answers that have one.
- [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
#1: Initial revision
Digits with subsets of unique probability
Output a random digit, with no 2 subsets having equal probability. ## Input There is no input for this challenge. ## Output - A single digit from 0 to 9. - The output must have a distinct probability of being in each non-empty subset of the digits 0 to 9. - It follows that every digit must have a non-zero probability of being output. ## Examples ### Probabilities not unique per digit Digit|Probability -|- 0|0.1 1|0.1 2|0.1 3|0.1 4|0.1 5|0.1 6|0.1 7|0.1 8|0.1 9|0.1 The digits have equal probabilities of being output. For example: - The probability of the output being 0 is 0.1 - The probability of the output being 1 is 0.1 So code that results in these probabilities would not be valid. ### Probabilities unique per digit but not per subset Digit|Probability -|- 0|0.01 1|0.03 2|0.05 3|0.07 4|0.09 5|0.11 6|0.13 7|0.15 8|0.17 9|0.19 Every digit has a unique probability of being output. However, some subsets have equal total probability. For example: - the probability of the output being a 0 or a 3 is 0.01 + 0.07 = 0.08 - the probability of the output being a 1 or a 2 is 0.03 + 0.05 = 0.08 So code that results in these probabilities would not be valid. ## Test cases? As every answer may take a different approach, and the output is random, there can be no set test cases. Please include an explanation of why the probabilities are distinct for every subset. It may help to also include the frequency of each digit over a large number of runs, or the theoretical long term frequencies. If the answer satisfies the requirements then the sum of the frequencies for any subset of the digits 0 to 9 will be unique (no other subset's frequencies will sum to the same total). There are 1024 possible subsets of the digits 0 to 9. If you have the frequencies for each of the individual digits, you can use [ THIS PAGE - TODO ] to see the frequencies for all 1024 subsets, sorted by frequency, along with an indication of any which are identical. Note that only theoretical long term frequencies will be exactly equal. For estimated frequencies from a large number of runs, the sorted frequencies will help spot where two frequencies are close enough to suspect they might be equal in the theoretical limit (which would make the answer invalid). ## Scoring This is a [code golf challenge]. Your score is the number of bytes in your code. Lowest score for each language wins. > Explanations are optional, but I'm more likely to upvote answers that have one. [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"