# Introduction

The game Minecraft has a 1 in 10000 chance of showing "Minceraft" instead of "Minecraft" on the title screen.

Your challenge is to code a function or program that takes no input, and on average 1 of 10000 times, returns "Minceraft" and the rest of the time returns "Minecraft".

# Scoring

This is , shortest wins!

• All solutions so far will not satisfy the challenge as stated (they might, but highly unlikely). It has in fact been misstated - it is correct in the introduction, but the challenge asks for something different Apr 25 '21 at 11:10
• The introduction talks about a 1 in 10000 chance, whereas the challenge asks for a function/program that returns "Minceraft" EXACTLY once and "Minecraft" the rest of the time. This would be achieved with a loop. The solutions below are doing what is stated in the introduction, which is different Apr 25 '21 at 11:15
• Suggest edit: "on average 1 out of 10000 times", assuming this is the intention, to satisfy nitpickers... Apr 25 '21 at 11:16
• how precisly does it have to be 1/10000 ? multiple answers have 1/10001 for example Apr 26 '21 at 14:01
• When I first saw the title I thought the goal is to implement the entire game of minecraft in shortest possible amount of code. Sep 22 '21 at 17:39

# Minecraft, 358293277 276 bytes

Implementing Minceraft in Minecraft

Should be run as a set of commands in game. Should be run on a fresh superflat (redstone ready) world. Byte count is the amount of characters you need to type, including newlines.

/scoreboard objectives add s dummy
/summon bat
/execute as @e[type=bat] store result score o s run data get entity @s UUID[1]
/scoreboard players set c s 2147054151
/execute if score o s < c s run tellraw @s "Minecraft"
/execute if score o s >= c s run tellraw @s "Minceraft"


The UUID of an entity is (mostly) randomly generated and stored as four signed 32 bit integers. One of the integers is compared with 2147054151 which is one ten thousandth of the way between 2^31 and -2^31.

Previous solution because it was so high effort and I'm not deleting it:

## Minecraft, 293 bytes

/scoreboard objectives add s dummy
/summon horse
/execute as @e[type=horse] store result score o s run data get entity @s Attributes[1].Base 100000
/scoreboard players set c s 11883
/execute if score o s >= c s run tellraw @s "Minecraft"
/execute if score o s < c s run tellraw @s "Minceraft"


### How does it work?

In Minecraft, there are only a limited amount of sources of reliable randomness usable in commands. In Minecraft Functions you can use predicates with specific random chances, but that requires multiple files and submitting that as a zipped data pack would be at least 1 KB.

To avoid this and have it run solely from commands a player can type in, this uses horses as a random source. When a horse is spawned, it is assigned a random speed between 0.1125 and 0.3375 (the units are arbitrary). The random speed calculation is as follows:

$$0.25(0.45 + 0.3x + 0.3y + 0.3z)$$

Where x, y, and z are uniform independent random variables [0, 1). If you find the cumulative density function by convolving the distribution functions (to get the PDF) and then integrating, you will end up with the following piecewise function:

$$f(x)=\begin{cases}-\frac{9}{16}+15x-\frac{400x^{2}}{3}+\frac{32000x^{3}}{81}&\frac{9}{80}\le x<\frac{3}{16}\\ \frac{29}{4}-110x+\frac{1600x^{2}}{3}-\frac{64000x^{3}}{81}&\frac{3}{16}\le x<\frac{21}{80}\\ -\frac{227}{16}+135x-400x^{2}+\frac{32000x^{3}}{81}&\frac{21}{80}\le x<\frac{27}{80} \end{cases}$$

We need to find the horse speed where the probability of a horse with that speed or lower spawning is one in ten thousand or 0.0001. This can be done by solving the first equation:

$$-\frac{9}{16}+15x-\frac{400x^{2}}{3}+\frac{32000x^{3}}{81} = 0.0001\\ f^{-1}(0.0001)\simeq0.11882574$$

This results in the horse speed being multiplied by 100,000 (because scoreboard values must be integers) and compared with 11883 in the code.

The precision is currently 1.00202 in 10,000. Two bytes can be added or removed for approximately each order of magnitude required. Two additional bytes will make it 1.00012 in 10,000.

