What can I do with random numbers?

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

mister_m
Posts: 34
Joined: Fri Feb 04, 2011 2:51 am UTC

What can I do with random numbers?

Are there any interesting programming projects that rely heavily on a large amount of random data, or just general random numbers? I know that cryptography relies heavily on random data,but I am mostly curious as to other stuff that may or may not rely on random data. Thanks.

gorcee
Posts: 1501
Joined: Sun Jul 13, 2008 3:14 am UTC

Re: What can I do with random numbers?

Monte carlo simulations often require large sets of random numbers.

thoughtfully
Posts: 2253
Joined: Thu Nov 01, 2007 12:25 am UTC
Location: Minneapolis, MN
Contact:

Re: What can I do with random numbers?

There are lots of stochastic algorithms that trade runtime for certainty in a lot of situations. Factoring really big numbers is one of them.
Last edited by thoughtfully on Mon Feb 21, 2011 8:01 pm UTC, edited 1 time in total.

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
-- Antoine de Saint-Exupery

scarecrovv
It's pronounced 'double u'
Posts: 674
Joined: Wed Jul 30, 2008 4:09 pm UTC
Location: California

Re: What can I do with random numbers?

You could test sorting algorithms, and see how they perform in practice. Or stress test software in general, looking for bugs associated with random input.

Yakk
Poster with most posts but no title.
Posts: 11129
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: What can I do with random numbers?

There are the probabilistic complexity classes. These are problems that can be solved by random Turing Machines in a particular amount of space/time.
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.

Posts: 3072
Joined: Mon Oct 22, 2007 5:28 pm UTC
Location: Beaming you up

Re: What can I do with random numbers?

You can generate an encryption key.
<quintopia> You're not crazy. you're the goddamn headprogrammingspock!
<Cheese> I love you

Moose Hole
Posts: 398
Joined: Fri Jul 09, 2010 1:34 pm UTC

Re: What can I do with random numbers?

Make a game with random things shooting at you or something.

Dason
Posts: 1311
Joined: Wed Dec 02, 2009 7:06 am UTC
Location: ~/

Re: What can I do with random numbers?

Do some bayesian statistics!
double epsilon = -.0000001;

The Black Hand
Posts: 1037
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Behind you

Re: What can I do with random numbers?

Simplify rolling lots and lots of dice.

Wh40k, I'm looking at you.
73, de KE8BSL loc EN26.

Earlz
Gets Obvious Implications
Posts: 785
Joined: Sat Jun 09, 2007 8:38 am UTC
Location: USA
Contact:

Re: What can I do with random numbers?

