What can I do with random numbers?

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

Moderators: phlip, Moderators General, Prelates

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

What can I do with random numbers?

Postby mister_m » Mon Feb 21, 2011 7:00 pm UTC

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?

Postby gorcee » Mon Feb 21, 2011 7:14 pm UTC

Monte carlo simulations often require large sets of random numbers.

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

Re: What can I do with random numbers?

Postby thoughtfully » Mon Feb 21, 2011 7:54 pm UTC

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.
Image
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
-- Antoine de Saint-Exupery

User avatar
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?

Postby scarecrovv » Mon Feb 21, 2011 7:59 pm UTC

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.

User avatar
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?

Postby Yakk » Tue Feb 22, 2011 8:01 pm UTC

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.

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

Re: What can I do with random numbers?

Postby headprogrammingczar » Tue Feb 22, 2011 8:03 pm UTC

You can generate an encryption key.
<quintopia> You're not crazy. you're the goddamn headprogrammingspock!
<Weeks> 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?

Postby Moose Hole » Tue Feb 22, 2011 8:43 pm UTC

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

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

Re: What can I do with random numbers?

Postby Dason » Wed Feb 23, 2011 1:04 am UTC

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

User avatar
RoadieRich
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?

Postby RoadieRich » Wed Feb 23, 2011 1:30 am UTC

Simplify rolling lots and lots of dice.

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

User avatar
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?

Postby Earlz » Wed Feb 23, 2011 2:31 am UTC

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!
Image
This is microtext. Zooming in digitally makes it worse. Get a magnifying glass.. works only on LCD

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

Re: What can I do with random numbers?

Postby cjdrum » Wed Feb 23, 2011 2:46 am UTC

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

User avatar
RoadieRich
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?

Postby RoadieRich » Wed Feb 23, 2011 2:49 am UTC

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.

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

Re: What can I do with random numbers?

Postby thoughtfully » Wed Feb 23, 2011 4:11 am UTC

I have no need of that hypothesis.
[ Laplace to Napoleon ]
Image
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?

Postby mcvoid » Wed Feb 23, 2011 12:56 pm UTC

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.

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

Re: What can I do with random numbers?

Postby tipo test » Thu Feb 24, 2011 12:51 pm UTC

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

User avatar
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?

Postby scarecrovv » Thu Feb 24, 2011 11:13 pm UTC

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

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

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

Re: What can I do with random numbers?

Postby 314man » Tue Mar 01, 2011 2:42 am UTC

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

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

Re: What can I do with random numbers?

Postby evilbeanfiend » Fri Mar 04, 2011 2:55 pm UTC

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

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

Re: What can I do with random numbers?

Postby ircmaxell » Fri Mar 04, 2011 5:55 pm UTC

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();
}

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

Re: What can I do with random numbers?

Postby Pesto » Tue Mar 08, 2011 12:20 am UTC

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?

Postby mcvoid » Tue Mar 08, 2011 4:28 pm UTC

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?

Postby Sagekilla » Fri Mar 11, 2011 5:09 am UTC

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.

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

Re: What can I do with random numbers?

Postby WarDaft » Fri Mar 11, 2011 8:03 am UTC

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.

User avatar
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?

Postby RebeccaRGB » Sat Mar 12, 2011 5:23 am UTC

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!


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 9 guests