Skip to content

Commit

Permalink
add explicit random engine
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeLing authored and vigsterkr committed Feb 22, 2018
1 parent 8524a78 commit 2270774
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
Expand Up @@ -165,7 +165,7 @@ SGVector<float64_t> CGaussianDistribution::log_pdf_multiple(SGMatrix<float64_t>

void CGaussianDistribution::init()
{
m_rng = get_prng();
m_rng = get_prng<std::mt19937_64>();
SG_ADD(&m_mean, "mean", "Mean of the Gaussian.", MS_NOT_AVAILABLE);
SG_ADD(&m_L, "L", "Lower factor of covariance matrix, "
"depending on the factorization type.", MS_NOT_AVAILABLE);
Expand Down
Expand Up @@ -70,7 +70,7 @@ void CGaussianBlobsDataGenerator::init()
m_stretch=1;
m_angle=0;
m_cholesky=SGMatrix<float64_t>(2, 2);
m_rng = get_prng();
m_rng = get_prng<std::mt19937_64>();
m_cholesky(0, 0)=1;
m_cholesky(0, 1)=0;
m_cholesky(1, 0)=0;
Expand Down
Expand Up @@ -47,7 +47,7 @@ void CMeanShiftDataGenerator::init()
SG_ADD(&m_dimension_shift, "m_dimension_shift", "Dimension of mean shift",
MS_NOT_AVAILABLE);

m_rng = get_prng();
m_rng = get_prng<std::mt19937_64>();
m_dimension=0;
m_mean_shift=0;
m_dimension_shift=0;
Expand Down
8 changes: 4 additions & 4 deletions src/shogun/mathematics/Math.h
Expand Up @@ -812,8 +812,8 @@ class CMath : public CSGObject
}

template <
class T,
class RandomGenerator = std::uniform_int_distribution<index_t>>
class T,
class RandomGenerator = std::uniform_int_distribution<index_t>>
static void permute(SGVector<T> v)
{
auto prng = get_prng();
Expand All @@ -825,8 +825,8 @@ class CMath : public CSGObject
}

template <
class T, class RandomGenerator,
class Distribution = std::uniform_int_distribution<index_t>>
class T, class RandomGenerator,
class Distribution = std::uniform_int_distribution<index_t>>
static void permute(SGVector<T> v, RandomGenerator prng)
{
for (index_t i = 0; i < v.vlen; ++i)
Expand Down
Expand Up @@ -97,7 +97,7 @@ class CTraceSampler : public CSGObject
{
m_num_samples=0;
m_dimension=0;
m_rng = get_prng();
m_rng = get_prng<std::mt19937_64>();

SG_ADD(&m_num_samples, "num_samples",
"Number of samples this sampler can generate", MS_NOT_AVAILABLE);
Expand Down
2 changes: 1 addition & 1 deletion src/shogun/neuralnets/RBM.cpp
Expand Up @@ -623,7 +623,7 @@ void CRBM::init()
m_visible_state_offsets = new CDynamicArray<int32_t>();
m_num_params = 0;
m_batch_size = 0;
m_rng = get_prng();
m_rng = get_prng<std::mt19937_64>();

SG_ADD(&cd_num_steps, "cd_num_steps", "Number of CD Steps", MS_NOT_AVAILABLE);
SG_ADD(&cd_persistent, "cd_persistent", "Whether to use PCD", MS_NOT_AVAILABLE);
Expand Down

0 comments on commit 2270774

Please sign in to comment.