random's questions - English 1answer

230 random questions.

99 bugs in the code

42 answers, 13.342 views code-golf random
99 bugs in the code The adaption of "99 bottles of beer on the wall" for computer science where the bugs increase instead of the bottles decreasing is often re-posted around the internet. Example T-...

Here's a programming puzzle for you: Given a list of pairs of strings and corresponding numbers, for example, [[A,37],[B,27],[C,21],[D,11],[E,10],[F,9],[G,3],[H,2]], output another list which will ...

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

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

Input None Output 52 cards. No duplicates. Cards are represented as their unicode characters, e.g. đź‚ą. The Unicode codepoints follow the following format: The first three digits are 1F0. The next ...

Minesweeper is a puzzle game where mines are hidden around a board of nondescript tiles with the goal of identifying the location of all mines. Clicking on a mine loses the game, but clicking on any ...

While there are many code golf questions on here involving randomness, I haven't seen one yet that actually asks for building an algorithmic pseudorandom number generator. There's this one that asks ...

Richard Dawkins in his book The Blind Watchmaker, describes a Weasel program. The algorithm can be described as follows: Start with a random string of 28 characters. Valid characters are all ...

Introduction You are given a random integer generator with the following implementation The first invocation always returns 1. The second invocation returns a random integer between 1 and 2. The ...

Rolling Quine Dice

7 answers, 1.022 views code-golf random quine
Create a program that outputs itself. However, if the source code is repeated n times (meaning to concatenate a copy of the source code to the end n-1 times), then there should be 1/n probability ...

Random Capitalization

51 answers, 4.389 views code-golf string random
The Task Your task is to create a program or a function that, given an input, outputs the input text with random letters capitalized, while keeping already capitalized letters capitalized. Every ...

K-means is a standard unsupervised clustering algorithm, which, given a set of "points" and a number of clusters K, will assign each "point" to one of K clusters. Pseudo-Code of K-means Note that ...

Your task is to write a program or a function that outputs n random numbers from interval [0,1] with fixed sum s. Input n, n≥1, number of random numbers to generate s, s>=0, s<=n, sum of ...

Challenge : Create a random (pseudo random) Sudoku board with dimension n x n Input : Given : n where : 2 < n < 100 Output : true / false depending on whether the board is valid or not. ...

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

Given one of the following as input: AK,AR,AS,AZ,CA,CT,DC,FL,GA,IL,IN,IA,KS,KY,LA,MD,MI,MN,MS,NV,NH,NJ,NM,NY,NC,ND,MP,OH,OK,OR,PA,PR,RI,SC,TN,TX,UT,VT,VA,WA,WI (with quotes) "AK","AR,"AS","AZ","CA",...

As a child, my friend had a magic 8 ball that we would ask questions to and see what the fate of that question was. Challenge Your challenge is to write a program (or function) that when run (or ...

Drag Race Countdown

11 answers, 393 views code-golf random
Challenge: In a hypothetical scenario, the countdown timer for a race has random intervals between the counts, to prevent premature starting, e.g. 3 (0.82 seconds pass), 2 (0.67 seconds pass), 1 ...

Background I play D&D on a regular basis with some friends. While talking about the complexity of some systems/versions when it comes to rolling dice and applying bonuses and penalties, we ...

I've always liked screens full of randomly colored pixels. They're interesting to look at and the programs that draw them are fun to watch. The challenge Fill your screen, or a graphical window, ...

Introduction A childhood game designed to help children learn to count in french in Canadian schools is played as follows: Students go around the room counting up to 11 A number greater than 11 ...

Duck, duck, goose!

100 answers, 12.173 views code-golf random
Remember the kids game, 'Duck, Duck, Goose'? No? Me neither. The challenge Print the word 'duck' on individual lines an indeterminate amount of times. Print the word 'goose'. Your program ends. The ...

You must fill an array with every number from 0-n inclusive. No numbers should repeat. However they must be in a random order. Rules All standard code-golf rules and standard loopholes are banned ...

Crazy 8s Code Golf

23 answers, 1.491 views code-golf string math random
Create a program that prints all whole numbers inclusively between an interval (a, b), and replaces multiples of 8 in the sequence with random (uniformly distributed, independent of other characters), ...

According to some controversial story, the odrer of ltteres in a wrod deos not mttaer much for raednig, as lnog as the frist and lsat lteter macth with the orignial wrod. So, for fun, what would be ...

I'm sure most, if not all, of you have come across this at some point or another: Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, the ...

Given a positive integer N ("virality"), your program should create an ASCII-art drawing of a tree with two branches of length N extending downwards and/or rightwards from the top-left corner. The ...

Happy Pi Day everyone! For no reason at all, I'm trying to construct a Monte Carlo estimator of Pi that is as short as possible. Can we construct one that can fit in a tweet? To clarify, what I have ...

Create a solar system

19 answers, 4.257 views code-golf random
Intro This is based on an actual problem I recently faced while making a computer game and I thought it would make for a nice round of code-golf. There are seven main spectral classes of star which ...

Because there are not enough simple code-golf challenges: Create an optionally unnamed program or function that, given (by any means) an integer 1 ≤ N ≤ 10000, outputs your language's True value with ...

Drunkard's Journey Home In this challenge you are to write a program which simulates a drunkard stumbling his way home from the bar. Input: The input will be an adjacency matrix (representing a ...

Given an input string, output that string with all vowels a, e, i, o and u swapped at random between each other. For example, in the string this is a test, there are 4 vowels: [i, i, a, e]. A valid ...

Factory workers

22 answers, 2.090 views code-golf ascii-art random
Challenge Factory workers are usually very hard-working. However, their work is now being commonly replaced with machines. You have to write a program that takes a number as input. It will print out ...

Just had a 'spirited' conversation with a co-worker about the succinctness of the following BASIC statement: 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 It's the title of this book, and will simply print ...

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

Your task is to create a random sequence of moves, which can be used to scramble a Rubik's Cube. Such a scramble is made up of exactly 25 moves. Each move consist of of the letters UDRLFB optionally ...

Exploding Cats!

4 answers, 483 views code-golf string random
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 ...

(The text asks how many boxes there are in the picture) Now you are required to generate such a problem and its answer. Input an integer n (optionally) random source of two values, in case you don'...

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

Numbers that are easy to remember yet theoretically not easily made Your challenge is to make a program/function in any language that generates uniformly random numbers that fit these criteria: ...

Let's see how good your language of choice is at selective randomness. Given 4 characters, A, B, C, and D, or a string of 4 characters ABCD as input, output one of the characters with the following ...

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

About the Series I will be running a little series of code-golf challenges revolving around the theme of randomness. This will basically be a 9-Hole Golf Course, but spread out over several questions....

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

About the Series This is a guest entry for the Random Golf of the Day series. First off, you may treat this like any other code golf challenge, and answer it without worrying about the series at all....

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

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

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

So, I wrote myself a one-liner which printed out a snake on the console. It's a bit of fun, and I wondered how I might condense my code... Here's a (short) example output: + ...

Very heavily inspired by this challenge Code Golf: Your own pet ASCII snake - I thought making it horizontal would add an extra layer of complexity. An example horizontal snake: 0 0 ...

Related tags

Hot questions

Language

Popular Tags