Skip to main content

Questions tagged [random]

Tasks involving random numbers and/or output.

Filter by
Sorted by
Tagged with
12 votes
3 answers
439 views

We are going to define a simple little language. A word in this language is a binary string where the longest run of consecutive \$0\$s, is shorter than every (maximal) run of \$1\$s. So for example: \...
Wheat Wizard's user avatar
  • 103k
33 votes
8 answers
4k views

Edit: Please note there is currently a vote to close this coding challenge due to a complaint that it may be technically violating a decade old rule for this site. There is currently a discussion in ...
Albert Renshaw's user avatar
14 votes
25 answers
2k views

Inspired by this question Task: Given integers X and Y: Randomly select an int in 1..Y (inclusive), X times. This selection is to be performed without replacement ...
Themoonisacheese's user avatar
32 votes
5 answers
4k views

Simulate a roll of a fair die, and output the result in this ascii-art form: ...
aeh5040's user avatar
  • 2,072
21 votes
22 answers
2k views

Inspired by this X post. Write a program or function that takes a string as input and prints or otherwise renders the text with each word in a random color, e.g.: The input will be a string of ...
Jordan's user avatar
  • 12k
13 votes
22 answers
2k views

(Flexibly) output 3 random integers such that: Each number is 1 to 800 inclusive Their sum is ...
smots-18's user avatar
  • 583
14 votes
1 answer
1k views

Lost is a 2-D programming language where the start position and direction of the ip are entirely random. Today we will be writing a Lost program which uses this randomness to simulate a coin flip. A ...
Wheat Wizard's user avatar
  • 103k
21 votes
38 answers
3k views

Challenge The goal of this challenge is to generate and output a \$16 \times 32\$ (height \$\times\$ width) grid where all cells contain a decoy character, except for a random single cell that ...
vengy's user avatar
  • 2,309
16 votes
22 answers
3k views

Challenge Generate two \$16 \times 16\$ grids, each initially filled with "@" symbols and spaces. Each cell in the grids should be independently filled with an "@" or a space, with ...
vengy's user avatar
  • 2,309
1 vote
8 answers
397 views

Challenge Given a positive integer \$N \ge 3\$, generate an alternating series of \$N\$ random numbers within the range \$[1, N]\$, such that their sum equals \$N\$. Expressed mathematically as $$N = ...
vengy's user avatar
  • 2,309
5 votes
4 answers
592 views

Challenge Create a 3D word puzzle where the cube's dimensions match the length of the input word. The uppercase word (A-Z) must be validly placed within the cube in one of the fixed orientations: ...
vengy's user avatar
  • 2,309
1 vote
3 answers
346 views

I want an n*n table that is filled with black or white and the following conditions are satisfied in it: All cells of a 2*2 square in this table should not be the same color. All black and white ...
Shahnazi2002's user avatar
-3 votes
1 answer
284 views

Generate the contents of an SVG file containing 6 bingo cards. Winner is the one that uses the shortest code. A qualifying answer has an output that can be directly pasted in a blank to get the ...
paki eng's user avatar
  • 175
21 votes
23 answers
4k views

Related You are a manager at a large number factory. You want to show everyone your business is doing well, by showing randomly chosen samples. Unfortunately, your business is not doing that well. But ...
The Empty String Photographer's user avatar
17 votes
18 answers
2k views

In probability theory, a Bernoulli variable is a random variable which has a single parameter \$p\$, and is equal to 1 with probability \$p\$, and 0 with probability \$1-p\$. In this challenge, there ...
Command Master's user avatar

15 30 50 per page
1
2 3 4 5
24