test_class.file: modules/ml/src/test/java/org/apache/ignite/ml/selection/split/mapper/SHA256UniformMapperTest.java
test_class.identifier: SHA256UniformMapperTest
test_case.body: @Test
      public void testMap() {
          UniformMapper<Integer, Integer> mapper = new SHA256UniformMapper<>(new Random(42));
  
          int cnt = 0;
  
          for (int i = 0; i < 100_000; i++) {
              double pnt = mapper.map(i, i);
  
              if (pnt < 0.2)
                  cnt++;
          }
  
          double err = 1.0 * Math.abs(cnt - 20_000) / 20_000;
  
          // Hash function should provide a good distribution so that error should be less that 2% in case 10^5 tests.
          assertTrue(err < 0.02);
      }
test_case.class_method_signature: SHA256UniformMapperTest.testMap()
test_case.full_signature: @Test public void testMap()
test_case.identifier: testMap
test_case.invocations: map abs assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMap()
focal_class.declarator: serialVersionUID = -8179630783617088803L
focal_class.modifier: private static final
focal_class.original_string: private static final long serialVersionUID = -8179630783617088803L;
focal_class.type: long
focal_class.var_name: serialVersionUID
focal_class.declarator: HASHING_ALGORITHM = "SHA-256"
focal_class.modifier: private static final
focal_class.original_string: private static final String HASHING_ALGORITHM = "SHA-256";
focal_class.type: String
focal_class.var_name: HASHING_ALGORITHM
focal_class.declarator: digest = new ThreadLocal<>()
focal_class.modifier: private static final
focal_class.original_string: private static final ThreadLocal<MessageDigest> digest = new ThreadLocal<>();
focal_class.type: ThreadLocal<MessageDigest>
focal_class.var_name: digest
focal_class.declarator: shuffleStgy = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7)
focal_class.modifier: private final
focal_class.original_string: private final List<Integer> shuffleStgy = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7);
focal_class.type: List<Integer>
focal_class.var_name: shuffleStgy
focal_class.file: modules/ml/src/main/java/org/apache/ignite/ml/selection/split/mapper/SHA256UniformMapper.java
focal_class.identifier: SHA256UniformMapper
focal_class.interfaces: implements UniformMapper<K,V>
focal_class.class_method_signature: SHA256UniformMapper.SHA256UniformMapper()
focal_class.full_signature: public  SHA256UniformMapper()
focal_class.identifier: SHA256UniformMapper
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  SHA256UniformMapper()
focal_class.class_method_signature: SHA256UniformMapper.SHA256UniformMapper(Random random)
focal_class.full_signature: public  SHA256UniformMapper(Random random)
focal_class.identifier: SHA256UniformMapper
focal_class.modifiers: public
focal_class.parameters: (Random random)
focal_class.signature:  SHA256UniformMapper(Random random)
focal_class.class_method_signature: SHA256UniformMapper.map(K key, V val)
focal_class.full_signature: @Override public double map(K key, V val)
focal_class.identifier: map
focal_class.modifiers: @Override public
focal_class.parameters: (K key, V val)
focal_class.return: double
focal_class.signature: double map(K key, V val)
focal_class.class_method_signature: SHA256UniformMapper.getDigest()
focal_class.full_signature: private MessageDigest getDigest()
focal_class.identifier: getDigest
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: MessageDigest
focal_class.signature: MessageDigest getDigest()
focal_method.body: @Override public double map(K key, V val) {
          int h = Math.abs(key.hashCode());
          String str = String.valueOf(key.hashCode());
  
          byte[] hash = getDigest().digest(str.getBytes(StandardCharsets.UTF_8));
  
          byte hashByte = hash[h % hash.length];
  
          byte resByte = 0;
  
          for (int i = 0; i < 8; i++)
              resByte = (byte)(resByte << 1 | ((hashByte >> shuffleStgy.get(i)) & 0x1));
  
          return 1.0 * (resByte & 0xFF) / 256;
      }
focal_method.class_method_signature: SHA256UniformMapper.map(K key, V val)
focal_method.full_signature: @Override public double map(K key, V val)
focal_method.identifier: map
focal_method.invocations: abs hashCode valueOf hashCode digest getDigest getBytes get
focal_method.modifiers: @Override public
focal_method.parameters: (K key, V val)
focal_method.return: double
focal_method.signature: double map(K key, V val)