Rixstep
 About | ACP | Buy | Industry Watch | Learning Curve | News | Products | Search | Substack
Home » Industry Watch » The Technological

Generating Random Numbers

Today's extraordinary mindfuck.


Get It

Try It

FROM : Mahaboob
DATE : Wed Aug 05 12:44:08 2009

I need to produce 15 random numbers between 1 to 16 without repeating any number. I used the code like

int i,j;
for(i=0;i<15;i++){
    j =random() % 15 +1;
    NSLog(@"No: %d => %d \n",i,j);
    srandom(time(NULL)+i);
}

But some numbers are repeating.
How can I do it without repeating the numbers?

Thanks in advance
Mahaboob

About | ACP | Buy | Industry Watch | Learning Curve | News | Products | Search | Substack
Copyright © Rixstep. All rights reserved.