Help with Looping?

I figured it would probably help more if I posted the physical code on here for help. The idea behind it is that this is a random number generator that chooses loot for players. The program works until I try to loop it, in which it spits out the exact same numbers. Can anyone help me with this? This code is showing up until the first random number generator.

#include <tchar.h>
#define _tWinMain wWinMain
#include "stdafx.h"
#include <iostream>
#include <ctime>
#include <string>
#include <random>
using namespace std;

int _tmain()
{
srand(time(NULL));
double random;
double random2;
double gold;
float time;
random = (rand() % (100) + 1);
Make sure that you only call srand() once. Then you can put the rest of the code in a loop. If you call srand() again within the same second, then it re-seeds the random number generator with the same value (because time() returns the same value). That means that the next call to rand() will return the same value.
Sorry, I put the wrong code above.

As far as I know, srand only hits once.

I've put the full copy of the code here, if it helps any.

http://pastebin.com/BKM6Me9k
Can you post an example of the looping code that's giving the wrong answer?

Dave
Can you post an example of the looping code that's giving the wrong answer?

Also, that code you linked to is huge. Consider putting the data in a file, then have your program read the file and act on it. For example, each line of the file might contain the D10 value, the weapon value, and the message to print.
I alreayd gave the answer and his code works fine now. Im not sure why he would post the identical question both in general and beginner. Either way, Its been answered in the general section.
Topic archived. No new replies allowed.