Skip to main content
Commonmark migration
Source Link

#PHP, 92 84 bytes

PHP, 92 84 bytes

for($i=65,$x=0;$i<91;$a.=str_repeat(chr($i++),$x))$x++;echo substr($a,rand(0,$x),1);

Builds a string of all letters, repeated the number of times through the loop we are, and then picks a letter from that string at random. Letters later in the alphabet have a higher probability as a result

Thanks to insertusernamehere for shaving off bytes

##outcome probabililities (ordered by %)

outcome probabililities (ordered by %)

A => 0.29%
B => 0.62%
C => 0.82%
D => 1.15%
E => 1.50%
F => 1.65%
G => 2.00%
H => 2.27%
I => 2.52%
J => 2.80%
K => 3.13%
L => 3.47%
M => 3.72%
N => 3.93%
O => 4.15%
P => 4.59%
Q => 4.81%
R => 5.17%
S => 5.44%
T => 5.68%
U => 6.06%
V => 6.13%
W => 6.60%
X => 6.95%
Y => 7.17%
Z => 7.38%

#PHP, 92 84 bytes

for($i=65,$x=0;$i<91;$a.=str_repeat(chr($i++),$x))$x++;echo substr($a,rand(0,$x),1);

Builds a string of all letters, repeated the number of times through the loop we are, and then picks a letter from that string at random. Letters later in the alphabet have a higher probability as a result

Thanks to insertusernamehere for shaving off bytes

##outcome probabililities (ordered by %)

A => 0.29%
B => 0.62%
C => 0.82%
D => 1.15%
E => 1.50%
F => 1.65%
G => 2.00%
H => 2.27%
I => 2.52%
J => 2.80%
K => 3.13%
L => 3.47%
M => 3.72%
N => 3.93%
O => 4.15%
P => 4.59%
Q => 4.81%
R => 5.17%
S => 5.44%
T => 5.68%
U => 6.06%
V => 6.13%
W => 6.60%
X => 6.95%
Y => 7.17%
Z => 7.38%

PHP, 92 84 bytes

for($i=65,$x=0;$i<91;$a.=str_repeat(chr($i++),$x))$x++;echo substr($a,rand(0,$x),1);

Builds a string of all letters, repeated the number of times through the loop we are, and then picks a letter from that string at random. Letters later in the alphabet have a higher probability as a result

Thanks to insertusernamehere for shaving off bytes

outcome probabililities (ordered by %)

A => 0.29%
B => 0.62%
C => 0.82%
D => 1.15%
E => 1.50%
F => 1.65%
G => 2.00%
H => 2.27%
I => 2.52%
J => 2.80%
K => 3.13%
L => 3.47%
M => 3.72%
N => 3.93%
O => 4.15%
P => 4.59%
Q => 4.81%
R => 5.17%
S => 5.44%
T => 5.68%
U => 6.06%
V => 6.13%
W => 6.60%
X => 6.95%
Y => 7.17%
Z => 7.38%

add outcome probablilities
Source Link
gabe3886
  • 221
  • 1
  • 6

#PHP, 92 84 bytes

for($i=65,$x=0;$i<91;$a.=str_repeat(chr($i++),$x))$x++;echo substr($a,rand(0,$x),1);

Builds a string of all letters, repeated the number of times through the loop we are, and then picks a letter from that string at random. Letters later in the alphabet have a higher probability as a result

Thanks to insertusernamehere for shaving off bytes

##outcome probabililities (ordered by %)

A => 0.29%
B => 0.62%
C => 0.82%
D => 1.15%
E => 1.50%
F => 1.65%
G => 2.00%
H => 2.27%
I => 2.52%
J => 2.80%
K => 3.13%
L => 3.47%
M => 3.72%
N => 3.93%
O => 4.15%
P => 4.59%
Q => 4.81%
R => 5.17%
S => 5.44%
T => 5.68%
U => 6.06%
V => 6.13%
W => 6.60%
X => 6.95%
Y => 7.17%
Z => 7.38%

#PHP, 92 84 bytes

for($i=65,$x=0;$i<91;$a.=str_repeat(chr($i++),$x))$x++;echo substr($a,rand(0,$x),1);

Builds a string of all letters, repeated the number of times through the loop we are, and then picks a letter from that string at random. Letters later in the alphabet have a higher probability as a result

Thanks to insertusernamehere for shaving off bytes

#PHP, 92 84 bytes

for($i=65,$x=0;$i<91;$a.=str_repeat(chr($i++),$x))$x++;echo substr($a,rand(0,$x),1);

Builds a string of all letters, repeated the number of times through the loop we are, and then picks a letter from that string at random. Letters later in the alphabet have a higher probability as a result

Thanks to insertusernamehere for shaving off bytes

##outcome probabililities (ordered by %)

A => 0.29%
B => 0.62%
C => 0.82%
D => 1.15%
E => 1.50%
F => 1.65%
G => 2.00%
H => 2.27%
I => 2.52%
J => 2.80%
K => 3.13%
L => 3.47%
M => 3.72%
N => 3.93%
O => 4.15%
P => 4.59%
Q => 4.81%
R => 5.17%
S => 5.44%
T => 5.68%
U => 6.06%
V => 6.13%
W => 6.60%
X => 6.95%
Y => 7.17%
Z => 7.38%

golf the code further
Source Link
gabe3886
  • 221
  • 1
  • 6

#PHP, 9292 84 bytes

for($i=65,$x=0,$a;$i<91;$i++){$x++;$a$x=0;$i<91;$a.=str_repeat(chr($i$i++),$x);}echo)$x++;echo substr($a,rand(0,$x),1);

Builds a string of all letters, repeated the number of times through the loop we are, and then picks a letter from that string at random. Letters later in the alphabet have a higher probability as a result

Thanks to insertusernamehere for shaving off bytes

#PHP, 92 bytes

for($i=65,$x=0,$a;$i<91;$i++){$x++;$a.=str_repeat(chr($i),$x);}echo substr($a,rand(0,$x),1);

Builds a string of all letters, repeated the number of times through the loop we are, and then picks a letter from that string at random. Letters later in the alphabet have a higher probability as a result

#PHP, 92 84 bytes

for($i=65,$x=0;$i<91;$a.=str_repeat(chr($i++),$x))$x++;echo substr($a,rand(0,$x),1);

Builds a string of all letters, repeated the number of times through the loop we are, and then picks a letter from that string at random. Letters later in the alphabet have a higher probability as a result

Thanks to insertusernamehere for shaving off bytes

make probabilities distinct
Source Link
gabe3886
  • 221
  • 1
  • 6
Loading
Post Undeleted by gabe3886
Post Deleted by gabe3886
Source Link
gabe3886
  • 221
  • 1
  • 6
Loading