Check existence of BSD random before use.

What does this implement/fix?

TensorRandom.h currently relies on BSD random(), which is not always available. The linux manpage gives the glibc condition:

_XOPEN_SOURCE >= 500
              || /* Glibc since 2.19: */ _DEFAULT_SOURCE
              || /* Glibc <= 2.19: */ _SVID_SOURCE ||  _BSD_SOURCE

In particular, this was failing to compile for MinGW via msys2. If not available, we fall back to using rand().

Merge request reports

Loading