Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/25/03 21:25
Read: times


 
#61389 - P.S
Responding to: ???'s previous message
Shouldn't there be a variable to pass to the rand function to give me number of bits ie rand(4).
Here is the info supplied about the rand function in the manual:
<pre> RAND
Synopsis

#include <stdlib.h>
int rand (void)

Description
The rand() function is a pseudo-random number generator. It returns an integer in the range 0 to
32767, which changes in a pseudo-random fashion on each call. The algorithm will produce a
deterministic sequence if started from the same point. The starting point is set using the srand() call.

The example shows use of the time() function to generate a different starting point for the sequence
each time.
Example
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
void main (void)
{
time_t toc;
int i;
time(&toc);
srand((int)toc);
for(i = 0 ; i != 10 ; i++)
printf("%dt", rand());
putchar(’n’);
}

See Also
srand()
Note
The example will require the user to provide the time() routine as one cannot be supplied with the
compiler. See time() for more detail.<pre/>

List of 39 messages in thread
TopicAuthorDate
Random number from 1 to 8            01/01/70 00:00      
   P.S            01/01/70 00:00      
   RE: Random number from 1 to 8            01/01/70 00:00      
      RE: Random number from 1 to 8            01/01/70 00:00      
         RE: Random number from 1 to 8            01/01/70 00:00      
            RE: Random number from 1 to 8            01/01/70 00:00      
               RE: Random number from 1 to 8            01/01/70 00:00      
                  RE: Random number from 1 to 8            01/01/70 00:00      
         RE: Random number from 1 to 8            01/01/70 00:00      
            RE: Random number from 1 to 8            01/01/70 00:00      
               RE: Random number from 1 to 8            01/01/70 00:00      
            RE: Random number from 1 to 8            01/01/70 00:00      
               RE: Random number from 1 to 8            01/01/70 00:00      
   RE: Random number from 1 to 8            01/01/70 00:00      
      RE: Random number from 1 to 8            01/01/70 00:00      
         RE: Random number from 1 to 8            01/01/70 00:00      
            RE: Random number from 1 to 8            01/01/70 00:00      
            RE: Random number from 1 to 8            01/01/70 00:00      
               RE: Random number from 1 to 8            01/01/70 00:00      
                  RE: Random number from 1 to 8            01/01/70 00:00      
               RE: Random number from 1 to 8            01/01/70 00:00      
                  RE: Random number from 1 to 8            01/01/70 00:00      
               RE: Random number from 1 to 8            01/01/70 00:00      
               RE: Random number from 1 to 8            01/01/70 00:00      
               RE: Random number from 1 to 8            01/01/70 00:00      
                  RE: Random number from 1 to 8            01/01/70 00:00      
                     RE: Random number from 1 to 8            01/01/70 00:00      
                  RE: Random number from 1 to 8            01/01/70 00:00      
   Prime polynomials over GFn            01/01/70 00:00      
   ways to get the pseudo out            01/01/70 00:00      
      RE: ways to get the pseudo out            01/01/70 00:00      
         RE: ways to get the pseudo out            01/01/70 00:00      
            RE: ways to get the pseudo out            01/01/70 00:00      
               RE: ways to get the pseudo out            01/01/70 00:00      
                  RE: ways to get the pseudo out            01/01/70 00:00      
                     RE: ways to get the pseudo out            01/01/70 00:00      
                        RE: ways to get the pseudo out            01/01/70 00:00      
                           RE: ways to get the pseudo out            01/01/70 00:00      
   RE: Random number from 1 to 8            01/01/70 00:00      

Back to Subject List