• I see no reason to run these separately over putting them all in a .mcfunction file and running that. Apr 27 '21 at 7:11
• Minecraft datapacks require a pack.mcmeta which would make it too expensive. However, I am not certain of the consensus regarding Minecraft commands.
– Okx
Apr 27 '21 at 7:20
• I'd argue the pack.mcmeta doesn't count towards the size, only the .mcfunction file. After all, codegolf.stackexchange.com/a/224450/62991 doesn't count the time module's size either. Apr 27 '21 at 7:23
• This is also a "full program" (as much as you can get a full program in Minecraft) compared to a function as you cannot reliably run it multiple times in one world.
– Okx
Apr 27 '21 at 16:23
• Aww, I was hoping you built a giant Redstone computer in the game to run this program, would be hard to give that a byte-count though. Maybe count in number of blocks? Apr 27 '21 at 18:08

# Python 3, 63 59 bytes

My idea was to use the time module as a PRNG since the challenge stated

on average 1 of 10000 times, returns "Minceraft" and the rest of the time returns "Minecraft"

and taking the time mod 10000 does exactly that.

Thanks @movatica for -4

import time
print(f"Min{'ceec'[time.time()%1e4>1::2]}raft")


Try it online!

Alternative, also 59 bytes:

import time
print("Min%sraft"%"ceec"[time.time()%1e4>1::2])


Try it online!

• Right, fixed. :) Apr 26 '21 at 13:40
• you should add a tio link, so that it's easier for other people to test your code Apr 26 '21 at 14:13
• Can't you replace time()%1e4>1 and'ec'or'ce' with ['ec','ce'][time()%1e4>1] for -1? Apr 26 '21 at 14:40
• Welcome to codegolf! 59 bytes Apr 26 '21 at 17:02
• 45 bytes May 4 '21 at 19:13

# Python 3, 787169 68 bytes

from random import*
f=lambda:f'Min{randint(0,1e4)and"ec"or"ce"}raft'


Try it online!

-7 bytes thanks to @Alex bries

-2 bytes thanks to @Alex bries

• you only need to return it: try it online Apr 25 '21 at 11:07
• f=lambda:f'Min{__import__("random").randint(0,1e4)and"ec"or"ce"}raft' is 69, but since you can remove f= that evaluates to 67.
– user100690
Apr 25 '21 at 12:16
• 67 bytes Apr 25 '21 at 12:34
• 65 bytes Apr 25 '21 at 12:43
• 63 bytes, I think it warrants its own answer: codegolf.stackexchange.com/a/224450/103324 Apr 26 '21 at 11:31

## Python 3 - 4542 41 Bytes

41 bytes with the constraint of running from a different process every run.

print(f"Min{'ceec'[id(0)%4e4>1::2]}raft")


42 bytes with limited randomness unless running a different process each time [*].

print(f"Min{'ceec'[id({})%4e4>1::2]}raft")


The idea was to use the same wrapper as in here, but a different RNG:
Create a new object (a set dict in this case, because it takes 5 2 characters set() {}), and take the id() of that, which is its memory address.

The memory address acts like a uniform hash[*], which has 1/10000 1/40000 (thanks @ovs) chance to end with zeros.

Try it online!

Update to 42 bytes:
Instead of set(), use {} which is the dict constructor. Can't go shorter for dynamic object creation.

Try it online!

Update to 41 bytes: - use static object creation!
Thanks to @dingledooper
Works only if the program is run in a different process every run!
Instead of {}, use 0.
0 is an object in Python, so it has an address in virtual memory, and that address is constant for that object during the lifetime of the program. If we were to run that in a for loop, it would not be random.
However, if we run it in a new process every run, we get the desired randomness. This is the case in a stateless server.

Try it online!

[*] - Objects in Python are freed immediately when they are no longer referenced (reference counting). Thus, running the solution in a loop might always output the same id, as the memory is freed and allocated at the same address. This is OS dependent, and environment dependent, thus may not work as expected, or in a reproducible way.
Running a new process each time solves this issue.

• Welcome to CGCC, that's a very nice answer! By my experimentation it seems that memory addresses of set() are always divisible by 4, which means you would need to change 1e4 to 4e4 to get the right probability.
– ovs
May 4 '21 at 21:51
• @ovs wow that's a very nice catch, thanks! May 4 '21 at 21:55
• Wow. And I thought using time was nice... May 4 '21 at 23:09
• Does id(0) work here? May 5 '21 at 9:06
• @Jakque I think this has to be OS specific. I would like to ask a question about this in SO, please add the specifications on which you tested, and the code. May 10 '21 at 7:03

# Taxi, 632 bytes

