Questions tagged [random]

Tasks involving random numbers and/or output.

Filter by
Sorted by
Tagged with
18
votes
5answers
1k views

Fix a broken random function

A friend has an add-on card in their computer which generates a perfectly random number from 1 to 5 inclusive. Unfortunately, they spilt cola on it somehow, and it now generates only 2's for all ...
13
votes
10answers
984 views

Forecast the weather

Write the shortest program to forecast the weather for the next 7 days The input (from stdin) is the weekday and the season The output (to stdout) is seven lines weekday and the temperature in ...
-1
votes
1answer
4k views

Poisson random number generator [closed]

What is the shortest function (implemented in C) that will return a random draw from a Poisson distribution (given the mean or λ parameter)? ...
29
votes
31answers
14k views

Rand5() to Rand7() [closed]

You are provided with a function Rand5(). This function returns perfectly random (equal distribution) integers between 1 and 5. Provide the function Rand7(), which uses Rand5() to produce perfectly ...