Fixed detection of custom random number functions

This feature is annoying. Taking care not to read out the value of the the function into a variable until we know that it's not a matrix and then delaying the allocation if it is is tricky.

Signed-off-by: Andrew D. Horchler <adh9@case.edu>