That commit, while intended to be NFC, wasn't.
libcxx/src/random.cpp used to first include <__config>, which used
to define _LIBCPP_USING_WIN32_RANDOM (but which doesn't include
any other system headers). After that, it checked for
_LIBCPP_USING_WIN32_RANDOM, and conditionally defined _CRT_RAND_S.
This was defined before including any further headers, as this has
to be defined for the declaration of rand_s() to be visible, and
has to be defined before including stdlib.h.
After that commit, _LIBCPP_USING_WIN32_RANDOM was defined only
later, in __random/random_device.h (which is included in
<random>). But we can't define _CRT_RAND_S after that, because
stdlib.h probably has been pulled in already at that point.
Instead loosen the criteria for defining _CRT_RAND_S to
_LIBCPP_WIN32API, which practically is defined exactly when
_LIBCPP_USING_WIN32_RANDOM is defined.