Re: Function rand()
Posted by: Florian Goebel
Date: July 17, 2012 01:38AM

Hello again,
thank for your answere.

I've found the file ndb_rand.c.
Here is the code:

#include <ndb_rand.h>

static unsigned long next= 1;

/**
* ndb_rand
*
* constant time, cheap, pseudo-random number generator.
*
* NDB_RAND_MAX assumed to be 32767
*
* This is the POSIX example for "generating the same sequence on
* different machines". Although that is not one of our requirements.
*/

int ndb_rand(void)
{
next= next * 1103515245 + 12345;
return((unsigned)(next/65536) % 32768);
}

void ndb_srand(unsigned seed)
{
next= seed;
}

is this the right code for the function rand()?
What is the starting value when i execute the function without starting value?

Flo

Options: ReplyQuote


Subject
Views
Written By
Posted
1127
July 16, 2012 08:30AM
607
July 16, 2012 09:12AM
Re: Function rand()
693
July 17, 2012 01:38AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.