# Shortest code to produce non-deterministic output

You need to produce output that is non-deterministic.

In this case, this will be defined to mean that the output will not always be the same result.

Rules:

• A pseudo-random number generator that always has the same seed does not count.

• You can rely on the program being run at a different (unknown) time each execution.

• Your code's process id (if it's not fixed by the interpreter) can be assumed to be non-deterministic.

• You may rely on web-based randomness.

• Your code may not take non-empty input. Related meta post.

• The program is not required to halt, but the output must be displayed.

function answersUrl(a){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+a+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(a,b){return"https://api.stackexchange.com/2.2/answers/"+b.join(";")+"/comments?page="+a+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(a){answers.push.apply(answers,a.items),answers_hash=[],answer_ids=[],a.items.forEach(function(a){a.comments=[];var b=+a.share_link.match(/\d+/);answer_ids.push(b),answers_hash[b]=a}),a.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(a){a.items.forEach(function(a){a.owner.user_id===OVERRIDE_USER&&answers_hash[a.post_id].comments.push(a)}),a.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(a){return a.owner.display_name}function process(){var a=[];answers.forEach(function(b){var c=b.body;b.comments.forEach(function(a){OVERRIDE_REG.test(a.body)&&(c="<h1>"+a.body.replace(OVERRIDE_REG,"")+"</h1>")});var d=c.match(SCORE_REG);d?a.push({user:getAuthorName(b),size:+d[2],language:d[1],link:b.share_link}):console.log(c)}),a.sort(function(a,b){var c=a.size,d=b.size;return c-d});var b={},c=1,d=null,e=1;a.forEach(function(a){a.size!=d&&(e=c),d=a.size,++c;var f=jQuery("#answer-template").html();f=f.replace("{{PLACE}}",e+".").replace("{{NAME}}",a.user).replace("{{LANGUAGE}}",a.language).replace("{{SIZE}}",a.size).replace("{{LINK}}",a.link),f=jQuery(f),jQuery("#answers").append(f);var g=a.language;g=jQuery("<a>"+g+"</a>").text(),b[g]=b[g]||{lang:a.language,lang_raw:g,user:a.user,size:a.size,link:a.link}});var f=[];for(var g in b)b.hasOwnProperty(g)&&f.push(b[g]);f.sort(function(a,b){return a.lang_raw.toLowerCase()>b.lang_raw.toLowerCase()?1:a.lang_raw.toLowerCase()<b.lang_raw.toLowerCase()?-1:0});for(var h=0;h<f.length;++h){var i=jQuery("#language-template").html(),g=f[h];i=i.replace("{{LANGUAGE}}",g.lang).replace("{{NAME}}",g.user).replace("{{SIZE}}",g.size).replace("{{LINK}}",g.link),i=jQuery(i),jQuery("#languages").append(i)}}var QUESTION_ID=101638,ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",OVERRIDE_USER=34718,answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:400px;float:left}table thead{font-weight:800}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"><div id="language-list"> <h2>Shortest Solution by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table></div><div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table></div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody></table><table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody></table>

• @mbomb007 In C there are many things that are simply "undefined" behaviour. Any given interpreter is allowed to do whatever it wants in any situation. For all we know, gcc might order you a pizza if you try to overflow a signed integer on a rainy Tuesday, but will make a trout jump out of your screen on all other days. So you wouldn't really ever know if it's actually deterministic or not in any given implementation. – Martin Ender Nov 30 '16 at 20:44
• @MartinEnder I'm not sure if that matters. We define languages here by their implementation, not by the specification (as languages without an implementation is not allowed) – Nathan Merrill Nov 30 '16 at 21:00
• @MartinEnder Yeah, I agree with Nathan. – mbomb007 Nov 30 '16 at 21:01
• Note that undefined behaviour in C often leads to crashes, and crashes on UNIX and Linux lead to core files which contain the process ID inside them. That would seem to comply with the question as currently worded. – user62131 Nov 30 '16 at 21:23
• Unless I misunderstood, the question did not ask for code that takes advantage of undefined behavior. It asks for code that takes advantage of defined behavior to guarantee non-determinism. – WGroleau Dec 1 '16 at 3:30

# WinDbg, 1 byte

#


Wow! Never expected a 1 byte solution from WinDbg!

# searches for a disassembly pattern, but since there's no parameters, it looks to just return the next assembly instruction in whatever dump/process you're attached to. Not sure the logic for setting the initial address, but it does.

Sample output:

0:000> #
user32!NtUserGetMessage+0xc
75959556 c21000          ret     10h

0:000> #
user32!NtUserGetMessage+0xf
75959559 90              nop

0:000> #
user32!NtUserMessageCall
7595955a 90              nop

0:000> #
user32!NtUserMessageCall+0x1
7595955b 90              nop

0:000> #
user32!NtUserMessageCall+0x2
7595955c 90              nop

0:000> #
user32!NtUserMessageCall+0x3
7595955d 90              nop

0:000> #
user32!GetMessageW
7595955e 8bff            mov     edi,edi

0:000> #
user32!GetMessageW+0x2
75959560 55              push    ebp

0:000> #
user32!GetMessageW+0x3
75959561 8bec            mov     ebp,esp

0:000> #
user32!GetMessageW+0x5
75959563 8b5510          mov     edx,dword ptr [ebp+10h]

• One of the cooler answers here, this should win over a "Current Date" solution in my opinion. – Magic Octopus Urn Nov 30 '16 at 21:39
• that above it seems the disassebly, step by step of the begin of some function in 386 intel cpu assembly – RosLuP Dec 2 '16 at 22:05

# Java 7, 3330 27 bytes

int a(){return hashCode();}


Because Java.

• Because Java. Probably the best explanation of Java ever. – F. George Nov 30 '16 at 21:35
• @carusocomputing I had toString in a previous version but then the return type is String which is longer than int. Save the bytes! :] – Poke Nov 30 '16 at 22:17
• Is this valid as a function? hashCode() is an abbreviation here for this.hashCode(), so it'd only work as an instance method, not a static method. In that case, you'd need additional code to create an object in the caller. That's relevant here because it's the code to create an object that's responsible for the nondeterminism. – user62131 Dec 1 '16 at 1:08
• In Java 8: ()->hashCode() for 14 bytes. Just sayin' ;) – Olivier Grégoire Dec 1 '16 at 16:58
• @pts I'm going based off of the meta post discussing the default submit structure for posts. Functions are allowed by default unless the challenge specifies that a full program is required. – Poke Dec 2 '16 at 18:36

# MATLAB, 3 bytes

why


why provides answers to almost any question. A few examples:

why
The programmer suggested it.

why
To fool the tall good and smart system manager.

why
You insisted on it.

why
How should I know?


This is shorter than any rand function I can think of.

• MATLAB has a builtin for this? Why? – ETHproductions Dec 3 '16 at 20:46
• @ETHproductions The programmer suggested it – Eddie Curtis Dec 5 '16 at 16:04

# R, 1 byte

t


Outputs the function's source code and a memory pointer address which changes with every (re-)start of R.

# huh?, 0 bytes




An empty program still produces output. The last lines of the Python interpreter that are executed:

print "..."
f = open('Notes.txt', 'w')
f.write(time.strftime("%c") + " - The user tried to give me commands again. I still have no idea what they are talking about...\n")


At the end of a program, the Python interpreter will print ..., then it will create/open a text file called Notes.txt and write a string which contains the current time in front.

• Of all the things I thought people would use on my GitHub, I didn't think a joke language interpreter would be one :P – Kade Dec 2 '16 at 18:41
• @Kade I was actually going to use it to answer another question as well (shortest code to play a sound, with only a single byte) -- but the question is now closed. – mbomb007 Dec 2 '16 at 19:36
• Though it'd be non-competing unless I looked at the original .NET interpreter, I guess. – mbomb007 Dec 2 '16 at 19:43

## Labyrinth, 5 bytes

v
!
@


Either prints 0 or nothing (50% chance each).

Try it online!

There is a very specific case in which Labyrinth exhibits random behaviour:

• There must be a wall in front of the instruction pointer and behind it.
• There must be a non-wall left and right of the instruction pointer.
• The current top of the stack must be zero.

If all of those conditions are met, the direction the IP moves in is chosen (uniformly) randomly. The cherry on top is that those three conditions are impossible to meet in regular control flow, which means unless you modify the source code at runtime.

(This may seem a bit arbitrary, but it's actually the most consistent behaviour I could find for these conditions, since normally the direction of the IP always depends on the previous direction, its neighbours, and the sign of the top of the stack, and this seemed like an elegant way to include a source of randomness in the language.)

With the help of the source code rotation instructions (<^>v) it's possible to bring the IP into this situation. One such example is seen at the top. The IP initially points east and starts at the top. The v rotates the current column so that we get:

@
v
!


The IP moves along with this rotation so that it's still on the v, pointing east. All the conditions are fulfilled now, so the IP will either go up or down randomly. If it goes up, the program terminates immediately. If it goes down, it prints a zero, rotates the column again, and then terminates.

There are three other programs making use of this (one which also prints 0, one which prints 00 and one which prints 000):

v
@
!


"
>@!


"
>!@


(Actually there are a lot more than three other programs, because you could also use . instead of ! to print null bytes, or replace that " with a large variety of commands, but I believe they all work essentially the same.)

# Befunge (-93 and -98), 3 bytes

?.@


The ? sends execution in a random direction. If it goes up or down, it loops back to the ? and rerolls. If it goes left, the program wraps round to the @ and thus exits without printing anything. If it goes right, it prints 0  (the output produced by . when the stack is empty) and then exits on the @.

• This isn't guaranteed to terminate, but I was going to post this exactly so +1 – Daniel Dec 1 '16 at 3:59
• You may want to change the comma to a period to output 0 as a number instead of a null character (ASCII value 0). +1 – MildlyMilquetoast Dec 1 '16 at 4:19
• It was . in the program I was using for testing, but somehow became a , when I copied it onto PPCG. Fixed. – user62131 Dec 1 '16 at 5:04
• @Dopapp it terminates almost surely though, with probability 1. I'd take that as a guarantee ;) – Oliphaunt - reinstate Monica Dec 1 '16 at 9:17
• @JamesHolderness I think you can do it in 1. Not sure if this counts though... – MildlyMilquetoast Dec 6 '16 at 18:18

# 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 /.

Usually this does nothing, but if there's a player with the username "8" on the server, they will be given operator permissions. Note that while Minecraft normally requires usernames to be 3 characters long, some accounts with shorter name lengths were created before this restriction.

The version that can be demonstrated to be non-deterministic without one of these usernames or risk of giving a user operator permissions is here:

me @r


Displays a message to everyone, the message being the username of a random player. The op command only takes a string literal, not any script that returns a string.

The me command wouldn't really work for the first example, it would display "<your-username> 8". When run from a command block, it wouldn't be deterministic since all command blocks have the same "username" but running it from the chat interface would require the / for one extra byte.

• So / is not included in the byte count? – Esolanging Fruit Dec 1 '16 at 5:36
• @Challenger5 The slash is optional in command blocks, not allowed in the server console, and mandatory in the chat interface. – Pavel Dec 1 '16 at 5:47
• Actually, it should be 4 bytes + 2 blocks (Command block and redstone source), or 6 blytes – RudolfJelin Dec 2 '16 at 16:38
• @RudolphJelinek You can run it from the console without command blocks. – Pavel Dec 2 '16 at 17:10
• Another non-deterministic option would be help in a command block, which is 4 bytes (and doesn't require pirated games). – Pokechu22 Dec 6 '16 at 19:03

## 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, some of Inform 7's error messages—including this one—are randomized. So the text it prints is technically non-deterministic.

A few possible outputs include:

Problem. The sentence 'x is y' appears to say two things are the same - I am reading 'x' and 'y' as two different things, and therefore it makes no sense to say that one is the other: it would be like saying that 'Adams is Jefferson'. It would be all right if the second thing were the name of a kind, perhaps with properties: for instance 'Virginia is a lighted room' says that something called Virginia exists and that it is a 'room', which is a kind I know about, combined with a property called 'lighted' which I also know about.

Problem. The sentence 'x is y' appears to say two things are the same - I am reading 'x' and 'y' as two different things, and therefore it makes no sense to say that one is the other: it would be like saying that 'Adam is Eve'. It would be all right if the second thing were the name of a kind, perhaps with properties: for instance 'Land of Nod is a lighted room' says that something called Land of Nod exists and that it is a 'room', which is a kind I know about, combined with a property called 'lighted' which I also know about.

Problem. The sentence 'x is y' appears to say two things are the same - I am reading 'x' and 'y' as two different things, and therefore it makes no sense to say that one is the other: it would be like saying that 'Clark Kent is Lex Luthor'. It would be all right if the second thing were the name of a kind, perhaps with properties: for instance 'Metropolis is a lighted room' says that something called Metropolis exists and that it is a 'room', which is a kind I know about, combined with a property called 'lighted' which I also know about.

Problem. The sentence 'x is y' appears to say two things are the same - I am reading 'x' and 'y' as two different things, and therefore it makes no sense to say that one is the other: it would be like saying that 'Aeschylus is Euripides'. It would be all right if the second thing were the name of a kind, perhaps with properties: for instance 'Underworld is a lighted room' says that something called Underworld exists and that it is a 'room', which is a kind I know about, combined with a property called 'lighted' which I also know about.

• Even the error messages are verbose! – Destructible Lemon Dec 1 '16 at 22:15

# sh + procps, 1 byte

w


This is the shortest solution I'm aware of that works via calling into external executables. procps is the responsible package for reporting information about the current system state (ps and friends), and is installed on most Linux distributions by default; w is the shortest-named command in it, and returns information about the logged-in users, but also some nondeterministic information like uptime.

# 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 a lot of confusion as to why it's valid, I'll try to explain.

In JavaScript, a function entry is valid if it can be assigned to a variable and called like a function. For example, this function is a valid entry:

function(){return Date()}


Because it is a function that can be assigned to a variable like so:

f=function(){return Date()}


And then run with f() as many times as necessary. Each time, it returns the current date/time string, which has been ruled non-deterministic by the OP.

This ES6 arrow function is also valid:

_=>Date()


It can be assigned with f=_=>Date(), then run with f() like the other one.

Now, here's another valid entry:

Date


Why? Because just like the other two entries, it can be assigned with f=Date and then called with f(), returning exactly the same thing as the other two. Try it:

var f = Date
<button onclick="console.log(f())">Run</button>

• Do you not need it to be Date() to invoke the function? – milk Nov 30 '16 at 21:00
• @milk Date is a function which, when called with no inputs, produces the current date/time. _=>Date() is a clearly valid entry which does exactly the same thing, so Date is a valid entry. – ETHproductions Nov 30 '16 at 21:06
• That makes sense. – milk Nov 30 '16 at 21:17
• Typing Date to the JavaScript console of my browser produces deterministic output, it always produces this: function Date() { [native code] }. You probably mean Date(), 6 bytes. – pts Dec 2 '16 at 17:51
• if "date" above is ok than "malloc(8)" or "time(0)" would be ok in C too – RosLuP Dec 2 '16 at 21:45

## Python 2, 11 bytes

print id(1)

• That's the one I found. I had id(0), though. :) – mbomb007 Nov 30 '16 at 20:32
• I beat you, technically, since I'm the OP and found it before I posted the question. I didn't want to post the question and immediately post my shortest answer. – mbomb007 Nov 30 '16 at 20:33

# Bash (procps-ng), 2 bytes

ps


$$ is also a solution. • If so, w is shorter and also comes from procps. – liori Dec 1 '16 at 2:48 • You edited this into a duplicate of my answer. – user62131 Dec 1 '16 at 11:30 • @ais523 oops, sorry. – Rɪᴋᴇʀ Dec 1 '16 at 14:57 # Pyth, 2 bytes O0  Explanation:  0 0 O Random float in [0, 1)  It's that, when O has 0 as its argument, it simply returns a random float between 0 and 1, exclusive. Let's do it just for the heck of it! Also, it seems that this can be sorta retro (thanks to 34718/mbomb007): # Pyth, 2 bytes OT  Explanation:  T 10 O Random integer in [0, 10]  Try this boooooooooooooooring version instead >:( ## PowerShell, 4 2 bytes (crossed out 4 still looks like 4) ps  This is the alias for Get-Process which will output the current process listing as a table, including handles, private memory, CPU time, etc. Execute it via something like the following: C:\Tools\Scripts\golfing>powershell.exe "ps"  • I have to admit, I checked to see if it was actually crossed out. You really can't even tell. – Carcigenicate Dec 1 '16 at 0:25 • @Carcigenicate I can tell if it is crossed without selecting the text (Ubuntu 16.04.1, Chrome 54.0.2840.100). – Erik the Outgolfer Dec 1 '16 at 19:38 • Visible on android as well, though not clearly :p – tomsmeding Dec 1 '16 at 23:03 • It looks fine in the iOS app. – Mateusz Piotrowski Dec 6 '16 at 12:43 • I don't have the rep to do it myself, but you could do 04 and strike it out. – Bobson Dec 6 '16 at 14:09 # Commodore 64 Basic, 4 bytes 1S|0  PETSCII substitution: | = SHIFT+Y The zero page of a Commodore 64 is an area of 256 bytes of memory that can be accessed faster than the rest of RAM. Consequently, programs (such as the BASIC interpreter) use it for frequently-accessed data, and the CPU itself stores some of its internal state here. The contents are subject to change without notice. The BASIC program above, ungolfed, is 1 SYS 0, ie. transfer execution to memory location 0. This starts executing the zero page as code. Normally, when the BASIC interpreter starts running a program, the first 16 bytes are 2F 37 00 AA B1 91 B3 22 22 00 00 4C 00 00 00 00  so SYS 0 would execute the following 00: ROL-AND 37,A - Undocumented opcode: rotate the value at memory location 0x37 left, and store the result in the accumulator 02: BRK - Call the interrupt vector  The overall result is to output the BASIC READY. prompt and return control to the user. However, memory location 0x00 is the CPU's I/O direction register, and memory location 0x01 is CPU's I/O address register. If you've done something that changes these before running the program, the results can be unpredictable, ranging from outputting garbage to locking up the computer (the 0x22 usually contained in memory location 0x07, if executed as an instruction, is an undocumented HALT opcode). Alternatively, a more reliably unpredictable program is the four-byte 1?TI  Prints the elapsed time, in jiffies (1/60 of a second), since system power-on. # Zsh, 5 bytes <<<$$


Prints PID.

# 05AB1E, 2 bytes

žd


Try it online!

Outputs current microseconds from the executing machine's internal clock.

Or you could do something like this...

# 05AB1E, 3 bytes

A.r


Try it online!

Outputs a randomly shuffled lower-case alphabet.

Or this also works:

A.R


Try it online!

Outputs a random letter from the alphabet.

Or this also works, and is cooler:

# 05AB1E, 9 bytes

"ž"A.RJ.V


Try it online!

Outputs randomly one of these:

ž 23  > ža           push current hours
žb           push current minutes
žc           push current seconds
žd           push current microseconds
že           push current day
žf           push current month
žg           push current year
žh           push [0-9]
ži           push [a-zA-Z]
žj           push [a-zA-Z0-9_]
žk           push [z-aZ-A]
žl           push [z-aZ-A9-0_]
žm           push [9-0]
žn           push [A-Za-z]
žo           push [Z-Az-a]
žp           push [Z-A]
žq           push pi
žr           push e
žs           pop a, push pi to a digits (max. 100000)
žt           pop a, push e to a digits (max. 10000)
žu           push ()<>[]{}
žv           push 16
žw           push 32
žx           push 64
žy           push 128
žz           push 256


BrainfuckX and small s.c.r.i.p.t. (etc) polyglot - 2 bytes

?.


? - Randomize the value in the current cell

. - Send current cell to stdout

## C, 25 21 bytes

Thanks to pseudonym117 for saving 4 bytes.

main(i){putchar(&i);}


Compiled with gcc -o test lol.c (yeah I'm quite original with my file's name...), and ran with ./test.

It does what it says: prints the character corresponding to the memory address of i, which is defined at runtime, so it should be non-deterministic.

• 1. Can you skip the & as the value of a variable on the stack isn't defined? 2. You have a constant number of things on the stack, so is the memory address if i constant? – Riley Nov 30 '16 at 22:14
• i becomes what's normally called argc, so you're right, it will always be 1 unless there are more arguments. I can't believe I didn't rememeber that. I'm still not sure why the location changes, but if it works it works. – Riley Nov 30 '16 at 23:05
• It changes on modern operating systems due to ASLR, a security feature designed to make it harder for exploits to guess addresses. You'll get a consistent result on some older OSes. – user62131 Dec 1 '16 at 1:03
• You can save a little by replacing putchar with return – ceilingcat Dec 2 '16 at 5:15
• On modern compilers with warnings for not declaring the type of a parameter, you could do: main(){printf("%d");} – Myria Dec 7 '16 at 20:23

# Python 2, 29 bytes

import os
print os.urandom(9)


Sadly not the first time writing code on a smartphone.

# Perl, 5 bytes

say$$ Outputs the process ID and a newline. ## Ruby, 3 bytes p$$


Try it online!

Prints the process ID.

• $. would also work Nice approach though :) – Jatin Dhankhar Dec 26 '16 at 15:56 # Emotinomicon, 15 bytes 😀😅🎲⏬  Explanation: 😀😅🎲⏬ 😀 push 0. Stack: [0] 😅 push 1. Stack: [1] 🎲 random[pop;pop]. Stack: [1 or 0] ⏬output  • The language's name is Emotinomicon – acrolith Dec 2 '16 at 18:46 • @daHugLenny How did I missed that :) – Roman Gräf Dec 2 '16 at 19:48 # Baby Language, 0 bytes I didn't submit this originally because I thought it postdated the question. I was wrong; the language did have an interpreter created in time. It's also probably the least cheaty 0-byte solution I've seen (given that a 0-byte program is specified to do exactly what the program asks, and not for the purpose of cheating on golfing challenges). Baby Language is specified to ignore the program it's given and do something at random. (The interpreter linked on the Esolang page generates a random legal BF program and runs it.) That seems like a perfect fit for this challenge. ## Pyke, 1 byte C  Try it here! Outputs the current time • I'm fairly certain this is deterministic. – Rɪᴋᴇʀ Nov 30 '16 at 20:33 • @EasterlyIrk in a deleted comment mbomb said this was ok – Blue Nov 30 '16 at 20:34 • Oh, okay. Seems deterministic to me, but OP rules. – Rɪᴋᴇʀ Nov 30 '16 at 20:35 • In my edit history I had a 3 byte version with proper randomness – Blue Nov 30 '16 at 20:35 • @EasterlyIrk If the current time is deterministic, then so are pseudo-random numbers, since that's what they're seeded with. The goal is not "randomness". The goal is non-determinism. – mbomb007 Nov 30 '16 at 20:35 # MATL, 1 byte r  Uniform random number generator between 0 and 1. The seed is randomly set for each execution of the program. Try it online! • Same exact solution and explanation works in Pip. – DLosc Dec 1 '16 at 3:34 # C89 with GCC/Clang, 20 bytes The other C solution just segfaults every time when built with GCC or Clang. This, though. main(n){puts(&n+1);}  Which looks like: $ for _ in seq 1 50; do ./test_89; done
���z�U
�VW��U
�F��U
�v�f2V
��FV
���*=V
�6���U
�20wU
��
�+V
�6
�U
��V�uU
�v��V
���K�U
��7�qU
�6S�jU
�&�WU
��wV
��6l�U
���U
�F�ߨU
�f���U
���s7V
�f��?V
��;B�U
�;��U
��GV
�� ��U
�vKV
�V?]wU
�����U
��.�U
�v"�XU
��uhpU
��LD�U
�����U
�6X�U
��M�.V
�69��U
��ԤV
���U
����U
�vx4.V
�֝+xU
�F��U
�֤BQV
��#�U
���1^U
����sU
��4�U
��AݗU


Quite a lot of unprintable junk but it's nondeterministic!

• why "main(n){puts(&n+1);}" and not "main(n){puts(&n);}"? – RosLuP Dec 2 '16 at 22:23
• @RosLuP Your second option, which seems obvious to the casual observer, gives the byte at the value of n (when n is 1, putsing its address gives 1, and when n is 2, putsing its address gives 2). Adding 1 to the address of n, which should point to a 4-byte wide int, gives a junk address with a junk value stored there with a very certain number of bytes until the next NUL byte. This behaviour is reproducible between GCC and Clang and completely beyond me. I think I'll go ask on StackOverflow. – cat Dec 2 '16 at 22:30
• i read "puts(&n)" in this way: it give to puts the address of n, suppose that n=0x01020304 puts would print converted in chars 04 03 02 01 or reverse of that – RosLuP Dec 2 '16 at 22:41
• Remember your n is still initialized with what's normally called argc which is 0 in your general test case, so with &n, puts gets a quite deterministic pointer to a '\0' byte resulting in an empty string (assuming pointer size == integer size and all that stuff). &n+1 however is the address of what's normally called argv (at least on ABIs that pass parameters on the stack in reverse order instead of registers, and with a stack that grows from high to low addresses), which, assuming ASLR, should be a different pointer every time. – Guntram Blohm supports Monica Dec 5 '16 at 15:11
• @GuntramBlohm You're right and that's very interesting, although for me pointers are 8 bytes and ints are 4 bytes. – cat Dec 5 '16 at 15:29

# PHP, 12 bytes

<?=uniqid();


Outputs a unique ID 583f4da627ee3 based on the current time in microseconds.

• <?=time(); <-- 10 bytes. – Ismael Miguel Nov 30 '16 at 23:23
• @IsmaelMiguel uniqid() is 1'000'000 times more undetermined than time() ;) – Mario Nov 30 '16 at 23:40
• I'm not saying the oposite. But proposing another answer. You're free to pick that one. – Ismael Miguel Nov 30 '16 at 23:45
• @IsmaelMiguel someone else gave the same answer already... – Mario Nov 30 '16 at 23:46

# Groovy, 9 bytes

{print{}}

Outputs:

Script1\$_run_closure1@2c8ec01c

Because it outputs the memory address of the closure it is non-deterministic.

• And I thought Kotlin was the way to the shortest possible JVM solution. – F. George Nov 30 '16 at 23:33
• Trying to put this into a file and running groovy Script1.groovy, I get an error: Ambiguous expression could be either a parameterless closure expression or an isolated open code block;. How do I use this? – Paŭlo Ebermann Dec 4 '16 at 1:45
• Assign it to a closure variable, then call it. – Magic Octopus Urn Dec 5 '16 at 5:14