<commit_before>// This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0
#include "evaluator.hh"
#include "sinfex.hh"
#include "config/config.h"

#include <stdlib.h>

namespace Rapicorn {

typedef Evaluator::VariableMapList VariableMapList;

static Sinfex::Value
variable_map_list_lookup (const VariableMapList &env_maps,
                          const String          &var,
                          bool                  &unknown)
{
  String key = Evaluator::canonify_key (var);
  for (VariableMapList::const_iterator it = env_maps.begin(); it != env_maps.end(); it++)
    {
      Evaluator::VariableMap::const_iterator cit = (*it)->find (key);
      if (cit != (*it)->end())
        return Sinfex::Value (cit->second);
    }
  if (key == "RAPICORN_VERSION")
    return Sinfex::Value (RAPICORN_VERSION);
  else if (key == "RAPICORN_ARCHITECTURE")
    return Sinfex::Value (cpu_arch());
  else if (key == "RANDOM")
    return Sinfex::Value (lrand48());
  else
    {
      unknown = true;
      return Sinfex::Value ("");
    }
}
<commit_msg>UI: replace lrand48 with random_int64()<commit_after>// This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0
#include "evaluator.hh"
#include "sinfex.hh"
#include "config/config.h"

#include <stdlib.h>

namespace Rapicorn {

typedef Evaluator::VariableMapList VariableMapList;

static Sinfex::Value
variable_map_list_lookup (const VariableMapList &env_maps,
                          const String          &var,
                          bool                  &unknown)
{
  String key = Evaluator::canonify_key (var);
  for (VariableMapList::const_iterator it = env_maps.begin(); it != env_maps.end(); it++)
    {
      Evaluator::VariableMap::const_iterator cit = (*it)->find (key);
      if (cit != (*it)->end())
        return Sinfex::Value (cit->second);
    }
  if (key == "RAPICORN_VERSION")
    return Sinfex::Value (RAPICORN_VERSION);
  else if (key == "RAPICORN_ARCHITECTURE")
    return Sinfex::Value (cpu_arch());
  else if (key == "RANDOM")
    return Sinfex::Value (random_int64());
  else
    {
      unknown = true;
      return Sinfex::Value ("");
    }
}

{'fraction_non_alphanumeric': 0.14205868653935724, 'fraction_numerical': 0.007452258965999069, 'mean_word_length': 2.9412844036697248, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5063245', 'n_tokens_mistral': 733, 'n_tokens_neox': 708, 'n_words': 162}