DiscretizedVariable.draw

DiscretizedVariable.draw(indice)

Allow to draw a value in the i-th interval of the discretized variable.1

Parameters:
  • i (int) – the index of the interval to draw

  • indice (int)

Returns:

the value randomly drawn in the i-th interval

Return type:

float

Example

import pyagrum as gum

gum.initRandom(42)
x = gum.DiscretizedVariable("x", "x", [0, 1, 5, 10])
v = x.draw(1)  # a random value in the interval [1;5[
1 <= v < 5
# True

Class

DiscretizedVariable