# 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, 2021 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, 2021 at 11:15
• Suggest edit: "on average 1 out of 10000 times", assuming this is the intention, to satisfy nitpickers... Apr 25, 2021 at 11:16
• how precisly does it have to be 1/10000 ? multiple answers have 1/10001 for example Apr 26, 2021 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, 2021 at 17:39

# Python 3, 8777 73 bytes

Kinda noob solution. Just using random and then substituting with %s.

import random;print("min%sraft"%"ec"if random.randint(1,1e4)<1e4else"ce")

• Got it down to 67 bytes Dec 22, 2021 at 8:53
• Impressive! I forgot that you could do that with python :) Dec 23, 2021 at 11:01

# VyxalṪ, 27 16 bytes

‛↔ṅ‛cek2ʁ℅ßṘr…ż


Try it Online!

• Niice! A couple of ways you can golf this down: decrementing instead of >1 saves a byte, dictionary compression saves a bit more, you can save even more by conditionally reversing ce, and... I'ma just go all the way and give you this 16 bytes Dec 22, 2021 at 20:42
• @emanresuA Thanks. You misspelled Niice, by the way. Dec 22, 2021 at 21:06
• @emanresuA By default, ℅ casts numbers to the range [0..n], which means that this is actually using a 1/10001 chance. Normally, you would be able to fix that by using a flag, but that doesn't seem to be working for that command atm. However, once it gets fixed, you can use flags to get the range generation to [0..n), at which point you can remove the decrement for 15 bytes. Dec 23, 2021 at 13:45
• @AaroneousMiller Here's a patched version Dec 23, 2021 at 20:13

# Befunge-93, 10097 81 bytes

"tfarec"v
77+:v>0#<
v*2\_v
?1v0:#
^#< ^-1\$#+ +55:$<  |-1*:*:
>:#,_@ |<
^ "Min"<


Try it online!

Uses rejection sampling to generate a random integer between 0 and 9999 inclusive, and then swaps the letters if that number is 0.

I abused some coincidences that arose in my code to golf it.

• is the null byte printed after "Minecraft" intentional? Dec 28, 2021 at 4:02
• @Razetime No, it wasn't. I fixed it and removed 3 bytes. Thanks! Dec 28, 2021 at 4:48

# Jelly (fork), 16 bytes

ȷ4XỊị“ẹ?ŀɼƲṬỴȧ«


Try it online!, or rather, don't

Tested on commit 6167f95, made on March 13th. Doesn't work on the latest commit due to a bug (a.k.a I accidentally removed the functionality that makes this work)

## How it works

ȷ4XỊị“ẹ?ŀɼƲṬỴȧ« - Main link. Takes no argument
ȷ4               - 10000
X              - Random integer between 1 and 10000
Ị             - Turn 1 into 1 and everything else into 0
“ẹ?ŀɼƲṬỴȧ« - Compressed dictionary string "Minceraft Minecraft", split on spaces
ị            - Index into the list of words


“...« is a new string terminator introduced in my fork that's equivalent to “...»Ḳ¤/“...»Ỵ¤ in the current version of Jelly. It decompresses the string in between the “...«, then splits on whitespace.

# 05AB1E, 252423 21 bytes

’£Ì³±’™D„ecÂ:‚тnLΩΘè™


Try it online!

I am once again grateful for Kevin's string compressor for providing me with the compressed strings.

## Explained (old)

.•2žéhαP”·úεÕŸ•#тnLΩ1Qè™
.•2žéhαP”·úεÕŸ•#         # the list ["minecraft", "minceraft"]
тnLΩ1Qè  # indexed at the position (random.randint(1, 100 ** 2) == 1)
™ # title cased


