use getentropy when available (backport of 75ede5bec8db) (closes #23115)