<commit_before>// @(#)root/tmva/tmva/dnn:$Id$
// Author: <NAME> 10/07/16

/*************************************************************************
 * Copyright (C) 2016, <NAME>                                *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

 //////////////////////////////////////////////////////////////////
 // Implementation of the activation functions for the reference //
 // implementation.                                              //
 //////////////////////////////////////////////////////////////////


#include "TMVA/DNN/Architectures/Reference.h"
#include "TRandom.h"

namespace TMVA
{
namespace DNN
{

//______________________________________________________________________________

template<typename Real_t>
void TReference<Real_t>::DropoutForward(TMatrixT<Real_t> & B, TDescriptors*, TWorkspace*, Real_t dropoutProbability)
{
   size_t m,n;
   m = B.GetNrows();
   n = B.GetNcols();

   TRandom rand(time(nullptr));

   for (size_t i = 0; i < m; i++) {
      for (size_t j = 0; j < n; j++) {
         Real_t r = rand.Uniform();
         if (r >= dropoutProbability) {
            B(i,j) = 0.0;
         } else {
            B(i,j) /= dropoutProbability;
         }
      }
   }
}

}
}<commit_msg>[tmva] Use gRandom instead of TRandom:<commit_after>// @(#)root/tmva/tmva/dnn:$Id$
// Author: <NAME> 10/07/16

/*************************************************************************
 * Copyright (C) 2016, <NAME>                                *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

 //////////////////////////////////////////////////////////////////
 // Implementation of the activation functions for the reference //
 // implementation.                                              //
 //////////////////////////////////////////////////////////////////


#include "TMVA/DNN/Architectures/Reference.h"
#include "TRandom.h"

namespace TMVA
{
namespace DNN
{

//______________________________________________________________________________

template<typename Real_t>
void TReference<Real_t>::DropoutForward(TMatrixT<Real_t> & B, TDescriptors*, TWorkspace*, Real_t dropoutProbability)
{
   size_t m,n;
   m = B.GetNrows();
   n = B.GetNcols();

   for (size_t i = 0; i < m; i++) {
      for (size_t j = 0; j < n; j++) {
         Real_t r = gRandom->Uniform();
         if (r >= dropoutProbability) {
            B(i,j) = 0.0;
         } else {
            B(i,j) /= dropoutProbability;
         }
      }
   }
}

}
}
{'fraction_non_alphanumeric': 0.2759615384615385, 'fraction_numerical': 0.008974358974358974, 'mean_word_length': 1.442097026604069, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5896248', 'n_tokens_mistral': 804, 'n_tokens_neox': 741, 'n_words': 171}