So most likely they do provide rand_s() function. I am referring to Linux cstdlib.h if you read my post correctly.
For your problem, maybe you need to link to some specific libraries (those that have rand_s() functions inside) on top of those default libraries provided in order to be able to access rand_s() function ?
// crt_rand_s.c
// This program illustrates how to generate random
// integer or floating point numbers in a specified range.
// Remembering to define _CRT_RAND_S prior
// to inclusion statement.
#define _CRT_RAND_S
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
int main( void )
{
int i;
unsignedint number;
double max = 100.0;
errno_t err;
// Display 10 random integers in the range [ 1,10 ].
for( i = 0; i < 10;i++ )
{
err = rand_s( &number );
if (err != 0)
{
printf_s("The rand_s function failed!\n");
}
printf_s( " %u\n", (unsignedint) ((double)number /
((double) UINT_MAX + 1 ) * 10.0) + 1);
}
printf_s("\n");
// Display 10 random doubles in [0, max).
for (i = 0; i < 10;i++ )
{
err = rand_s( &number );
if (err != 0)
{
printf_s("The rand_s function failed!\n");
}
printf_s( " %g\n", (double) number /
((double) UINT_MAX + 1) * max );
}
}
Of course rand_s does not work in Linux as it uses internally RtlGenRandom API, which is only available in Windows XP and later.
The _s functions in Visual Studio 2005 and beyond are "safe" versions. They are not portable and will only work with Microsoft compilers.
BTW, Microsoft aren't the only ones (or first ones) to provide "safe" versions of standard C library functions. For example, OpenBSD provides "safe" versions of string functions.