<commit_before>From 406e1900f38e6ca43e74c98a5de0c1ec0f3e3213 Mon Sep 17 00:00:00 2001
From: <NAME> <<EMAIL>>
Date: Tue, 16 Jan 2018 15:04:09 +0100
Subject: [PATCH] patch utilities functions

---
 src/boards/mcu/stm32/utilities.c | 48 +++++++++++-----------------------------
 1 file changed, 13 insertions(+), 35 deletions(-)

diff --git a/src/boards/mcu/stm32/utilities.c b/src/boards/mcu/stm32/utilities.c
index 8861235..583cae1 100644
--- a/src/boards/mcu/stm32/utilities.c
+++ b/src/boards/mcu/stm32/utilities.c
@@ -14,8 +14,10 @@ Maintainer: <NAME> and <NAME>
 */
 #include <stdlib.h>
 #include <stdio.h>
-#include "board.h"
+#include <string.h>
 #include "utilities.h"
+#include "semtech-loramac/board.h"
+#include "random.h"
 
 /*!
  * Redefinition of rand() and srand() standard C functions.
@@ -34,52 +36,28 @@ int32_t rand1( void )
 
 void srand1( uint32_t seed )
 {
-    next = seed;
-}
-// Standard random functions redefinition end
+    (void) seed;
+};
 
 int32_t randr( int32_t min, int32_t max )
 {
-    return ( int32_t )rand1( ) % ( max - min + 1 ) + min;
-}
+    return random_uint32_range(min, max + 1);
+};
 
 void memcpy1( uint8_t *dst, const uint8_t *src, uint16_t size )
 {
-    while( size-- )
-    {
-        *dst++ = *src++;
-    }
-}
+    memcpy(dst, src, size);
+};
 
 void memcpyr( uint8_t *dst, const uint8_t *src, uint16_t size )
 {
-    dst = dst + ( size - 1 );
-    while( size-- )
-    {
+    dst = dst + (size - 1);
+    while (size--) {
         *dst-- = *src++;
     }
 }
 
 void memset1( uint8_t *dst, uint8_t value, uint16_t size )
 {
-    while( size-- )
-    {
-        *dst++ = value;
-    }
-}
-
-int8_t Nibble2HexChar( uint8_t a )
-{
-    if( a < 10 )
-    {
-        return '0' + a;
-    }
-    else if( a < 16 )
-    {
-        return 'A' + ( a - 10 );
-    }
-    else
-    {
-        return '?';
-    }
-}
+    memset(dst, value, size);
+}
\ No newline at end of file
-- 
2.14.1
<commit_msg>pkg/semtech-loramac: use random_uin32() to generate random integer<commit_after>From 1143af922083090a08761ab1a871c7922962218f Mon Sep 17 00:00:00 2001
From: <NAME> <<EMAIL>>
Date: Tue, 16 Jan 2018 15:04:09 +0100
Subject: [PATCH] patch utilities functions

---
 src/boards/mcu/stm32/utilities.c | 46 +++++++++-----------------------
 1 file changed, 12 insertions(+), 34 deletions(-)

diff --git a/src/boards/mcu/stm32/utilities.c b/src/boards/mcu/stm32/utilities.c
index 8861235..e339ba5 100644
--- a/src/boards/mcu/stm32/utilities.c
+++ b/src/boards/mcu/stm32/utilities.c
@@ -14,8 +14,10 @@ Maintainer: <NAME> and <NAME>
 */
 #include <stdlib.h>
 #include <stdio.h>
-#include "board.h"
+#include <string.h>
 #include "utilities.h"
+#include "semtech-loramac/board.h"
+#include "random.h"
 
 /*!
  * Redefinition of rand() and srand() standard C functions.
@@ -34,52 +36,28 @@ int32_t rand1( void )
 
 void srand1( uint32_t seed )
 {
-    next = seed;
-}
-// Standard random functions redefinition end
+    (void) seed;
+};
 
 int32_t randr( int32_t min, int32_t max )
 {
-    return ( int32_t )rand1( ) % ( max - min + 1 ) + min;
-}
+    return (int32_t)random_uint32() % (max - min + 1) + min;
+};
 
 void memcpy1( uint8_t *dst, const uint8_t *src, uint16_t size )
 {
-    while( size-- )
-    {
-        *dst++ = *src++;
-    }
-}
+    memcpy(dst, src, size);
+};
 
 void memcpyr( uint8_t *dst, const uint8_t *src, uint16_t size )
 {
-    dst = dst + ( size - 1 );
-    while( size-- )
-    {
+    dst = dst + (size - 1);
+    while (size--) {
         *dst-- = *src++;
     }
 }
 
 void memset1( uint8_t *dst, uint8_t value, uint16_t size )
 {
-    while( size-- )
-    {
-        *dst++ = value;
-    }
-}
-
-int8_t Nibble2HexChar( uint8_t a )
-{
-    if( a < 10 )
-    {
-        return '0' + a;
-    }
-    else if( a < 16 )
-    {
-        return 'A' + ( a - 10 );
-    }
-    else
-    {
-        return '?';
-    }
+    memset(dst, value, size);
 }
-- 
2.17.1

{'fraction_non_alphanumeric': 0.197647660444899, 'fraction_numerical': 0.08003068268984914, 'mean_word_length': 2.249169435215947, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5324987', 'n_tokens_mistral': 1840, 'n_tokens_neox': 1615, 'n_words': 370}