Go to Heisenberg's:W 1 R 3 R 1 L.Pickup a passenger going to Divide and Conquer.1073741824e-4 is waiting at Starchild Numerology.Go to Starchild Numerology:N 1 L 3 L 1 L 3 L.Pickup a passenger going to Divide and Conquer.Go to Divide and Conquer:W 1 R 3 R 1 R 2 R 1 R.Pickup a passenger going to Trunkers.Go to Trunkers:E 1 R 3 R 1 L.Pickup a passenger going to The Underground.Go to The Underground:E 1 R 2 L.Switch to plan A if no one is waiting.Minecraft is waiting at Writer's Depot.[A]Minceraft is waiting at Writer's Depot.Go to Writer's Depot:N 3 L 2 L.Pickup a passenger going to Post Office.Go to Post Office:N 1 R 2 R 1 L.


Try it online!

There are two sources of randomness in Taxi: Heisenberg's (which holds a random integer passenger), and Firemouth Grill (which can hold any number of passengers, who are picked up in a random order).

This program uses Heisenberg's to grab a random number, which will be used to choose one of two strings randomly.

Here is the basic control flow of the program:

• Go to Heisenberg's and grab a random integer, in the range of $$\[0, 2^{31}-1]\$$. ($$\2^{31}-1\$$ is RAND_MAX in C++, and Taxi uses C++'s random functions.)
• Pick up the value 1073741824e-4 (that's $$\\frac{2^{31}}{2 \times 10000}\$$) from Starchild Numerology.
• Drop off both passengers at Divide and Conquer, giving us a result of $$\\frac{n}{2^{31}} \times 2 \times 10000\$$, which is a double in the range $$\[0, 2 \times 10000)\$$. (We use this range instead of $$\[0, 10000)\$$ because we will output Minceraft when this number is either 0 or 1.)
• Bring this result to Trunkers, which chops off the fractional part. (The range is still $$\[0, 2 \times 10000)\$$.)
• Bring this result to The Underground. One of two things will happen:
• A passenger will be returned, which means that our number was greater than 1 (which has a $$\\frac{2 \times 10000 - 2}{2 \times 10000}\$$ chance of occurring). Do nothing.
• No passenger will be returned, which means that our number was either 0 or 1 (which has a $$\\frac{2}{2 \times 10000}\$$ chance of occurring). Declare the value "Minceraft" at Writer's Depot.
• Declare the value "Minecraft" at Writer's Depot.
• Pick up the first passenger waiting at Writer's Depot. (If both "Minecraft" and "Minceraft" are waiting, "Minceraft" will be picked up, because it was waiting there first.)
• Drop off this passenger at the Post Office, outputting the string and (for purposes of Code Golf) ending the program.

# Taxi, 691 bytes

1e4 is waiting at Starchild Numerology.Go to Starchild Numerology:W 1 L 2 R 1 L 1 L 2 L.Pickup a passenger going to The Underground.Minceraft is waiting at Writer's Depot.Go to Writer's Depot:E 1 L 2 R.[A]Pickup a passenger going to Cyclone.Go to Cyclone:N.Pickup a passenger going to Firemouth Grill.Pickup a passenger going to Firemouth Grill.Go to Firemouth Grill:S 1 L 2 L 1 R.Go to Fueler Up:E 1 L.Go to The Underground:N.Switch to plan B if no one is waiting.Pickup a passenger going to The Underground.Minecraft is waiting at Writer's Depot.Go to Writer's Depot:N 3 L 2 L.Switch to plan A.[B]Go to Firemouth Grill:S 1 R.Pickup a passenger going to Post Office.Go to Post Office:E 1 R.


Try it online!

This program uses Firemouth Grill to hold thousands of "Minecraft" and "Minceraft" strings to choose from randomly.

Here is the basic control flow of the program:

• Pick up the value 1e4 from Starchild Numerology to use as a counter.
• Declare the value "Minceraft" at Writer's Depot and go there (but don't pick it up yet).
• Repeat these steps:
• Pick up the string currently at Writer's Depot, and clone it at Cyclone. (Having two strings along for the ride will earn us extra gas money!)
• Take both clones, and drop them off at Firemouth Grill.
• Take our counter, and drop it off at The Underground. One of two things will happen:
• A passenger will be left waiting, which was 1 less than our previous counter. Pick up this new counter, and declare the value "Minecraft" at Writer's Depot and go there. At this point, repeat the previous steps.
• No passenger will be left waiting, which means that our counter is now 0 and we are done.
• Go to Firemouth Grill, and pick up a passenger. It will most likely be "Minecraft", but there's a 1/10000 chance it will be "Minceraft".
• Drop off this passenger at the Post Office, outputting the string and (for purposes of Code Golf) ending the program.

