Hot answers tagged

117 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,133
94 votes
Accepted

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,767
64 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,155
64 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
60 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.3k
47 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.4k
45 votes
Accepted

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.2k
43 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
  • 553
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
  • 18.8k
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
40 votes
Accepted

Alex-style Addition

Pyth, 8 u+G!OTsQ Try it online This uses Pyth's second mode on reduce, that looks for repeated input then exits. Explanation ...
FryAmTheEggman'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

Chaos is an ASCII ladder

Operation Flashpoint scripting language, 643 624 bytes ...
Steadybox's user avatar
  • 16.4k
33 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,261
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,091
31 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
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.8k
29 votes
Accepted

Choose The Powerball Numbers!

Dyalog APL, 10 bytes (5?69),?26 Dyadic ? is ⍺ distinct random numbers in [1,⍵], and monadic ...
lirtosiast's user avatar
  • 21.3k
28 votes

Cracking in progress

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

1/N probability

MediaWiki templates with ParserFunctions, 48 bytes {{#ifexpr:1>{{#time:U}} mod {{{n}}}|true|false}}
DuhHello's user avatar
  • 499
27 votes

Passwordify the string

Labyrinth, 76 bytes `:_64/"32} ,` (3 :=-{ "`{"; _v2$ ;`3 "`".:@ ; ".5(`3. < "" `^`;> Another collab with @MartinBüttner and on the more insane ...
Sp3000's user avatar
  • 61.5k
26 votes
Accepted

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
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

Simulate the Universe!

C++ (2420,2243,2353,1860,1822*.9=1639.8) Ok, so this is probably the worst ever code golf submission, but it's my first and I had fun. I think it even works. :) ...
MichaelS's user avatar
  • 371
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

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
  • 601
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.4k

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