Pelles C forum

C language => Beginner questions => Topic started by: Arijit Pal on April 27, 2013, 12:26:31 AM

Title: "randomize" command is not working
Post by: Arijit Pal on April 27, 2013, 12:26:31 AM
#include<stdlib.h>
#include<stdio.h>
main()
{
   randomize();
   float u,d; int t;
   d =rand();
   u=(float)d/RAND_MAX;
   printf("   \n\n  random number is %f  ",u);
}


I coded this programme  to generate a random number. But pelles c shows unresolved external symbol "randomize. So how can I generate random numbers???? :( :( :( :( :(
Title: Re: "randomize" command is not working
Post by: Vortex on April 27, 2013, 10:32:59 AM
randomize is not supported by Pelles C.
Title: Re: "randomize" command is not working
Post by: jj2007 on April 27, 2013, 10:33:18 AM
#include <stdlib.h>
#include <stdio.h>
#include <time.h>

main()
{
   // randomize();
   srand(time(NULL));
   float u,d; int t;
   d =rand();
   u=(float)d/RAND_MAX;
   printf("   \n\n  random number is %f  ",u);
}