# Taxi, 849 bytes

Go to Fueler Up:W 1 R.Switch to plan B.[A]Go to Fueler Up:E 2 L.[B]Go to Heisenberg's:N 3 R 1 L.Pickup a passenger going to Cyclone.Go to Cyclone:N 1 L 3 L.Pickup a passenger going to Magic Eight.Pickup a passenger going to Cyclone.Go to Cyclone:N 1 R 3 R 1 R.Pickup a passenger going to Equal's Corner.Pickup a passenger going to Equal's Corner.Go to Equal's Corner:N 1 R.2e4 is waiting at Starchild Numerology.Go to Starchild Numerology:N 1 R.Pickup a passenger going to Magic Eight.Go to Magic Eight:W 1 R 2 R 1 R.Switch to plan A if no one is waiting.Pickup a passenger going to The Underground.Go to The Underground:E 2 L.Switch to plan C if no one is waiting.Minecraft is waiting at Writer's Depot.[C]Minceraft is waiting at Writer's Depot.Go to Writer's Depot:N 3 L 2 L.Pickup a passenger going to Post Office.Go to Post Office:N 1 R 2 R 1 L.


Try it online!

This was my first instinct. It also uses Heisenberg's to generate a random integer within the range $$\[0, 2 \times 10000)\$$, but it does so by repeatedly generating a random number until it is within this range. The taxi has to stop at Fueler Up to refill its gas tank, and it has to clone passengers at Cyclone and drop the clones off at Equal's Corner to make enough money to re-generate random numbers for as long as necessary, but otherwise, the functionality is the same as the 632-byte program.

It doesn't depend on the specifics of C++, but it does usually take longer to execute, because generating a small enough random number is rarer. If anyone can improve this one, be my guest.

# JavaScript, 37 bytes

_=>Min${new Date%1e4?'ec':'ce'}raft  Try It Online First of all, write Min. Then get the current time with new Date. Normally it returns something similar to "2021-10-05T10:29:58.432Z". But if you do a mathematical operation on it, this output becomes the epoch time similar to "1633429932422" (a number, basically). Now divide the number by 10000 (1e4). If the remainder (%) is 0 i.e. false, add ce to Min otherwise add ec. At last, add raft at the end. • Welcome to Code Golf, and nice first answer! May 5 '21 at 22:17 • Thanks, wonder if anything can be improved here! May 6 '21 at 6:22 • I'm not that fluent with JavaScript, so I can't really see any improvements you could make. But there might be a way! May 6 '21 at 16:16 # C (gcc), 48 bytes f(){printf("Min%sraft",rand()%10000?"ec":"ce");}  Try it online! ### Version closer to $$\\frac{1}{10000}\$$ For a pseudorandomness as close to $$\\frac{1}{10000}\$$ as possible: # C (gcc), 79 bytes f(){long p=0,m=1e4,i;for(i=m;i--;)p+=rand();printf("Min%sraft",p%m?"ec":"ce");}  Try it online! • Nice! Can you have 1e4 or 1e+4 in C? Apr 25 '21 at 12:29 • @Ausername float can't be %ed – l4m2 Apr 25 '21 at 12:47 • @Ausername Yes C has that but it's a float and you need an integral type for a mod (%) expression. Apr 25 '21 at 19:20 • This will not result in a 1/10000 chance if RAND_MAX is not a multiple of 10000. Apr 26 '21 at 4:54 • @ericw31415 You might as well post this comment for every answer since they're all using PRNGs that work on scales of powers of $2$. Plus they're PRNGs not RNGs so there's no way to make them perfectly random. Apr 26 '21 at 13:25 # R, 4544 43 bytes if(runif(1)<1e-4,"Minceraft","Minecraft")  Try it online! Boring, but shorter than any more-interesting attempt that I've tried so far... # R, 42 bytes (p=0.000101) p=1 in 10000.5 Edit: much closer to exactly 1 in 10000 (for the same bytes) thanks to Robin Ryder if(rexp(1)>1e-4,"Minecraft","Minceraft")  Try it online! Outputs "Minecraft" if an exponentially-distributed random variable is greater than 1e-4. The exponential distribution is governed by a parameter - lambda - that defaults to 1 in the R rexp() function. This gives cumulative p(up to x)=1-exp(-lambda*x), equal to 9.9995e-05 with x=1e-4 and lamda=1, which is pretty close to 1 in 10000 (actually 1 in 10000.5). • Alternate 43 byte solution: c("Minecraft","Minceraft")[1.0001+runif(1)] Apr 27 '21 at 16:50 • @RobinRyder - That's nice. I also realised we can also get almost to within 1% of the exact probability using a carefully-selected Poisson distribution, which would save 1 byte... Apr 27 '21 at 18:19 • If you want an approximation of the probability, this is also 42 bytes and is more accurate, with P("Minceraft")=0.000100005. Apr 27 '21 at 21:10 • @RobinRyder - That's much better! Before I update the answer and credit you, can you just check my maths? Cumulative exponential distribution is 1-exp(-lambda*x), so with (default) rate=lambda=1, p(up to 1e-4)=1-exp(-0.0001)=9.9995e-05, right? In other words, pexp(1,rate=0.0001,lower.tail=T)? Or did I get something upside-down? Apr 27 '21 at 21:39 • Yes, you are right - the number I gave mistakenly was the value of lambda that would have led to an exact answer. Instead, the probability is indeed 0.000099995. Apr 28 '21 at 6:20 # Clojure, 42 bytes #(str"Min"(if(<(rand)1e-4)"ce""ec")"raft")  Try it online! # Charcoal, 17 bytes MinＰceraft¿‽×χφec  Try it online! Link is to verbose version of code. Explanation: Min  Print Min. Ｐceraft  Print ceraft without moving the cursor. ¿‽×χφ  If a random number in the range [0..10000) is nonzero, then... ec  ... correct it to ec. # Retina, 29 bytes  ce9999*$(ec
L@$.. Min$&raft