()=>$"Min{(new Random().Next(0,9999)>0?"ec":"ce")}raft"  Try it online! • Exactly the same length without interpolation. (I like interpolation too. I was just surprised by the tie.) ()=>new Random().Next(0,9999)>0?"Minecraft":"Minceraft" Apr 26, 2021 at 17:57 • @MerkleGroot I didn't even consider that idea as I was sure it would be longer, but surprisingly it's exactly the same! Guess I overcomplicated it a bit haha Apr 27, 2021 at 8:27 # Scratch, 71 bytes define say[Minecraft if<(pick random(0)to(9999))=[0]>then say[Minceraft  Uses scratchblocks syntax. • but then wouldn't this say minecraft and minceraft one in 10000 times? I believe only Minceraft should be outputted in that case – user100690 May 8, 2021 at 16:41 • @ophact The "say" block makes the sprite display the specified text in a speech bubble, overriding the previously displayed text. Only Minceraft would appear. May 9, 2021 at 15:43 # Raku, 31 bytes {"Min{<ce ec>[rand>1e-4]}raft"}  Try it online! # Wolfram Language, 5047 42 bytes Thanks to MarkMush for -1 byte and Michael Seifert for -4 bytes If[Random[]<.1^4,"Minceraft","Minecraft"]&  Try it online! Unfortunately, joining strings doesn't help to shorten this at all; the following is one byte longer: "Min"<>If[Random[]<.1^4,"ce","ec"]<>"raft"&  Previous solution: RandomChoice[{9999,1}->{"Minecraft","Minceraft"}]&  Try it online! • If you're OK with deprecated functions, Random[] does the same thing as RandomReal[] and saves you four bytes. Apr 27, 2021 at 13:57 # Julia, 39 bytes f()="Min$(rand()<1e-4 ? :ce : :ec)raft"


Try it online!

# C# (Visual C# Interactive Compiler), 54 53 bytes

-1 thanks to caird coinheringaahing

