Can you generate random numbers in eDocBuilder templates?

EDOCBUILDER > eDocBuilder FAQs > Field Scripting
You can use the Rnd function to generate random numbers if you are using VB Script on an eDocBuilder template. It is only possible to generate random numbers when using VB Script on a field in a template. It is not possible to generate random numbers when using HTML Script. While there are not a lot of practical uses for random numbers in a print workflow, it's a good example of what can be done with VB Script in eDocBuilder.

Example template and scripts

This example template uses the Rnd function to choose one of two characters from a symbols font when the template is previewed during customization, resulting in a random pattern of empty or filled boxes.
 
The script used on the example template is: ifs(Int((1-0)*Rnd+0)=1,"g","c")
This will produce a random integer between 0 and 17: Int(Rnd*17)
This will produce a random integer between 1 and 100: Int((100-1)*Rnd+1)

Other uses of random numbers in print workflows

One example of using random numbers in a print workflow is stochastic or FM screening. But that is a process that happens on the RIP unit when producing output for the printer hardware, and would be applied to output after the eDocBuilder production file has been generated, and would not happen during customization of the eDocBuilder template.
 
Another example of random numbers in print workflows is lottery ticket situations. If you are creating templates for lottery tickets you would want the numbers produced to be verified and managed prior to creating the print output. eDocBuilder does not have the capability to remember the last values used on particular fields across different sessions from different users. This would be more likely a situation of using a variable-data file generated by your internal staff to then be used create multi-page output from an eDocBuilder template. Please see the article Ch. 029 Variable Data Template Creation - An Example for more information on that functionality.

Further reference

For more information on the Rnd function itself, please see this article about the Rnd function from the Microsoft documentation.
 
For more information on VB Script functions for eDocBuilder, please see the article Ch. 035 vbScript Field Scripting Reference in eDocBuilder documentation.