Try it online! Explanation:


ce9999*$(ec  Insert ce and 9999 copies of ec. L@..  Select one of the pairs of letters at random.... L$
Min$&raft  ... and wrap it between Min and raft. # APL, 26 bytes 'Min','raft',⍨'ec'⌽⍨1=?1E4  Saved 1 byte thanks to Adam • Welcome to Code Golf, and nice first answer! If you're interested in learning more APL, feel free to drop by The APL Orchard Dec 24 '21 at 16:14 • 10*4 is 1E4 – Adám Dec 29 '21 at 11:35 # PowerShell, 38 bytes "Min$(('ec','ce')[!(random 1e4)])raft"


Try it online!

• I don't know Powershell, but 1000 is 1e4, not 1e5. Is that a mistake? Apr 25 '21 at 12:58
• thanks. The rule is "The game Minecraft has a 1 in 10000 chance". 10000 == 1e5 isn't it? Apr 25 '21 at 13:04
• Sorry, typo in my original comment. I meant 10000, not 1000. However 10000 == 1e4: Try it online! A helpful way to remember is that the number after the 1e counts the zeros, not the digits Apr 25 '21 at 13:05
• Of course!) I'm sorry. Fixed. Thank you! Apr 25 '21 at 13:07

# V (vim), 80 bytes