_=>$"Min{(new Random().Next(10000)<1?"ce":"ec")}raft"  Try it online! • Welcome to Code Golf, and nice first answer! Be sure to check out our Tips for golfing in C# page for ways you can golf your program. You can assume an unused input, so can change () to _ for -1 byte Apr 27, 2021 at 20:56 • Thanks for the feedback! Those posts are super helpful Apr 27, 2021 at 21:08 # PPL 1.0.10, 108 bytes importRandom declarex=Random.random()*10000 ifx>1{ printLine("Minecraft") } ifx<=1{ printLine("Minceraft") }  This must use v1.0.10 because imports were introduced. This reuses the "mash together tokens" that emerged as a product of my sloppy lexer writing. # Commented note, comments do not exist in PPL importRandom // import the module Random, one of three standard libraries declarex= // declare variable x Random.random() // set to pseudo-random number between 0 and 1 (random property) * // ... times... 10000 // 10000 (no 1e4) ifx>1{ // if x is greater than 1 then printLine("Minecraft") // print "Minecraft" to STDOUT } // closing code block ifx<=1{ // no "else" in PPL, so use opposite condition instead printLine("Minceraft") // print "Minceraft" to STDOUT } // closing code block  # Java (JDK), 45 bytes e->Math.random()<1e-4?"Minceraft":"Minecraft"  Try it online! # Troll, 40 bytes Prints Minceraft if throwing a 10000-sided die(!?) results in a 1. if1=d10000then"Minceraft"else"Minecraft"  Try it online! (Make random rolls. produces a single output, Calculate probabilities. shows the probability of each possible output) Sadly a lot less things are possible with strings rather than integers, otherwise this would be possible: "Mince"U9999#"Minec"pick1||"raft"  # Python, 73 71 bytes -2 bytes thanks to @cairdcoinheringgaahing from random import* print("Minec%sraft"%("e"if randint(1,1e4)<1else""))  Try it online! Explanation: The first line imports everything from the random module. randint(1,1e4) chooses a random number from 1 to 10000 if it is 1, print Mineceraft. If not, print Minecraft • Welcome to Code Golf, and nice first answer! You can remove the space after the ,, you can change the ==1 to <2, and be sure to check out our Tips for golfing in Python page for ways you can golf your program Sep 14, 2021 at 17:33 # Silicon, 28 23 bytes -5 bytes thanks to @ovs "Min""ec"Ôs~={R}"raft"â  Explanation "Min""ec"Ôs~={R}"raft"â "Min""ec" - Push "Min" and "ec" Ôs - Push 100 and square it ~= - Pick a random number between 0 and 10000, then check if it's equal to the previous stack item {R} - If true, reverse the topmost stack item ("ec") "raft" - Push "raft" â - Join stack <implicit> - Implicit output  28 bytes "Min"ÔÔ*~={"ce},{"ec}"raft"â  First code golf challenge in 5 years! It's good to be back. Silicon uses the CP037 code page. • I think "Min""ec"Ôs~=(R)"raft"â works for 23 – ovs Sep 23, 2021 at 15:03 • @ovs Outgolfed in my own language! Thank you haha :) – m654 Sep 23, 2021 at 17:21 # Braingolf, 25 bytes "Minec"v%*rc?:,|"raft"&@;  Try it online! ### Explanation "Minec" - Push "Minec" to stack v - Switch to next stack % - Niladic modulus, push 100 * - Monadic multiplication, square top of stack (10000) r - Pop top of stack and generate random integer 0 <= n < x where x is popped val c - Collapse stack to main stack ?: | - Pop top of stack, if 0... , - ...swap top 2 items on stack ('e' and 'c') "raft" - Push rest of string &@ - Print entire stack as ASCII ; - Prevent implicit output  When and only when the generated random number is 0, this will output Minceraft, otherwise it will output Minecraft. Braingolf's r instruction uses Python3's random.randrange function, which to my knowledge should be sufficiently uniform for this challenge, and takes an exclusive maximum, meaning calling r on 10000 is equivalent to random.randrange(10000), which generates a number x where 0 <= x < 10000. This leads to a 1/10000 chance of generating a 0, and thus a 1/10000 chance of outputting Minceraft # APOL, 39 bytes +("Min" +(¿(!(∿(õ)) "ce" "ec") "raft")) • 30 bytes: +(Min +(¿(~(ö) ec ce) "raft")) Dec 17, 2021 at 15:54 • @AaroneousMiller That's good, but keep in mind my interpreter doesn't ofccically support strings w/o quotes. Dec 17, 2021 at 16:05 • In that case, +("Min" +(¿(~(ö) "ec" "ce") "raft")) should work for 36 bytes. Dec 17, 2021 at 16:21 # T-SQL, 44 bytes PRINT'MIN'+IIF(RAND()<1E-4,'CE','EC')+'RAFT'  Notes: • PRINT saves one character over SELECT • To easily validate the code, replace 1E-4 (1/10,000) with 1E-1 (1/10), and run it a few dozen times; it should be quick to demonstrate it works as expected. • RAND()<1E-4 is one character shorter than my original version, 1E4*RAND()<1. # x86-64 Machine Code, Microsoft Calling Convention, 33 bytes Works by checking if 32 bits of the time stamp are less than 2^32/10000. Technically, it's about 1 in 9999.994, but it should be close enough. The functions would have a signature of: extern "C" void minceraft(char* out);  but the output is not null terminated. 0F 31 rdtsc 3D B8 8D 06 00 cmp eax,68DB8h 48 B8 65 63 72 61 66 4D 69 6E mov rax,6E694D6661726365h 77 02 ja minecraft 86 C4 xchg al,ah minecraft: 48 C1 C0 18 rol rax,18h 48 89 01 mov qword ptr [rcx],rax C6 41 08 74 mov byte ptr [rcx+8],74h C3 ret  An alternative, also 33 bytes: 48 B8 4D 69 6E 65 63 72 61 66 mov rax,66617263656E694Dh 48 89 01 mov qword ptr [rcx],rax C6 41 08 74 mov byte ptr [rcx+8],74h 0F 31 rdtsc 3D B8 8D 06 00 cmp eax,68DB8h 77 06 ja minecraft 66 C7 41 03 63 65 mov word ptr [rcx+3],6563h minecraft: C3 ret  # Javascript 37 bytes $=>Min${new Date%1e4?"ec":"ce"}raft  # Bash, 58 bytes [$(shuf -n1 -i0-10000) = 1 ]&&s=ce||s=ec;echo Min${s}raft  Try it online! # Kotlin, 67 81 bytes Try it online! print("min${if(kotlin.random.Random.nextUInt()%10001u>9999u)"ce" else "ec"}raft")


or this if import's are allowed, which is 67 bytes in this context:

