The options are in:
Surround the function with quotation marks. However as per JSR223 Sampler documentation it will result into caching the compiled value and generated string will be "random" during first iteration only
Pass it via "Parameters" section like
Use RandomStringUtils class instead:
String randomString = org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric(100, 4500)
More information on Groovy scripting in JMeter: Apache Groovy: What Is Groovy Used For?