iMin<Esc>:r!echo $RANDOM C<c-r>=<c-r>"%10000 <esc>:s/^0\n/ce :s/\d\+/ec kgJAraft  Try it online! Generate a random no. in 0-9999, and then replace 0 with ce and anything else with ec. • i<C-r>=rand()%10000<cr><esc> is the random generator I came up with, doesn't work on TIO though sadly. Apr 26 '21 at 17:34 • I think rand() needs a seed but I'm not too sure of it. Apr 27 '21 at 1:40 # Jelly, 18 17 bytes “ẹ?ŀɼƲṬỴȧ»ȷ4XỊịḲ  Try it online! Full program. -1 byte thanks to Jonathan Allan! ## How it works “ẹ?ŀɼƲṬỴȧ»ȷ4XỊịḲ - Main link. Takes no arguments “ẹ?ŀɼƲṬỴȧ» - Compressed string "Minceraft Minecraft"; Call that S ȷ4 - 10000 X - Random integer between 1 and 10000 Ị - Is that equal to 1? Ḳ - Split S on spaces ị - Index into the split S  • A 17: “ẹ?ŀɼƲṬỴȧ»ȷ4XỊịḲ. (Also, another 18: ȷ4XỊ⁾ecṙ“¡Œ!“¡^Ð»j.) Apr 25 '21 at 13:24 • @JonathanAllan Oh, nice, thanks! (also, got to love comment markdown ಠ_ಠ) Apr 25 '21 at 13:27 # J, 28 25 bytes 'Minecraft'120&A.~0=?@1e4  Try it online! -3 thanks to Bubbler Note: J does not allow 0-argument functions, but this function ignores it's argument, which is the J equivalent To see this work, change 1e4 to 2 in the TIO, which will make the letter swap happen 50% of the time. • 0=?@1e4 Does a random number between 0 and 9999 inclusive equal 0? Returns 1 one in 10000 times. • 120&A. Transposes the requires letters. • Conditional execution at rate according to step 1 happens as a result of the way & works when invoked dyadically. ## alternative 1, 27 bytes 4|.'raftMin','ec'|.~0=?@1e4  Try it online! Rotate |. the string 'ec' with probability 1/10k, then append it to the string 'raftMin, then rotate the result by 4. ## alternative 2, 28 bytes 'Minecraft'C.~3<@,4#~0=?@1e4  Try it online! • 25 bytes for 120&A. one. Apr 25 '21 at 23:35 # Python 2, 62 61 bytes -1 byte thanks to xnor! from random import* print'Min%sraft'%'ceec'[random()>1e-4::2]  Try it online! If a probability of $$\\left({92 \over 256}\right)^9 \approx 0.0000999841\$$ to print Minceraft is fine, 59 bytes is possible: import os print'Min%sraft'%'ceec'[max(os.urandom(9))>91::2]  Try it online! # Python 2, 63 bytes from random import* print'Min%xraft'%(236-30*0**randrange(1e4))  Try it online! • The CE/EC reversal is cute but it turns out shorter to just do a generic [::2] selector: TIO – xnor Apr 26 '21 at 5:01 # Swift, 55 53 bytes print(.random(in:1...1e4)<2 ?"Minceraft":"Minecraft")  Try it online! This is also my first Code Golf post. Thanks to @Dingus for getting taking off 2 bytes! • Welcome to CGCC! 53 bytes with two small tweaks. Apr 26 '21 at 2:08 • @Dingus Had no idea you could do 1e4, thanks! Also the < is smart to remove the ==. Apr 26 '21 at 12:04 # 05AB1E, 19 18 bytes „ecтnиćRªΩ”–·ÿraft  Try it online! Run 10000 times „ec push string "ec" т push 100 n squared, 10000 и repeat, push ["ec"]*10000 ć head extract R reverse ª append Ω choose random element ”–·ÿraft push "Min" + tos + "raft", which is implicitly outputed  # Mathematica, 484443 41 bytes If[Random[]<.1^4,"Minceraft","Minecraft"]  Here's a simple unit test which found a bug in my first version. Table[If[Random[]<.1^4,"Minceraft","Minecraft"], {ix, 10^6}] // Counts  And the result: <|"Minecraft" -> 999909, "Minceraft" -> 91|>  • Nice work. To save 4 bytes, note that Random[] does the same thing as RandomReal[]; it's been deprecated since v6 but it still works. Apr 27 '21 at 13:54 • 41 bytes without the <>s. – att Apr 27 '21 at 23:06 • @att, I thought I had tested that idea. Obviously not. It's very pleasing to me, that this version is shorter, and more readable. – John Apr 28 '21 at 12:40 # 05AB1E, 17 bytes ’£Ì³±’œ4°LΩΘ5!*è™  Try it online! ’£Ì³±’ -- "minecraft" œ -- permutations: ["minecraft", "minecratf", ...] 4°LΩ -- random integer in the range 1..10000 Θ -- 1 if it’s equal to 1, 0 otherwise 5!* -- multiply by 5! (120) è -- index into the list of permutations ™ -- titlecase  # JavaScript, 51 44 bytes _=>Min${Math.random()*1e4>1?'ec':'ce'}raft


try it online

That's a lotta bytes for such a simple task...

-7 thanks to the OP

• 44 bytes: _=>Min${Math.random()*1e5>1?'ec':'ce'}raft - Try it online! Apr 25 '21 at 10:48 • or a=>Min${+new Date%10001?'ec':'ce'}raft; but doesn't work consecutively Apr 25 '21 at 10:59
• What's strange here is that someone still upvoted my answer even though I (accidentally) used 1e5 instead of the correct 1e4.
– user100690
Apr 25 '21 at 11:15
• Why not >1e-4 if you use Math.random()?
– l4m2
Apr 25 '21 at 12:48
• @TimSeguine your right, then it should be 37 bytes _=>"Min${new Date%1e4?'ec':'ce'}raft" Apr 27 '21 at 12:47 # Bash, 59 bytes printf "%0.sMinecraft\n" {0..9999}|sed '1s/ec/ce/'|shuf -n1  Try it online! Change 9999 to 1 to see it work with 50% probability. Repeats the line "Minecraft" 10,000 times. Changes the first line only to "Minceraft". Shuffles the lines randomly and returns the first. • -1 byte: Replace \n to actual newline character. Try It Online May 5 '21 at 8:39 # Factor, 40 38 bytes 1e-4 [ "Minceraft"] [ "Minecraft"] ifp  Try it online! -2 bytes thanks to @Bubbler! Factor has a version of if called ifp that calls either quotation depending on a probability. There is also an interpolating version that is slightly longer: 1e4 random 1 < "ce""ec"? [I Min${}raftI]

