How to write a random character generator?

Hi my name is weazelknievel and I'm just starting to get into programming and for my first project I want to do a random generator for league of legends I want it to randomly select a character. But the problem is that I never really programed before and don't really know how. So if there's anyone that could give some tips or something I'd really appreciate it. Thanks.
there is the classic function rand() % 4 , for instance this will give you a number between 0 and 3 , but the seed will always be the same , except if you had at the beginning of your main this srand((unsigned)time(NULL)); .

Also on c++11 there are uniform distribution functions.
If you don't know how to program, you have to learn how to do that before you can actually make a program. Read the C++ Tutorial here: http://www.cplusplus.com/doc/tutorial/

Good luck.
This is my random number script.
Then maybe a huge switch can do the work.
Try to use shortcut for that, at least copy/paste

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//Random numbers

#include <iostream>
#include <ctime>
using namespace std;

void main (void)
{
 
int Random_Number; 
int Random_Inferior_Boundary = 1;  
int Random_Superior_Boundary = 100; 

srand( (unsigned) time(NULL)); // It's required to get random number, it uses the computer clock.

Random_Number = (rand() % ((Random_Superior_Boundary + 1) - Random_Inferior_Boundary) + Random_Inferior_Boundary);

cout << Random_Number << endl;

system("pause");

}
Last edited on
in this code u can get random characters

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void main()
{
 clrscr();
 char a;
 srand(time(0));
 char *c="qwertyuioplkjhgfdsazxcvbnm" ;
 a=strlen(c);

c=c+rand()%a;
 cout<<*c;

 getch();
 }

Last edited on
prajesh, you are not at all answering the question the TC had. Please read the post content.
Topic archived. No new replies allowed.