non-repeating random numbers

i'm supposed to generate 7 random numbers whereby each number can be any number between 1 to 45. but i need to ensure that there're no duplicates in those 7 numbers

Code:

`#include <stdio.h>`

int main(void)

{

int count, i=1, r_num[7];

srand (time(0)); /* seed is determined at run-time by the system */

for(count=0; count<7; count++)

r_num[count] = rand()%45 + 1;

for(i=0; i<7; i++)

{

for(a=0, a<7; a++)

{

if(i == a)

continue;

if(r_num[i] == r_num[a])

r_num[a] = rand()%45 + 1;

}

}

these are my codes..but im stuck..can anyone help me?