User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Legacy and Other Languages section within the Software Development category of DaniWeb, a massive community of 397,597 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,907 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Legacy and Other Languages advertiser:

Running an equation a million times

Join Date: Jan 2008
Posts: 70
Reputation: andyg55 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
andyg55 andyg55 is offline Offline
Junior Poster in Training

Running an equation a million times

  #1  
Mar 3rd, 2008
Hi guys,

I'm sure this is pretty simple really, but I can't get my head around it.

I have a long equation that I'm using c++ to work out. It involves a random number generator, so each time the program is run, it replaces one of the variables in the equation with a random number. This gives me a different result each time

What I want to do is run the program a million times, store every result that I obtain, and then get an average at the end.

I'm thinking I should put a for loop at the start of my equation, but do I use a counter to record every result I get? I'm really not sure.

Thanks for any help you can give me, if you would like me to post some code I can do...

Andy.
AddThis Social Bookmark Button
Reply With Quote  
All times are GMT -4. The time now is 6:24 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC