petsc4py.PETSc.Random#
- class petsc4py.PETSc.Random#
Bases:
ObjectThe random number generator object.
See also
Enumerations
The random number generator type.
Methods Summary
appendOptionsPrefix(prefix)Append to prefix used for all
Randomoptions in the database.create([comm])Create a random number generator object.
destroy()Destroy the random number generator object.
Return the interval containing the random numbers generated.
Return the prefix used for all
Randomoptions in the database.getSeed()Return the random number generator seed.
getType()Return the type of the random number generator object.
getValue()Generate a scalar random number.
Generate a real random number.
Configure the random number generator from the options database.
setInterval(interval)Set the interval of the random number generator.
setOptionsPrefix(prefix)Set the prefix used for all
Randomoptions in the database.setSeed([seed])Set the seed of random number generator.
setType(rnd_type)Set the type of the random number generator object.
view([viewer])View a random number generator object.
Attributes Summary
The interval of the generated random numbers.
The seed of the random number generator.
Methods Documentation
- appendOptionsPrefix(prefix)#
Append to prefix used for all
Randomoptions in the database.Logically collective.
- create(comm=None)#
Create a random number generator object.
Collective.
- Parameters:
comm (Comm | None) – MPI communicator, defaults to
Sys.getDefaultComm.- Return type:
See also
- destroy()#
Destroy the random number generator object.
Collective.
See also
Source code at petsc4py/PETSc/Random.pyx:61
- Return type:
- getInterval()#
Return the interval containing the random numbers generated.
Not collective.
See also
- getOptionsPrefix()#
Return the prefix used for all
Randomoptions in the database.Not collective.
Source code at petsc4py/PETSc/Random.pyx:145
- Return type:
- getSeed()#
Return the random number generator seed.
Not collective.
See also
Source code at petsc4py/PETSc/Random.pyx:218
- Return type:
- getType()#
Return the type of the random number generator object.
Not collective.
See also
Source code at petsc4py/PETSc/Random.pyx:112
- Return type:
- getValue()#
Generate a scalar random number.
Not collective.
See also
Source code at petsc4py/PETSc/Random.pyx:190
- Return type:
- getValueReal()#
Generate a real random number.
Not collective.
See also
Source code at petsc4py/PETSc/Random.pyx:204
- Return type:
- setFromOptions()#
Configure the random number generator from the options database.
Collective.
Source code at petsc4py/PETSc/Random.pyx:178
- Return type:
- setInterval(interval)#
Set the interval of the random number generator.
Not collective.
See also
- setOptionsPrefix(prefix)#
Set the prefix used for all
Randomoptions in the database.Logically collective.
- setSeed(seed=None)#
Set the seed of random number generator.
Not collective.
- Parameters:
seed (int | None) – The value for the seed. If
None, it only seeds the generator.- Return type:
See also
- setType(rnd_type)#
Set the type of the random number generator object.
Collective.
See also
- view(viewer=None)#
View a random number generator object.
Collective.
See also
Attributes Documentation
- interval#
The interval of the generated random numbers.
- seed#
The seed of the random number generator.