• You can omit spaces after closing " :) Apr 26 '21 at 0:01
• @Bubbler Thanks. Apr 26 '21 at 0:14

# Ruby, 35 34 bytes

$><<"Min#{rand<1e-4?:ce: :ec}raft"  Try it online! Thanks to Dingus for a saved byte. • If we consider $$ as random number, then we can make it 1b shorter ><<"Min#{$$%1e3<1?:ce: :ec}raft" Jan 7 at 9:46 # Excel, 41 40 bytes -1 byte thanks to MarcMush ="Min"&IF(RAND()<0.1^4,"ce","ec")&"raft"  I tried typing 0.0001 as 1E-4 to save two bytes. Excel changes it to 0.0001. # PHP, 4032 29 bytes <?=Min,rand()%1e4?ec:ce,raft;  Try it online! Not a bad score for good ol' PHP Or even shorter if we allow plain text ouside of the PHP tags (Thanks to Tim Seguine) # PHP, 3329 28 bytes Min<?=rand()%1e4?ec:ce?>raft  Try it online! EDIT: saved another number of bytes by removing all quotes, inspired by another suggestion from Tim Seguine EDIT 2: thanks again to Tim Seguine, now using rand()%1e4 instead of rand(0,1e4) which is not even shorter but more accurate, (at least in TIO, so far as getrandmax() has a high value), and using , to remove the round brackets • isn't this 1 in 10001 instead of 1 in 10000 ? Apr 26 '21 at 13:12 • @MarcMush yes, totally, like many other answers, including the currently most upvoted one. It's as the question states, "on average".. Apr 26 '21 at 13:58 • To have an "exact random chance" to happen, we could just have 9999 instead of 1e4 for 1 byte more Apr 26 '21 at 14:07 • If you move the tags around you can save 7 bytes: Min<?=rand(0,1e4)?'ec':'ce'?>raft Apr 27 '21 at 9:59 • I'll stop posting after this I swear: you can also remove the parens and dots by exploiting comma operators behavior wrt echo which coincidentally fixes the operator precedence issues that PHP's ternary operator has for this golf: <?=Min,rand()%1e4?ec:ce,raft; At this point it almost doesn't even look like real code anymore Apr 27 '21 at 12:19 # Thue, 100 bytes A::=~Minecraft B::=~Minceraft 10::=A 10::=1 12::=A 12::=A 12::=A 12::=A 12::=1 13::=B ::= 1000022223  Try it online! NB: TIO's version of Thue requires a trailing newline. Here is one such interpreter that has no such restriction. You can replace 1000022223 with 103 to convince yourself that a 50-50 chance works (although note again TIO's Thue interpreter seems to seed the RNG with the time in seconds, making quick, successive runs often have the same output). For more convincing, feel free to read my justification below. ## Explanation (For this explanation, I shall substitute "Minecraft" with x and "Minceraft" with y for clarity.) Outputting numbers with an arbitrary random chance isn't straightforward in Thue. We need to output y with a 1 in 10000 chance, and x otherwise. Thue's source of randomness is the way it chooses replacements to make: It samples the available valid substitutions and picks one at random to perform. We can bias the selection by increasing the number of substitutions we want to inflate. The naive approach would be to include 9999 replacements mapping to x, and 1 mapping to y, but this would be an inordinate amount of bytes. Instead, we'll encode 1/10000 by simulating its prime factors: $$\2^4\cdot5^4\$$. We can pretty easily simulate a binary choice: A::=~x B::=~y 13::=B 10::=A 10::=1 ::= 103  50% of the time, we'll replace 10 with A, immediately terminating further substitutions with A. The other 50% of the time, we'll replace it with 1. When we reach 13, we'll output B. We can generalize this quite easily, as inserting $$\N\$$ 0s gives a $$\\frac{1}{2^N}\$$ chance to output B. This process can be thought of as moving the 1 forward along a strip of 0s, with a 50% chance each time to terminate and output x. The 3 acts as the end of the road, allowing us to output B. The odds of it reaching the end are quite clearly $$\\frac{1}{2^N}\$$. Observe the following examples: For 10->A, 10->1: 103 = 50% / 50% (1/2) 1003 = 75% / 25% (1/4) 10003 = 87.5% / 12.5% (1/8) 100003 = 93.75% / 6.25% (1/16)  In fact, we can simulate a $$\\frac{1}{K^N}\$$ chance by having $$\K-1\$$ copies of the replacement 10::=A, and 1 copy of the replacement 10::=1. For $$\K=5\$$, this gives an 80% chance at each step to terminate and output x, rather than the 50% chance in the previous example. Observe the following: For (12->A)x4, 12->1 123 = 80% / 20% (1/5) 1223 = 96% / 4% (1/25) 12223 = 99.2% / 0.8% (1/125) 122223 = 99.84% / 0.16% (1/625)  Concatenating both yields 1000022223, with a combined chance of $$\\frac{1}{2^4}\cdot\frac{1}{5^4}=\frac{1}{10000}\$$. We can justify this to ourselves empirically. For N=1000000 trials, we would expected to see about 1000000/10000 == 100 instances of y. And, from one such trial: x: 999892 (99.98%) y: 108 (0.01%)  We can see this is quite convincingly the case. ## Alternative version, 102 bytes A::=~Minecraft B::=~Minceraft 013::=A 013::=13 12::=A 12::=A 12::=A 12::=A 12::=01 .13::=B ::= .122223  This one generates the 0s on the fly, exploiting the symmetry between the prime factors. It's unfortunately 2 bytes longer, as the more complicated behavior requires extra symbols. ## Metagolfer For similar tasks, where one must output something with a 1/n chance, I've written a Ruby script that compiles a corresponding program. Of course, this works nicer for some numbers rather than others (a prime encoded by this approach requires lines equal to its value), so perhaps some ingenuity would be required for certain cases. if ARGV.empty? STDERR.puts "Insufficient arguments. Usage:" STDERR.puts " #$0 n"
exit 1
end
require 'prime'
$alphabet = "02456789abcdefghijklmnopqrstuvwxyz" n = ARGV[0].to_i comp = "" puts "[COMMENT]::=Inserts B with 1/n probability, A otherwise." Prime::prime_division(n).each_with_index { |(prime, count), i| (1..prime).each { |k| print "1#{$alphabet[i]}::="
puts k == prime ? "1" : "A"
}
comp << $alphabet[i] * count } puts "13::=B" puts "::=" puts "1#{comp}3"  • I was about to post my own Thue answer before I saw this one, but this one beats it by more than half Well done Dec 13 '21 at 0:21 # Zsh--cprecedences, 44 bytes x=(ce ec) <<<Min${x[RANDOM*1e4>>15?2:1]}raft


