# Tag Info

### What an Odd Function

Jelly, 7 bytes Æf^<¥4P Swaps 2s and 3s in the input's prime factorization. The probability of odds is 2/3. Try it online! How it works ...
• 210k
Accepted

### Pick a random number between 0 and n using a constant source of randomness

x86 machines with rdrand instruction, 10 bytes ...
• 1,976

### Pick a random number between 0 and n using a constant source of randomness

Jelly, 7 6 bytes ⁴!!X%‘ Thanks to @JonathanAllan for golfing off 1 byte! Cannot be run on TIO because (16!)! is a huge number. How it works ...
• 210k

### Plot the Gaussian Distribution in 3D

C++, 3477 3344 bytes Byte count does not include the unnecessary newlines. MD XF golfed off 133 bytes. There's no way C++ can compete for this, but I thought it would be fun to write a software ...

### Sample a random non-decreasing sequence

Python, 89 bytes from random import* lambda n,k:[x-i for i,x in enumerate(sorted(sample(range(1,n+k),k)))] Generating an increasing sequence rather than a non-...
• 145k

### What an Odd Function

Husk, 11 10 bytes -1 byte thanks to Leo, and a slightly different function This has an odd probability of 1 !uΣz:NCNİ1 Try ...
• 11.6k

### Pick a random number between 0 and n using a constant source of randomness

Mathematica, 29 bytes Based on Dennis's Jelly answer. RandomInteger[2*^9!-1]~Mod~#& I wouldn't recommend actually running this. ...
• 197k

### Compute the histogram entropy estimation of a string

Python 3.3+, 64 bytes import math lambda s:sum(math.log2(len(s)/s.count(c))for c in s) Got math.log2 from mbomb007's solution.
• 145k
Accepted

### Estimate the mean minimum Hamming distance

Python 3, score = big(?) ...
• 39.7k

### Plot the Gaussian Distribution in 3D

Mathematica, 47 bytes Plot3D[E^(-(x^2+y^2)/2/#^2),{x,-6,6},{y,-6,6}]& takes as input σ Input [2] output -2 bytes thanks to LLlAMnYP
• 24.9k

### Frequency Distribution of Multiple Dice Rolls

Octave, 38 bytes @(a,b)round(ifft(fft((a:a*b<a+b)).^a)) Try it online! Explanation Adding independent random variables corresponds to convolving their ...
• 105k

### Calculate the probability of getting to the target first (exactly)

Wolfram Language (Mathematica), 25 bytes $$n! \div \left( \sum ^n _{k=0} k!(n-k)! \right)$$ #!/Sum[k!(#-k)!,{k,0,#}]& Try it online! -4 bytes from @ovs
• 24.9k
Accepted

### Weighted coin flip strings

05AB1E, 40 39 18 17 bytes Brute-force approach: 0Lα1Ý²ãʒγOà³@}èPO Byte-count more than halved by porting @JonathanAllan's Jelly answer, which uses a similar ...
• 128k

### Probability of something happening at least n out of m times

Mathematica, 29 bytes BetaRegularized[#3,#,1+#2-#]& Takes input in the order n,m,p. Mathematica is so good, it even golfs ...
• 61.9k

### Pick a random number between 0 and n using a constant source of randomness

Brachylog, 9 bytes ≥.∧13ḟṙ|↰ Try it online! This uses 13! like in Martin Ender's answer (13ḟ...
• 38.9k

### Hand patterns in a card game

APL (Dyalog Unicode), 30 chars ×/!⍨,z,1÷((z←!∘≢⊢)⌸⊢),×∘≢!⍨1⊥⊢ Try it online! Using @orlp’s formula.
• 3,732

### Probabilistic approach puzzle

Wolfram Language (Mathematica), 33 bytes Uses Binomial and outputs ,really fast, fractions Tr@Binomial[#,Prime@Range@#]/2^#& Try it online! The ...
• 24.9k

### Probabilistically fair prize splitting for two-player coin toss

R, 36 32 bytes function(X,A,B)pbeta(.5,X-A,X-B) Try it online! The closed formula from this answer suggested a natural probability distribution to use -- this ...
• 28.6k

### Lucky dice rolls

AnyDice, 82 bytes function:l N K L{ifL<0{result:[lowestNof(N-L)dK]}else{result:[highestNof(N+L)dK]}} Try it online! For the output, check the "export" view ...
• 14.4k

### Odds for second smallest prime factor

Vyxal, 8 bytes ¡ƛǏḣh;=ṁ Try it Online! -2 thanks to tsh, -1 thanks to lyxal. ...
• 38.8k

• 1,985

### What an Odd Function

Husk, 8 bytes !uΣzeİ1N Try it online! This implements the example sequence (1,3,2,5,7,4...). Explanation ...
• 12.7k

### Frequency Distribution of Multiple Dice Rolls

Mathematica, 29 bytes Tally[Tr/@Range@#2~Tuples~#]& Just generates all possible dice rolls, takes their totals, then counts. Each frequency comes labeled ...
• 5,245

### Pick-flatten a list

Wolfram Language (Mathematica), 41 20 bytes Flatten@*Tuples//@#& Try it online! Ignore the many warnings, it all works out in the end. How it works For a ...
• 5,245