Unrandom

From Esolang
Jump to navigation Jump to search

Unrandom is an esoteric programming language by User:InCrIpTiOn that uses an integer to randomly generate BrainFuck code.

Syntax

An Unrandom program is represented with a single integer that acts as the seed for a Random Number Generator. The length of the generated code is length of the original integer (in characters, e.g: 23423 = 5). Every compiled character is a random number between 0 and 7 inclusively, which is the index of the BrainFuck character.

Compilation

The output of the code is dependant on the RNG used. This example uses the python library Random, and outputs (not runs) the brainfuck code.

import random
def run(x):
   random.seed(x)
   instructions = ['>','<','+','-','.',',','[',']']
   brainfcode = [instructions[random.randint(0,7)] for _ in str(x)]
   code="".join(brainfcode)
   return code

Examples

Due to the nature of the language, it is unsure whether it is possible to determine the output of the code. For this reason, there are no example programs. However, an example of valid code would be 19, which results in "><", which does nothing.

See also