<commit_before>#pragma once

#include <algorithm>

namespace tensor
{
        ///
        /// \brief set the elements of the given tensor to random values.
        ///
        template
        <
                typename ttensor,
                typename trandom
        >
        void set_random(ttensor&& tensor, trandom rgen)
        {
                rgen(tensor.data(), tensor.data() + tensor.size());
        }

        ///
        /// \brief add random values to the elements of the given tensor.
        ///
        template
        <
                typename ttensor,
                typename trandom
        >
        void add_random(ttensor&& tensor, trandom rgen)
        {
                std::for_each(tensor.data(), tensor.data() + tensor.size(), [&] (auto& v) { v += rgen(); });<commit_msg>fix tensor randomizing<commit_after>#pragma once

#include <algorithm>

namespace tensor
{
        ///
        /// \brief set the elements of the given tensor to random values.
        ///
        template
        <
                typename ttensor,
                typename trandom
        >
        void set_random(ttensor&& tensor, trandom&& rgen)
        {
                std::for_each(tensor.data(), tensor.data() + tensor.size(), [&] (auto& v) { v = rgen(); });
        }

        ///
        /// \brief add random values to the elements of the given tensor.
        ///
        template
        <
                typename ttensor,
                typename trandom
        >
        void add_random(ttensor&& tensor, trandom&& rgen)
        {
                std::for_each(tensor.data(), tensor.data() + tensor.size(), [&] (auto& v) { v += rgen(); });
{'fraction_non_alphanumeric': 0.1232711966325917, 'fraction_numerical': 0.0, 'mean_word_length': 1.4081041968162085, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3475879', 'n_tokens_mistral': 456, 'n_tokens_neox': 433, 'n_words': 122}