<commit_before>/**
 * Copyright (C) 2017 <NAME> <<EMAIL>>
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License v2.1. See the file LICENSE in the top level
 * directory for more details.
 */

 /**
 * @ingroup     sys_random
 * @{
 * @file
 *
 * @brief       PRNG seeding
 *
 * @author      <NAME> <<EMAIL>>
 * @}
 */

#include <stdint.h>

#include "log.h"
#include "luid.h"
#include "periph/cpuid.h"
#include "random.h"
#ifdef MODULE_PUF_SRAM
#include "puf_sram.h"
#endif

#define ENABLE_DEBUG (0)
#include "debug.h"

void auto_init_random(void)
{
    uint32_t seed;
#ifdef MODULE_PUF_SRAM
    /* TODO: hand state to application? */
    if (puf_sram_state) {
        LOG_WARNING("random: PUF SEED not fresh\n");
    }
    seed = puf_sram_seed;
#elif defined (MODULE_PERIPH_CPUID)
    luid_get(&seed, 4);
#else
    LOG_WARNING("random: NO SEED AVAILABLE!\n");
    seed = RANDOM_SEED_DEFAULT;
#endif
    DEBUG("random: using seed value %u\n", (unsigned)seed);
    random_init(seed);
}<commit_msg>sys/random: add guard for periph/cpuid include<commit_after>/**
 * Copyright (C) 2017 <NAME> <<EMAIL>>
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License v2.1. See the file LICENSE in the top level
 * directory for more details.
 */

 /**
 * @ingroup     sys_random
 * @{
 * @file
 *
 * @brief       PRNG seeding
 *
 * @author      <NAME> <<EMAIL>>
 * @}
 */

#include <stdint.h>

#include "log.h"
#include "luid.h"
#include "random.h"
#ifdef MODULE_PUF_SRAM
#include "puf_sram.h"
#endif
#ifdef MODULE_PERIPH_CPUID
#include "periph/cpuid.h"
#endif

#define ENABLE_DEBUG (0)
#include "debug.h"

void auto_init_random(void)
{
    uint32_t seed;
#ifdef MODULE_PUF_SRAM
    /* TODO: hand state to application? */
    if (puf_sram_state) {
        LOG_WARNING("random: PUF SEED not fresh\n");
    }
    seed = puf_sram_seed;
#elif defined (MODULE_PERIPH_CPUID)
    luid_get(&seed, 4);
#else
    LOG_WARNING("random: NO SEED AVAILABLE!\n");
    seed = RANDOM_SEED_DEFAULT;
#endif
    DEBUG("random: using seed value %u\n", (unsigned)seed);
    random_init(seed);
}
{'fraction_non_alphanumeric': 0.1365967365967366, 'fraction_numerical': 0.009324009324009324, 'mean_word_length': 3.49895178197065, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '6917738', 'n_tokens_mistral': 815, 'n_tokens_neox': 804, 'n_words': 216}