TAGGED: geometry, mathematical-model
-
-
November 12, 2024 at 3:30 pm
10172100207
SubscriberXmin = [80,300,30,160,10]; # D,P,H,G min
Xmin = [100,400,50,20,10];
Xmax = [160,700,200,320,200];Â
p1(i,j) = Xmin(j) + rand*(Xmax(j) - Xmin(j));
But I want the rand(between 0 and 1)*(Xmax(j) - Xmin(j)) to be an int number, not float.Â
-
November 12, 2024 at 9:33 pm
Kirill
Ansys EmployeeHello 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
-
- You must be logged in to reply to this topic.
-
3170
-
1014
-
956
-
858
-
798
© 2025 Copyright ANSYS, Inc. All rights reserved.