Hook up a CPU emulator, create a random set of data/code, and then execute it until it either does something useful, falls into an infinite loop, or crashes. And then repeat with another set of random data
My new blag(WIP, so yes it's still ugly..)
DEFIANCE!

This is microtext. Zooming in digitally makes it worse. Get a magnifying glass.. works only on LCD

cjdrum
Posts: 113
Joined: Sun Dec 12, 2010 4:51 am UTC
Location: BACK

Re: What can I do with random numbers?

Make a simple "I've picked a number between 1 and 100" game. That was fun when I did that. Even put a counter so it tells you how many guesses it took.

The Black Hand
Posts: 1037
Joined: Tue Feb 12, 2008 11:40 am UTC
Location: Behind you

Re: What can I do with random numbers?

Earlz wrote:Hook up a CPU emulator, create a random set of data/code, and then execute it until it either does something useful, falls into an infinite loop, or crashes. And then repeat with another set of random data

Then breed the resultant "useful" programs, adding in select "mutations", until it becomes self aware, and starts questioning the existence of a creator.
73, de KE8BSL loc EN26.

thoughtfully
Posts: 2253
Joined: Thu Nov 01, 2007 12:25 am UTC
Location: Minneapolis, MN
Contact:

Re: What can I do with random numbers?

I have no need of that hypothesis.
[ Laplace to Napoleon ]

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
-- Antoine de Saint-Exupery

mcvoid
Posts: 24
Joined: Tue Jan 18, 2011 1:35 pm UTC

Re: What can I do with random numbers?

If you're a visual person you might appreciate generating Perlin noise and run it through some filters until you get natural-looking patterns like clouds and wood and stuff.

tipo test
Posts: 66
Joined: Sun May 23, 2010 12:15 pm UTC

Re: What can I do with random numbers?

mcvoid wrote:If you're a visual person you might appreciate generating Perlin noise and run it through some filters until you get natural-looking patterns like clouds and wood and stuff.

perlin noise <3

http://freespace.virgin.net/hugo.elias/ ... perlin.htm

scarecrovv
It's pronounced 'double u'
Posts: 674
Joined: Wed Jul 30, 2008 4:09 pm UTC
Location: California

Re: What can I do with random numbers?

tipo test wrote:http://freespace.virgin.net/hugo.elias/models/m_perlin.htm

Thanks for that link. It has a high awesome/confusing ratio.

314man
Posts: 119
Joined: Sat Oct 09, 2010 6:03 pm UTC
Location: Ontario

Re: What can I do with random numbers?

Computer games use a lot of random numbers. I designed a casino a few years ago (a basic one but still), and handling cards was definitely a nifty challenge. I also made my own version of snake and random numbers were used for the fruit position and which fruit comes up.

I don't have any experience in actual game programming though (just messed around in 2D a lot), but I'm pretty sure randomness is involved in AI in some way so that they're not completely predictable

evilbeanfiend
Posts: 2650
Joined: Tue Mar 13, 2007 7:05 am UTC
Location: the old world

Re: What can I do with random numbers?

DSP simulation usually needs good quality random numbers to simulate noise
in ur beanz makin u eveel

ircmaxell
Posts: 44
Joined: Wed Dec 24, 2008 3:06 am UTC

Re: What can I do with random numbers?

Run garbage collection when you don't want to run it every time and don't want to have to keep track of a counter (useful for cleaning up sessions, stale cache items, etc).

Code: Select all

`if (rand(0, 100) == 1) {    runGcCode();}`

Pesto
Posts: 737
Joined: Wed Sep 05, 2007 5:33 pm UTC
Location: Berkeley, CA

Re: What can I do with random numbers?

scarecrovv wrote:You could test sorting algorithms, and see how they perform in practice. Or stress test software in general, looking for bugs associated with random input.

I heard of an interesting type of GUI testing. I think it was called something like fuzz testing. You generate random input events like keyboard input or mouse clicks. So long as the program does not exit abnormally, the test is considered successful.

mcvoid
Posts: 24
Joined: Tue Jan 18, 2011 1:35 pm UTC

Re: What can I do with random numbers?

RSA needs a good random number generator to pick the keys. You just genrate really big numbers and test if they are prime until you get two nice primes. Then you generate another large number that's coprime with something that you calculate from the first numbers. The algorithm for generating the key and encrypting/decrypting is fairly easy at that point.

http://en.wikipedia.org/wiki/RSA#Key_generation

Sagekilla
Posts: 382
Joined: Fri Aug 21, 2009 1:02 am UTC
Location: Long Island, NY

Re: What can I do with random numbers?

Sort a few billion random numbers. Then parallelize the sorting.
http://en.wikipedia.org/wiki/DSV_Alvin#Sinking wrote:Researchers found a cheese sandwich which exhibited no visible signs of decomposition, and was in fact eaten.

WarDaft
Posts: 1583
Joined: Thu Jul 30, 2009 3:16 pm UTC

Re: What can I do with random numbers?

There's a method for which it's argued that it can solve the halting problem if you have certain guarantees about the random sequence you have, but it's not actually implementable because the guarantees can't actually be guaranteed by any known physical process.
All Shadow priest spells that deal Fire damage now appear green.
Big freaky cereal boxes of death.

RebeccaRGB
Posts: 336
Joined: Sat Mar 06, 2010 7:36 am UTC
Location: Lesbians Love Bluetooth
Contact:

Re: What can I do with random numbers?

Pesto wrote:I heard of an interesting type of GUI testing. I think it was called something like fuzz testing. You generate random input events like keyboard input or mouse clicks. So long as the program does not exit abnormally, the test is considered successful.

Yep: http://folklore.org/StoryView.py?projec ... _Lives.txt
Stephen Hawking: Great. The entire universe was destroyed.
Fry: Destroyed? Then where are we now?
Al Gore: I don't know. But I can darn well tell you where we're not—the universe!