User:XKCD Random Number

From Esolang
Jump to navigation Jump to search
Not to be confused with Random number generator.

XKCD Random Number is a challenge that requires you to rewrite the program in XKCD's 221st page in another language, as either a function or a full program that prints the return value. You may comment your program just like XKCD did, if possible.

Or in other words: This program simply outputs 4.

Implementations

!!brainfeed

++++.

!!Fuck

!!!!!#!!!!!!!#!!!!!#!!!!!!!#!!!!!#!!!!!!!#!!!!!!!!!!!#!!!!!#!!!!!!!#!!!!!!!!!!!#!!!!!!!!#!!!!!!#!!!!!!!#!!!!!!!#!!!!!!!#!!!!!#!!!!!!!!!!!!#!!!!!!#!!!!!!#!!!!!!!!!!!!#!!!!!#!!!!!!!!!!#

!@#$%^&*()_+

4@

Alternative

^^^^#

$!

!$$

$+-?

$++++++++++A?b$+++++$-aB$++

+

++++

+++

4 !

1

4111*,

It only works on the Common1 dialect of 1.

100BF

1OO 100 1OO 100 1OO 100 lO0 1OO 100 lO0 10O 1O0 100 100 100 1OO lOO 1O0 1O0 lOO 1OO l0O

3 Bits, 3 Bytes

Hÿ4

4

3.600525004

8xn

8x11116

99

99 99999 9999 99999 9999 99 9 99 9
99

=

0=+52

><x>/><x±∔>

iiiin

><x±∔> only

4O

!中文

输出“4”。

脑操

》十》十》十(》十(一《十十十》)《《)》。

硕鼠

吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱
吱
吱吱吱吱

?Q?

[[4]$]:

AEAV

xkcd = 4         (Non-random version)
out xkcd





xkcd = 1-4            (Random version)
out xkcd

Aheui

밤망희

Amtu

F 0>0>1>1>0>1>0>0h F 0>0>1>1>0>1>0>0h F 0>0>1>1>0>1>0>0h F

Arithmetic

==Begin Exam 1==
1. 1+1=? (52 points)
A. 2
Answer: A
==End Exam 1==

AuFI

Ru

Batch

@echo off
echo 4
pause>nul

Alternative

@echo off
echo 4

BASE

PRINT 4

Beatnik

Hi, XKCDsRandomNumberOKHello world.

Befunge

4.@

The program above prints an extra space. If you don't want an extra space, use the one below.

"4",@

BinaryLanguage

4

BracketOnly

(()()()()()()()()()()()()()()()()()())((()())(()()()()()()(()()()())((()())(()()()()()()()()()()()()()())(()())(()()()()()()()()()()()()()()))))

Alternative:

(()()()()()()()()()()()()()()()())((()())(()()()()()()()()))

Braincopter

Here is the actual program:

Brain-Flak

In non-ASCII mode:

(()()()())

In ASCII mode:

(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())

Brainfuck

>+>+>+[>+[-<+++>]<<]>.

brainfuck

++++++++++++++++++++++++++++++++++++++++++++++++++++

Note that adding a . in the end of program makes it a polyglot, because that will make it also work as a brainfuck program.

Brainfuck extended

$4$.

Alternative

_34.

Alternative that doesn't use any numbers at all

////)

Brainloller

Here is the actual program:

C

The original program mentioned on XKCD is written in C. It was a function, while the full program is shown below:

#include <stdio.h>
int main(){putchar(52);return 0;}

C#

using System;
class XKCD {
	static void Main(string[] args) {
		Console.WriteLine("4");
	}
}

Cardinal

%"4

¢%

%%¢¢ %%¢¢ ¢%%¢ ¢¢%¢ ¢%%¢ %%¢%

Consequential

+>>+>>+>>+>>+>>+>>+>>+>>+>>+>>+>>+>>+>>+>>+>>+>>+>>+>>+>>+>>.

Cood

Hey, waiter!
I want 4 of this.
How much is it?
The bill, please.

Deadchicken

chicken
chicken
chicken
chicken
chicken chicken chicken chicken

Deadfish

iiiio

Smaller one

iiso

dirac

4I;

Divmeq

