Ansys Learning Forum › Forums › Discuss Simulation › Photonics › How to generate a random integer within a specified range? › Reply To: How to generate a random integer within a specified range?
November 12, 2024 at 9:33 pm
Kirill
Ansys Employee
Hello Subscriber,
1.      Consider using the following functions, which take a floating-point argument and return an integer: ceil (rounds up), floor (rounds down), and round (rounds to the nearest integer).
2.      The rand function itself can also return an integer directly when used with 3 arguments. Please check the linked documentation for details.
Â
Additionally, you may find it helpful to review the Ansys Optics Scripting Language section, as well as the Ansys Lumerical Scripting Course.
Â
Best regards,
Kirill