Try it online! (modified to make it happen 1 in 10 times and then test the program 500 times to build a frequency table)

Unlike the existing Bash answer, this actually has a $$\ \frac{1}{10000} \$$ chance, using (RANDOM*1e4)>>15.

• $RANDOM (henceforth $$\ R \$$) is uniformly distributed in $$\ [0, 2^{15}) \$$ • RANDOM*1e4>>15: (equivalent to $$\ R \times 10000 \div 32768 \$$) gives a uniformly distributed number in the range $$\ [0, 10000) \$$ • Intuitively: $$\ R \times 10000 \$$ changes the range to $$\ [0, 10000 \times 2^{15}) \$$, and $$\ R \times 10000 \div 32768 \$$ changes it to $$\ [0, 10000) \$$ • More formal proof • --cprecendeces changes the precedence of >> to be more normal like in C, so we don't need parentheses around RANDOM*1e4 • So (RANDOM*1e4)>>15?2:1 returns 1 if the number is 0 (i.e., 1 in 10000 times), and 2 otherwise • Then we index that into the array x=(ce ec), returning mostly ec but sometimes ce • Finally, construct the string like Min$raft and <<< print it

# JavaScript (V8), 5650 48 bytes

print(Min\${1e4*Math.random()<2?"ce":"ec"}raft)


Try it online!

Credit to @caird for removing 2 bytes! (Took off a semicolon and changed ==5 to <2)

• Welcome to Code Golf, and nice first answer! Be sure to check out our Tips for golfing in Javascript page for ways you can golf your program Apr 28 '21 at 17:21
• 48 bytes May 3 '21 at 17:13
• In what environment does print()` do that? It doesn't work in Node or Firefox dev console for me? May 4 '21 at 23:55
• It's V8 - Chrome console, for instance. May 6 '21 at 4:22