0: 0.25 1

Emo

^o^ o~O
o^o ): :o) @~@

EmojiLang

🖨️🔡4🔡

Empty

"4:

enGLish

Output four

Alternative

Output 4
Alternative
Output "4"

Alternative

Output character 52

Enjamb

It's Random Number!
XKCD
ok

The program above may print extra whitespace characters.

ESC!

\. ; \^4\ ; \*\ ; \:

Eso2D

0_*

The program above prints an extra space. If you don't want an extra space, use the one below.

1,,#

Esolangs.org

{{infobox proglang
|name=getRandomNumber()
|XKCD=221
}}
'''getRandomNumber()''' guarantees a random number.

== Stats ==
Chosen by fair dice roll; guaranteed to be random as per RFC 1149.5

== Program ==
<pre><nowiki>
[[brainfuck]]
{{Load|brainfuck}}
++++++[>++++++++<-]>++++.
{{Clear}}
</nowiki></pre>

[[Category:Examples]]

ExampleFuck

Truth Machine
Hello World
Truth Machine
Hello World
Truth Machine
Hello World
FizzBuzz
Truth Machine
Hello World
FizzBuzz
Cat Program
Quine
Hello World
Hello World
Hello World
Truth Machine
99 Bottles of Beer
Quine
Quine
99 Bottles of Beer
Truth Machine
Self Interpreter

F!--

F! F! F! F! K!

Factor

54948677498655068263351660303957600730731029471078168023

FALSE

[
  4 {chosen by fair dice roll.}
    {guaranteed to be random.}
]

Feedfish

iififfio

Fish

4n;

Fish Code

<((52)).><

flag

4

G#

make main; [
    print(4)
]

Gift

4___))(_(_(

Goldfuck

1.618031988749844848264586834565638817720308179805762860135440622705270462818902419707207244189392137484724088075886891758126636862223536931393180080766728354433389086095939982905638327

Hardfish

In implementations that output values as numbers:

ico

In implementations that output values as ASCII:

icrico

H+Q9

+4

Hexagony

4!@

Hexdump

34

How dare you fuck the brain

IIIIN

Ichi

4 6 8 10 0

ISEW2C

3 4 0 0

JavaScript

console.log(4);

JSFuck

The following is just a JSFuck.com conversion from console.log(4) (3326 characters long), it works on browser JS and Node.js

[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(+(!+[]+!+[]+!+[]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]])+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]])()(([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[+[]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+[!+[]+!+[]+!+[]]]+[!+[]+!+[]+!+[]+!+[]]+([+[]]+![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[!+[]+!+[]+[+[]]])

There is also a shorter one but only works on browser JS (2359 characters, a JSFuck.com conversion from alert(4)).

[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(+(!+[]+!+[]+!+[]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]])+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]])()((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+[!+[]+!+[]+!+[]]]+[!+[]+!+[]+!+[]+!+[]]+([+[]]+![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[!+[]+!+[]+[+[]]])

This is a longer one (8498 characters) that doesn't output any trailing line feeds which is a JSFuck.com conversion from process.stdout.write('4'), it works on Node.js.

[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(+(!+[]+!+[]+!+[]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]])+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]])()([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+([]+[])[(![]+[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+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]]((!![]+[])[+[]])[([][(!![]+[])[!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]](([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(![]+[+[]])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+!+[]+[+[]]]+![]+(![]+[+[]])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+!+[]+[+[]]])()[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[+[]])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+!+[]+[+[]]])+[])[+!+[]])+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]])())

Please replace these implementations if you know a shorter one.

Labyrinth

4!@

Length

It's XKCD random number!!
XKCD
Try it out now!

Look!

Note: Look! is a sound-based language and the following line of text is only the notes of the real program, for the real program please see the link below

G# D# G D# G# C B G C F# D A C C C G# C# A A C# G F

The program as a MIDI file.

MarioLANG

++++:
=====

MEMORYLEEK

[chosen by fair dice roll]
[guaranteed to be random]
!4;
point remove;
#remove; :remove;

morse code

 ....-

Note: Space in front of returning text.

Multiplicity

417744685118879731600506117375719540878173341042907821182687827362162871106962918226728766784177853000

