November 30, 2021 at 11:04 am

Erik Kostson

Ansys Employee

Not sure - I would have written a c++ function (a bit old fashioned but it has a nice random generator) to generate the random numbers and use that compiled .dll in ironpython via the ctype module, but that is undocumented and unsupported so can not help.

The above might be a bit overkill if you need something simple and that exists in Ironpython.

Not sure what you are doing exactly but if you just want random numbers there is a module in ironpython called random that will do that like this:

import random

randomnr=random.randrange(1,10) # generates a random int number between 1 and 10, or

randomnr_two=random.randint(1,10) # generates a random int number between 1 and 10

randomnr_three=random.uniform(1.00,10.00)# generates a random float number between 1 and 10

All the best

Erik

The above might be a bit overkill if you need something simple and that exists in Ironpython.

Not sure what you are doing exactly but if you just want random numbers there is a module in ironpython called random that will do that like this:

import random

randomnr=random.randrange(1,10) # generates a random int number between 1 and 10, or

randomnr_two=random.randint(1,10) # generates a random int number between 1 and 10

randomnr_three=random.uniform(1.00,10.00)# generates a random float number between 1 and 10

All the best

Erik