https://learning.getpostman.com/docs/postman/scripts/postman_sandbox_api_reference/#global-functions-pm
For more trials I have used
pm.test(“Body matches string”, function () { var cryptoRandomString = require (‘crypto-random-string’); console.log(cryptoRandomString(10)); });
Response on UI, Test Results Body matches string | Error: Cannot find module ‘crypto-random-string’
Postman sandbox doesn’t include crypto. Certain cryptographically secure random number generation related algorithms aren’t possible. I’m afraid, you’ll have to impersonate the same using Math.random