NeverGonna

i just wanna tell you "4"

Nulla

AkkY.huh

When converted, becomes:

000  000 100 100 100 100 011 000

Decoded:

0 PSZ INC INC INC INC OUT PSZ

The final PSZ is superfluous.

Odasjoi

fowdif
fowdif
fowdif
fowdif
doqije

oOo CODE

xkcD rAndoM nUmbeR iS a ChallEnGe ThAt reqUIrES yOU tO rewrITe tHe pRoGRam iN Xkcd's 221st page in another language

It's self-documenting.

Output

Output "4"

Piet

PlusIntMinus

Although the PlusOrMinus program will still work for this language, this is a shorter one that only works on PlusIntMinus.

+52-

PlusOrMinus

++++++++++++++++++++++++++++++++++++++++++++++++++++-

PocketFuck

Enlarged view

{{{2}}}

Actual size

{{{2}}}

Poetic

By User:XKCD Random Number:

Pre crecas condominolovium seclosoponiat exelglios egumbo
 e arbi-brimidozoque fiene a parp-en inbidee nonquaeson!

By User:None1:

XKCD Challenge

I was a mouse.
A bad rodent indeed.
I am cats' supper.
Never seeing bright light.

Don't be a Befunge programmer.
Or you'll be like me.

PopFuck

00000++>

PTotE

Tc

Python

print(4)

Alternatives

__import__("sys").stdout.write("4")
print(4,end='')
from random import randint
x = 0
while x != 4:
    x = randint(1, 6)
print(x)

Rec

4P [0^ Chosen by fair dice roll.
       Guaranteed to be random. ]

Remove Line Numbers

1 4

Rockstar

The truth is random (chosen by fair dice roll)
Looking is not useful
Xkcd is a blessing (guaranteed to be random)
Say the truth without looking over it.

Ropy

This program uses implicit output. There is a trailing newline.

4

Ruckfish

iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii

SDOTOS

ssss!

Sakana

ラ空増増乗#Chosen by fair dice roll.##guarenteed to be random.#作ラ出

Setlang

(4)

Which also works as a Setlang++ program.

Self-modifying Brainfuck

<.4

Shinda Sakana

増増乗出

Simon says brainfuck

Simon says: >+>+>+[>+[-<+++>]<<]>.
Chosen by fair dice roll.
Guaranteed to be random.

Slam

Hi hi hi hi hi
XKCD
RandomNumber! OK

The program above may print extra whitespace characters. If you do not want extra whitespace characters, use this one below.

Hi hi hi hi hi
XKCD RandomNumber!
Yay yay yay

Sokolang

// Chosen by fair dice roll.
// Guaranteed to be random.

 ###
##*##
#@R*#
#####

---

r:11,4

---

rwu

Standard modern vernacular

输出 4 。

Stars

* ***** * ****** ***** ** *** ***** ** *** ***** ** *** ***** ** ****** **** **** ****

StegFuck

TernLSB

TESTLANG

push 4 push out

Same thing but without numbers

push char 52 push out

Text

4

This esolang is a brainfuck derivative

This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainfuck derivative
This esolang is a brainf*** derivative
chosen by fair dice roll
guarranteed to be random

Note: the three stars in the program are MANDATORY, while the last two lines are not. (brainfuck: ++++++++++++++++++++++++++++++++++++++++++++++++++++.)

This esolang is not a push-down automata

4.

Three Star Programmer

0 4 4 4 1 1 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 4

Tile

Trampolines

|o#
|4#
|;#
|##

‍true

4.

Txet

d4`4

UnnumericJS

console.log(!''+!''+!''+!'');

Weeeeeeeeeeeeeeeeeeeeeeeeeeeeee

Start epidemic
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Infect person
Check number of infections
Delevop vaccine

WeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeBasic

print "4"

Which also works when running on WeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeBasic++ or Python 2.

A commented version, that only works in this language, is as follows:

print "4"
Start epidemic chosen by fair dice roll
Delevop vaccine guarranteed to be random

wenyan

吾有一數。曰四。書之。

Whendo

a==0=>a+=4->a

wsad

wwwwwwwwas

X strike

X!×4
x^-1×0×0

External resources