Skip to main content
121 votes

Shortest code to produce non-deterministic output

WinDbg, 1 byte # Wow! Never expected a 1 byte solution from WinDbg! # searches for a disassembly pattern, but since there's no ...
milk's user avatar
  • 3,163
94 votes

Display random colored pixels

Minecraft 1.12 Redstone Command Blocks, 4,355 2,872 bytes (Size determined by saved structure block file size.) Here is a full YouTube overview, but I'll try to outline the code below. Setup Routine: ...
BradC's user avatar
  • 6,787
68 votes

Shortest code to produce non-deterministic output

MATLAB, 3 bytes why why provides answers to almost any question. A few examples: ...
Stewie Griffin's user avatar
67 votes

Shortest code to produce non-deterministic output

Java 7, 33 30 27 bytes int a(){return hashCode();} Because Java.
Poke's user avatar
  • 3,185
61 votes

Implement Minceraft

Minecraft, 358 293 277 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 ...
Okx's user avatar
  • 16.4k
48 votes

Duck, duck, goose!

Operation Flashpoint scripting language, 48 bytes f={s="duck\n";s+([s,""]select random 1)+"goose"} Always prints either one or two ducks. ...
Steadybox's user avatar
  • 16.5k
46 votes

Shortest code to produce non-deterministic output

huh?, 0 bytes An empty program still produces output. The last lines of the Python interpreter that are executed: ...
mbomb007's user avatar
  • 23.4k
44 votes

Shortest code to produce non-deterministic output

R, 1 byte t Outputs the function's source code and a memory pointer address which changes with every (re-)start of R.
chrki's user avatar
  • 563
43 votes

Random point on a sphere

Wolfram Language (Mathematica), 20 bytes RandomPoint@Sphere[] Try it online! Does exactly what it says on the tin.
att's user avatar
  • 20.6k
42 votes

Duck, duck, goose!

World of Warcraft 81 Bytes Here's a macro that you can run in World of Warcraft. /run for x=1,random(1,9) do SendChatMessage("Duck") end; SendChatMessage("Goose") ...
Kelly Lowder's user avatar
  • 3,475
42 votes

Duck, duck, goose!

Minecraft <1.13, 72 54 bytes Sorry, I had to. Instructions: Create a new Minecraft world in Creative Mode Find the save folder for that world, and place the following code in ...
James Westman's user avatar
38 votes

Simulating Exploding Dice

x86 Machine Code (for Intel Ivy Bridge and later), 17 bytes 31 C9 0F C7 F0 31 D2 F7 F6 42 01 D1 39 F2 74 F2 C3 The above bytes of code define a function that ...
Cody Gray - on strike's user avatar
34 votes

Shortest code to produce non-deterministic output

Minecraft, 5 4 bytes op 8 Used by typing into a server's console or a command block and giving it power. Can be run from the chat interface by prepending a ...
Pavel's user avatar
  • 9,377
34 votes

Chaos is an ASCII ladder

Operation Flashpoint scripting language, 643 624 bytes ...
Steadybox's user avatar
  • 16.5k
33 votes

Shortest code to produce non-deterministic output

Labyrinth, 5 bytes v ! @ Either prints 0 or nothing (50% chance each). Try it online! There is a very specific case in ...
Martin Ender's user avatar
33 votes

Make your code error, but only sometimes!

Baby Language, 0 bytes Try it online! I knew this could be fun with a non-deterministic tarpit! I looked through the category on the Esolang wiki and found this ...
AviFS's user avatar
  • 2,111
30 votes

This will eventually stop…

C#, 94 85 bytes My first answer! using System;s=>{var r=new Random();for(var i=2;r.Next(i++)>0;)Console.Write(s+" ");} Previous attempt (I liked that <...
Charlie's user avatar
  • 12.9k
28 votes

Cracking in progress

HTML/JavaScript, 170 168 167 bytes ...
Neil's user avatar
  • 172k
26 votes

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

x86 machines with rdrand instruction, 10 bytes ...
Margaret Bloom's user avatar
26 votes

Be big more often

Python, 41 bytes lambda l:choices(l,l) from random import* Attempt This Online! or run it 100000 times Uses the list itself as the weights.
MTN's user avatar
  • 783
25 votes

Shortest code to produce non-deterministic output

Inform 7, 6 bytes x is y This isn't a valid Inform 7 program, since neither "x" nor "y" has been defined. So this throws an error. However, ...
Draconis's user avatar
  • 611
25 votes

Write an interpreter for *

*, 0 bytes Since * has no way of reading input, the default rules allow specifying that the input must be given by concatenating it onto the program. (... I ...
hmakholm left over Monica's user avatar
24 votes

Random Golf of the Day #7: A distinctly random character

MATL, 6 Characters 1Y2Xr) Explanation: Xr Take a normally distributed random number ) Use ...
Dennis Jaheruddin's user avatar
24 votes

Random point on a sphere

R, 23 bytes x=rnorm(3) x/(x%*%x)^.5 Try it online! Generates 3 realizations of the \$\mathcal N(0,1)\$ distribution and normalizes the resulting vector. Plot ...
Robin Ryder's user avatar
  • 15.6k
24 votes

Random point on a sphere

x86-64 Machine Code - 63 62 55 49 bytes ...
me''s user avatar
  • 581
24 votes

Super Mario 64 RNG

x86 32-bit machine code, 21 bytes 89 C8 30 C4 86 C4 D1 E8 73 04 66 35 74 9E 66 35 74 E0 30 C8 C3 Try it online! Uses the ...
m90's user avatar
  • 10.5k
23 votes

Shortest code to produce non-deterministic output

JavaScript, 4 bytes Date A function which returns the current date/time. I think this is the shortest it will get... Explanation Since this seems to be causing ...
ETHproductions's user avatar
23 votes

Simulate reproduction in a population of oozes

Python 3, 114 bytes from random import* def f(n,s=b'o'):k=randrange(len(s));return n and f(n-1,s[:k]+b'oO8o'[-~s[k]%3::3]+s[k+1:])or s Try it online! ...
Jitse's user avatar
  • 7,324

Only top scored, non community-wiki answers of a minimum length are eligible