Exemplo n.º 1
0
      i_start = i
      n = 1
  store_range()
  return result

class _(boost.python.injector, mersenne_twister):

  def random_selection(self, population_size, sample_size):
    assert population_size >= 0
    assert sample_size >= 0
    assert sample_size <= population_size
    perm = self.random_permutation(size=population_size)
    perm.resize(sample_size)
    return sorted(perm)

random_generator = ext.mersenne_twister(scitbx.random.mt19937)

def set_random_seed(value):
  random_generator.seed(value=value)

random_size_t = random_generator.random_size_t
random_double = random_generator.random_double
random_bool = random_generator.random_bool
random_permutation = random_generator.random_permutation
random_selection = random_generator.random_selection
random_double_point_on_sphere = random_generator.random_double_point_on_sphere
random_double_unit_quaternion = random_generator.random_double_unit_quaternion
random_double_r3_rotation_matrix \
  = random_generator.random_double_r3_rotation_matrix
random_double_r3_rotation_matrix_arvo_1992 \
  = random_generator.random_double_r3_rotation_matrix_arvo_1992
Exemplo n.º 2
0
    store_range()
    return result


@boost.python.inject_into(mersenne_twister)
class _():
    def random_selection(self, population_size, sample_size):
        assert population_size >= 0
        assert sample_size >= 0
        assert sample_size <= population_size
        perm = self.random_permutation(size=population_size)
        perm.resize(sample_size)
        return sorted(perm)


random_generator = ext.mersenne_twister(scitbx.random.mt19937)


def set_random_seed(value):
    random_generator.seed(value=value)
    scitbx.random.set_random_seed(value)


random_size_t = random_generator.random_size_t
random_double = random_generator.random_double
random_bool = random_generator.random_bool
random_permutation = random_generator.random_permutation
random_selection = random_generator.random_selection
random_double_point_on_sphere = random_generator.random_double_point_on_sphere
random_double_unit_quaternion = random_generator.random_double_unit_quaternion
random_double_r3_rotation_matrix \