openmc.stats.Uniform

class openmc.stats.Uniform(a: float = 0.0, b: float = 1.0)[source]

Distribution with constant probability over a finite interval [a,b]

Parameters
  • a (float, optional) – Lower bound of the sampling interval. Defaults to zero.

  • b (float, optional) – Upper bound of the sampling interval. Defaults to unity.

Variables
  • a (float) – Lower bound of the sampling interval

  • b (float) – Upper bound of the sampling interval

classmethod from_xml_element(elem: Element)[source]

Generate uniform distribution from an XML element

Parameters

elem (lxml.etree._Element) – XML element

Returns

Uniform distribution generated from XML element

Return type

openmc.stats.Uniform

sample(n_samples=1, seed=None)[source]

Sample the univariate distribution

Parameters
  • n_samples (int) – Number of sampled values to generate

  • seed (int or None) – Initial random number seed.

Returns

A 1-D array of sampled values

Return type

numpy.ndarray

to_xml_element(element_name: str)[source]

Return XML representation of the uniform distribution

Parameters

element_name (str) – XML element name

Returns

element – XML element containing uniform distribution data

Return type

lxml.etree._Element