print("min${if(Random.nextUInt()%10001u>9999u)"ce" else "ec"}raft")  explanation for the code: if(Random.nextUInt()%10001u>9999u)"ce" else "ec"  Random.nextUInt() Returns a random Kotlin UINT Number, the % (modulo operator) is to make it be within the ranges of 0, n, 10000 in this case, i could have used 1e4 to accomplish it but it would be a double and it would need conversion, which just adds extra bytes, if the expression is true, "ce" would be used, which is the odd possibility, also since it starts from 0 and not 1, the possible combinations inbetween 0, 10001 is 100000, 2%2 is 0 and not 2 for example, and since >9999u can only be 1 smaller than 10000, which the > compansates for, also it is the same as == 10000u, it is for saving bytes. Proof:  var count = mutableListOf<Int>() for(z in 0..10) { count.add(z, 0) for(i in 0..100000000) { if(Random.nextUInt()%10001u>9999u) count[z] += 1 } } var avg = 0 for(i in count.indices) { avg += count[i] } avg /= count.size println("ratio:${100000000f / avg}, normal ratio: ${10000/1f}")  ratio: 9995.003, normal ratio: 10000.0 • Welcome to code-golf, nice first answer! It would be nice to place a link to an online interpreter, so anyone can test your submission, eg. here: tio.run/#kotlin, like other answers usually do. Also, I'm not familiar with Kotlin, but it may be of use to check this tips question. Dec 18, 2021 at 12:14 • thanks! i added the interpreter link however i'm not sure whether i need to include the imports, implement the main class etc Dec 18, 2021 at 12:53 # Vyxal, R, 21 bytes, Courtesy of Lyxal and ManishKundu «ɽL3Gp↵¢¨Π°ꜝ«½k2℅1=iǐ  Try it Online! # Vyxal, 30 bytes Mink2ʀ℅1>[ec|ce]+raft+  Try it Online! Well someone help me to compress these strings.... no no don't compress, compressing this yield larger strings.... • I think you can just push the strings to the stack and use the s flag to concatenate them, so you can remove the +s Apr 25, 2021 at 11:46 • @cairdcoinheringaahing i have tried that way earlier but it didn't work Apr 25, 2021 at 11:50 • I think that might be a bug then. If you remove the +s and just add a W though, you can get 29 bytes Apr 25, 2021 at 12:09 • how about 22 bytes? Apr 25, 2021 at 12:11 • or this for 21 bytes? Apr 25, 2021 at 12:20 # Japt, 25 bytes The code snippet below seems to bug out on the compressed nonprintable chars, please see the link for the correct string. "ec" // U = string constant M {MqL²Ä ?U:Uw}ft { } // Insert ?U:Uw // either U or U reversed depending on whether Mq // a random number in range L²Ä // [0, 10001) is truthy or not M ft // into a compressed string  Try it here. # APL (Dyalog Unicode), 25 bytes A port of Jonah's great J answer. {4⌽'raftMin','ce'⌽⍨×?1e4}  Try it online! ## My previous answer, 30 bytes {'Min','raft',⍨2↑'cec'↓⍨×?1e4}  Try it online! A dfn whose argument doesn't matter. Requires 0-indexing. {'Min','raft',⍨2↑'cec'↓⍨×?1e4} ?1e4 ⍝ Random number in range [0, 10000) × ⍝ Signum (0 if 0, 1 if >0) 'cec'↓⍨ ⍝ Drop those many elements from 'cec' ⍝ 1 in 1e4 chance of not dropping the first 'c' 2↑ ⍝ Keep only the first 2 characters 'raft',⍨ ⍝ Prepend to 'raft' 'Min', ⍝ Append to 'Min'  • You might be able to save some bytes with one of my J approaches. The APL translations are typically shorter than the J, which is 27/28 here. Apr 25, 2021 at 19:44 # F# (.NET Core), 70 bytes fun _->"Min"+(if System.Random().Next(9999)=1 then"ce"else"ec")+"raft"  Try it online! # Pari/GP, 44 bytes Str("Min",if(random%10000,"ec","ce"),"raft")  Try it online! # CSASM v2.4.0.1, 110 bytes func main: push 10000 extern Random.Next(i32) brtrue a push "Minceraft" br b .lbl a push "Minecraft" .lbl b print ret end  extern Random.Next(i32) calls Random.Next(int) on a System.Random object Therefore, it will return a value in $$\[0, 10000)\$$ Non-zero integers are truthy in CSASM, so the brtrue instruction will be successful $$\1/10000\$$ of the time # Bash (pure Bash, 54 bytes) [$[RANDOM % 10000] = 0 ]&&s=ce||s=ec;echo Min${s}raft  Since echo always returns 0, this kind of condition works. • 53 bytes: s=ec;[$[RANDOM % 10000] = 0 ]&&s=ce;echo Min${s}raft Apr 26, 2021 at 15:22 • 42 bytes Try it online! Apr 27, 2021 at 6:48 • $RANDOM` is between 0 and 32767, so the odds are 4/32768 or 1/8192 rather than 1/10000.
– l0b0
Apr 27, 2021 at 9:19