Tasks involving random numbers and/or output.

learn more… | top users | synonyms

5
votes
3answers
266 views

Golf Me a Random Dubstep of the Day List

Aside of nursing my child, Vitsy, and dabbling in the art of code golf, I also am an avid dubstep fan, listening to all the new dubstep that Monstercat puts out as regularly as I can. I also share a ...
-3
votes
0answers
72 views

Let's make some noise [closed]

Create a program, wich generates and prints out a pseudo random gradient noise, like perlin or simplex noise. Rules You need to take in the size of the noise with stdin (if your language doesn't ...
11
votes
4answers
250 views

Interpret the Pig series

Given an input of a Pig, SickPig, DeadPig, QuinePig, or DeafPig program, choose one of those "languages" randomly and interpret the input as that "language." First, randomly choose between one of the ...
10
votes
3answers
582 views

Help me Shut the Box

The inspiration for this challenge should be ridiculously obvious at the time of posting. The Task You must create a Shut the Box style program (not function, program). The basics of shut the box ...
4
votes
3answers
98 views

Sample win/loss data generator based on certain criteria

Lets say we have this existing data: Total - 10 Won - 7 Lost - 3 Longest Winning Streak - 5 Longest Losing Streak - 2 Now you need to write a function which generates an array of random ...
15
votes
2answers
249 views

Exploding Cats!

Challenge You will be making a program/function that takes a string input of length n, and: Puts the kth char at the center of the space, where k = (n+1)/2. This will be the location of your ground ...
4
votes
0answers
132 views

MarGolf Meets Langton's Anthill

This is Markov. Markov's golf ball rolls around randomly. Markov's ball will hole however he strikes it. Markov is smart. Be like Markov. And this: is an anthill in Langton's backyard. The anthill ...
32
votes
26answers
5k views

Choose The Powerball Numbers!

Powerball is an American lottery that has recently gained attention because the current jackpot (as of January 11, 2016) is the largest lotto prize in history, at about $1.5 billion (USD). Powerball ...
9
votes
0answers
85 views

Chess-olition Derby

What could be more polar opposites than chess and demolition derby. You would think that no one who enjoys one would enjoy the other... until today. Rules The starting position is a standard chess ...
-5
votes
8answers
134 views

Use what you know: Your take on Diceware [duplicate]

If you're not familiar, Diceware is a method for creating passwords using an ordinary die from a pair of dice as a hardware random number generator. For the sake of fun, let's ignore anything about ...
24
votes
9answers
3k views

Map a random number to pi

The first 50 digits of pi are: 31415926535897932384626433832795028841971693993751 Now, a double precision representation can only guarantee an accuracy of 15 decimal places, thus pi is approximated ...
20
votes
15answers
1k views

The Random Walker Printer

Draw a program or function that will write to STDOUT n times (each for one step) a string that contains a dot . at the location of the walker. The program also needs to write a line every s seconds ...
18
votes
32answers
2k views

1/N probability

Because there are not enough simple code-golf challenges: Create an optionally unnamed program or function that, given (by any means) an integer N ≥ 1, outputs your language's TRUE value with a ...
31
votes
32answers
3k views

Russian Roulette, Reloaded

Let's play Russian Roulette! Normally, this would be a race to write the shortest MOD 6 program, but that's not very realistic, as the chance of winning decreases with each click. Here are the rules: ...
12
votes
7answers
342 views

D&D Skill Challenges

In Dungeons & Dragons, almost everything is decided by rolling a die. Typically, if the roll is greater than or equal to a specified value, your attempt at doing whatever you wanted to do ...
46
votes
31answers
3k views

Alex-style Addition

Inspired by Alex's glorious Learn you an R for great good, we are going to humbly recreate Alex's "one true R program" -- but with a twist. Alex-style Addition works like this -- it has a 90% chance ...
17
votes
1answer
333 views

Random Golf of the Day #6: Roll a d20

About the Series First off, you may treat this like any other code golf challenge, and answer it without worrying about the series at all. However, there is a leaderboard across all challenges. You ...
24
votes
3answers
2k views

Generating Brainf*** NOPs

Sometimes when writing brainfuck code, you feel the need to make it longer than needed to encourage debugging. You could do it by just plopping a >< in there, but what fun is that? You'll need ...
12
votes
10answers
1k views

Iterated Dice Rolling

Given an input n where 3 <= n <= 25, perform the following steps, starting with a single n-sided die (faces in the range [1, n], inclusive): Print the result of rolling the current n-sided ...
0
votes
3answers
174 views

Layout my tiles for me

I'm retiling my kitchen with different coloured tiles. In fact, it's going to have at least 2 colours - and 26 colours as a maximum. But, I'm fussy. I want this wall to look random, but sometimes ...
53
votes
5answers
1k views

Simulate the Universe!

One nice property of a Turing-complete language is that it can be used to write any program, up to and including the simulation of the entire Universe. Your job is to do exactly that: write a program ...
17
votes
0answers
241 views

Plumbing Random Paths

Write a program or function that takes in three integers, a width w, a height h, and a step count s. You will be drawing a non-self-intersecting random walk s steps long on a 5*w by 5*h pixel image ...
-4
votes
24answers
364 views

Generate 0 or 1 [closed]

Is this Q too easy to ask, or has it just never been thought of? Generate a random number, either 0 or 1 using a program You may use a pre-defined function. The code must be executable. (It ...
10
votes
11answers
1k views

“i” have “i” chance of occuring

Design a random number generator where the i th number has i% chance of occurring for all 0 < i < 14. 0 should have exactly 9% chance of occurring. The seed for the generator should be ...
5
votes
1answer
100 views

Roller coaster of numbers [duplicate]

Write a program that generates a sequence of numbers starting with zero and then 100 random integers between -9 and 9. That sequence will be displayed like a roller coaster. Any increasing number in ...
14
votes
19answers
859 views

Boo! A Halloween Code Golf Challenge

Write a program that takes an input string of length 2 or more characters and adds the string ~BOO!~ (that string has a leading and ending space) in a uniformly random spot in the string that is not ...
12
votes
6answers
402 views

Simulate a game of Craps

Craps is a fairly simple dice game often played in casinos. Even if you aren't a gambler (which I'm not), it's still a fairly interesting game. Here's the rules: At the start of a game of Craps ...
17
votes
2answers
463 views

Generate Some Secure PINs

Inspired by this badly received migrated post. The head of security at your company is concerned about your PIN generating system after it gave him 12345. He also didn't really appreciate the ...
12
votes
3answers
242 views

Generate a Monotonic Function

Overview In this challenge, your task is to randomly generate a monotonic mathematical function between two sets. Input Your inputs are two positive integers s and n. After getting these inputs, ...
7
votes
12answers
1k views

Generate random UUID

I need a UUID. Your job is to generate one. The canonical UUID (Universally Unique IDentifier) is a 32-bit hexadecimal number with hyphens inserted in certain points.The program should output 32 hex ...
27
votes
30answers
3k views

Person of Interest

Background Person of Interest is a crime drama on CBS, and my favorite TV show, as of late. The show is about a man named Harold Finch, a billionaire programmer, and his partner John Reese, a ...
12
votes
15answers
2k views

Randomize points on a disc

I read about circles somewhere, and just now learned about discs (it's actually a pretty common concept) and thought about codegolf. Your task is to randomize a point/several points on a disc with ...
4
votes
4answers
283 views

Role-Playing Game Dice-Rolling

Background When playing an RPG such as Dungeons & Dragons, Pathfinder, or Paranoia, players each need a set of dice. You are hosting one such game this weekend, and some of the friends you ...
8
votes
2answers
305 views

Digitising the Library of Babel

The Library of Babel is defined as a universe in the form of a vast library containing all possible 410-page books of a certain format and character set. For the purposes of this question, ...
2
votes
0answers
156 views

Simple single-player board game, expected score distribution

This is the first problem I've posted here; please post criticisms in comments. Summary A game board consists of a starting space, an ending space, and between them are N spaces, each with an ...
17
votes
4answers
611 views

Roll my D&D character's ability scores

In Dungeons and Dragons, some of the most important atributes of a character are the ability scores. There are 6 ability scores, for the six abilities. The abilities are Strength, Dexterity, ...
13
votes
14answers
664 views

Insta-Name… Just Add Coder!

In the English language, a surefire way to make a pronounceable nonsense letter combination is to make it entirely out of consonant-vowel pairs, e.g., Wu ko pa ha, or, Me fa ro, consonant first, ...
16
votes
8answers
946 views

Analyzing Earthquakes

Background The Random Domino Automaton is a toy model for earthquakes, inspired by cellular automata. In this challenge, your task is to simulate a simplified version of this model, and collect data ...
20
votes
16answers
3k views

Bitstring Physics

Background Yes, bitstring physics is a real thing. The idea is to construct a new theory of physics using only strings of bits that evolve under a probabilistic rule... or something. Despite reading ...
8
votes
2answers
294 views

Sorting for Bozos

Introduction This challenge is about three (bad) sorting algorithms: Bogosort, and two others variants that I came up with (but have probably been thought of by others at some point in time): ...
16
votes
4answers
766 views

Random ASCII Art of the Day #5: Diamond Tilings

Mash Up Time! This is instalment #5 of both my Random Golf of the Day and Optimizer's ASCII Art of the Day series. Your submission(s) in this challenge will count towards both leaderboards (which you ...
14
votes
4answers
2k views

Build an ASCII Fibonacci Clock

Someone built a really fancy clock using Fibonacci numbers, which looks really nice but is fairly unusable. Just the way we like it! Let's recreate this. The clock is made up of 5 sections ...
1
vote
2answers
184 views

Looping Random Number Generator [closed]

I'm not even sure if this is even possible, but I think it's worth a shot. The Challenge Code/conceptualize a pseudo-random number generator that has the potential to produce results evenly spaced ...
16
votes
40answers
4k views

Death By Shock Probe: That's a lot of dice

In the webcomic Darths & Droids, Pete, who plays R2-D2 in the fictional roleplaying campaign around which the comic is based, once claims (warning: potential spoilers in the linked comic) that, ...
9
votes
4answers
601 views

Theseus' New Ship

The Ship of Theseus is an old question that goes something like: If a ship has had all of its original parts replaced, is it still the same ship? For this golf, we're going to slowly replace ...
18
votes
14answers
2k views

Random Golf of the Day #4: The Bertrand Paradox

About the Series First off, you may treat this like any other code golf challenge, and answer it without worrying about the series at all. However, there is a leaderboard across all challenges. You ...
13
votes
4answers
776 views

Draw a Random Walk with Slashes

Write a program or function that takes in a positive integer N (via stdin/command line/function arg) and prints or returns a string representation of a two dimensional random walk that is N steps ...
0
votes
0answers
67 views

Random arithmetic quiz [duplicate]

Given a and b as two random numbers from 0 to 10 and op as a random symbol of arithmetic operations, you should display 10 questions in the format: a op b = to the user, after each question if the ...
-3
votes
5answers
153 views

Generate a random floating point number between 2 limits [closed]

This challenge is to generate a random floating-point number between 2 limits. You may use any language so long as it can be called from the command line, and runs on linux. It must also be able to ...
5
votes
1answer
648 views

Drawing an Image Based on a Trace of its Hue

Introduction Local genius Calvin's Hobbies recently challenged us to trace the hue of an image. It is recommended to read his challenge beforehand, but to highlight the main points: The trace of ...