# Questions tagged [random]

Tasks involving random numbers and/or output.

326 questions
Filter by
Sorted by
Tagged with
2k views

### Apartment Building

Draw an "apartment" building according to the specifications below. Basic Rules Take, as input, the number of floors of the building. Return a building with that many floors meeting the ...
• 1,240
218 views

### Random Pixels Image Compression

Challenge: Given an integer $n$, guaranteed to be $\geq2$ and a power of 2, we are going to draw multiply boards either side-by-side or below one another, where the first has dimensions of $n$ ...
• 103k
376 views

### Split given integer into a given number of integers, each within given bounds

Input variables: (Names are just examples, they don't need to be named like this) GrandTotal - integer to divide SplitCount - ...
827 views

### Sniff out biased random permutations

The brilliant engineers at <enter company you love to hate> have struck again. This time they've "revolutionised" the generation of random permutations. "Every great invention is ...
• 5,690
2k views

### Shuffle an array, a little bit

Given some input array a = [a1, a2, ..., an] and a positive integer k, shuffle the input array ...
• 42.9k
2k views

### Randomly Rounding

Input a decimal number and round it to an integer, randomly rounding up or down with a probability based on its fractional part, so the expected value of the output equals to the input value. If ...
• 28.6k
2k views

### Random Point from a 2D Donut Distribution

A donut distribution (for lack of a better term) is a random distribution of points in a 2-dimensional plane, forming a donut-like shape. The distribution is defined by two parameters: the radius <...
• 6,100
3k views

### Output a random unary string

Your task is simple: output the letter x a random number of times. Every possible length of xs must have a non-zero probability ...
• 18.3k
211 views

### Busy beaver in a coin

$BB$ is the busy beaver function, an uncomputable function. Write a program which when given an integer $n$ as input, will output $BB(n)$, with at least $\frac 2 3$ probability. You can do ...
• 12.7k
830 views

### Shuffle a subsequence

Thanks to rak1507 for the suggestion "Random" in this challenge always refers to "uniformly random" - of all possible choices, each has an equal chance of being chosen. Uniform ...
2k views

### Schrödinger's cat program [closed]

Sandbox Your challenge is to write a program that when first run, will do one of the actions below at random with equal chances of both: A cat program A standard cat program: read everything from <...
• 693
335 views

### Repeat average‎

Background It was a normal presentation that I were in as a audience, until the presenter gave a math problem about repeat taking 2 number out of a list a replacing them with average, claiming that ...
• 1,367
350 views

### Joe Mama or Joe Biden [duplicate]

Your task Randomly pick and print "Joe Mama" or "Joe Biden" in as little bytes as possible. Rules No trailing lines, spaces, or anything else weird like that No election fraud! ...
• 11
670 views

### Simulate weathering of a rock

Inspired by my geography class, Sandboxed Simulate weathering / erosion. Input Input will be given as a string of any 2 characters (or see below) you like in the shape of the rock (here i use spaces ...
• 1,581
3k views

### Randomly capitalize half of a string

Given string s of even length as input, randomly capitalize exactly half of the letters. You can assume the input will always be a non-zero, even length You can ...
• 11.1k
144 views

### Print random characters indefinitely [duplicate]

Task Continuously print a random character (a-z, A-Z, 0-9) not separated by a newline (\n). Expected output ...
2k views

Given a number $n ≥ 2$, a blackbox function $f$ that takes no arguments and returns a random integer in the range 0...n-1 inclusive, and a number $m ≥ n$, your challenge is to generate a random ...
• 26.7k
2k views

### Make me a shape

The game shapez.io has a huge variety of shapes you can produce, such as: Each shape has a unique short code, for example the above is CrWbScRu. This means, going ...
• 26.7k
4k views

### Obfuscate my ><>

><>, or Fish, is a two-dimensional esoteric programming language where the instruction pointer (IP) toroidally moves around the codebox, wrapping when it hits an edge. ><> has four ...
• 26.7k
3k views

### Make an array of random 128 bit integers

Given an input value $n$, construct an array of $n$ random 128 bit (unsigned) integers. The integers should be uniformly random. Your code can use any in built random number generation function ...
3k views

### Roll up a D&D character, with options

I'd like to roll up the ability scores for my Dungeons and Dragons character. But I'd also like them to be balanced (and slightly better than average). Typically, a character's stats are created by ...
• 159
2k views

### Generate a British numberplate

Modern British number plates (a.k.a. registration marks or license plates) use the format AANNXXX where AA is a "DVLA ...
• 18.3k
319 views

### Bring my memories about Geronimo Stilton back

If you have read in your childhood a Geronimo Stilton's book i am sure that you remember the style of the text, sometimes the words was decorated for making the act of reading more funny for kids, ...
• 1,259
2k views

### Random Move 2x2 Scrambling

A simple way to scramble a 2x2x2 Rubik's cube is to make a sequence random moves. This is not how official scrambles are done, but can get pretty close to a uniform distribution of all possible ...
• 10.9k
2k views

### Write a program with infinite expected output

Write a program that halts producing a random finite numerical output with probability 1. The expected value of the outputs of the program must be infinite. For physical limits, you can assume your ...
• 12.7k
12k views

### Implement Minceraft

Introduction The game Minecraft has a 1 in 10000 chance of showing "Minceraft" instead of "Minecraft" on the title screen. Your challenge Your challenge is to code a function or ...
• 26.7k
928 views

### Random pair of primes

Given a positive input $n$, output a random pair of primes whose difference is $n$. It's fine if there's another prime between them. Every pair should possibly appear and the program should have ...
• 12.7k
2k views

• 2,229
4k views

### Drum fill generator

Create a program that generates a drum fill. Your program will output a pattern of L (left hand hits), 'R' (right hand hits), and ...
• 1,283