Where does the random() function from SDK's urner example come from ?

Roald Baudoux's icon

Hello,

Random number generation examples in c most often include the C ANSI rand() and srand() functions. Some people use more sophisticated solutions (see this thread for instance) but those demand external libraries or much complex code. Therefore I do not understand where the random() function used in the SDK's urner example come from. I can't see it neither in ext.h nor in ext_obex.h. Is it Darwin-specific stuff ? Why isn't there any inclusion of a specific header file to use it ?

Thank you in advance.

Roald Baudoux's icon

Thanks Nicolas.

In between I have used the ANSI rand function.

It's strange that there's no #include line in the SDK's urner example. Even stranger: I have also forgotten to include stdlib.h (for rand) and time.h (to seed srand) in my code and it compiled flawlessly. Also the object functions as expected. So I suppose there is a kind of explicit inclusion of these functions. Is the whole C standard library included in such an implicit way ?

Roald Baudoux's icon

Thanks again Nicolas !