1#ifndef TATAMI_TEST_SIMULATE_VECTOR_HPP
2#define TATAMI_TEST_SIMULATE_VECTOR_HPP
8#include "sanisizer/sanisizer.hpp"
55template<
typename Type_,
typename Length_>
57 auto output = sanisizer::create<std::vector<Type_> >(length);
59 std::uniform_real_distribution<> unif(options.
lower, options.
upper);
62 for (
auto& v : output) {
66 std::uniform_real_distribution<> nonzero(0.0, 1.0);
67 for (
auto& v : output) {
68 if (nonzero(rng) <= options.
density) {
89template<
typename Type_,
typename Index_>
91 return simulate_vector<Type_>(sanisizer::product<
typename std::vector<Type_>::size_type>(nrow, ncol), options);
Utilities for testing tatami libraries.
Definition create_indexed_subset.hpp:16
std::vector< Type_ > simulate_vector(const Length_ length, const SimulateVectorOptions &options)
Definition simulate_vector.hpp:56
std::mt19937_64 RngEngine
Definition utils.hpp:34
RngEngine::result_type SeedType
Definition utils.hpp:39
Options for simulate_vector().
Definition simulate_vector.hpp:22
double upper
Definition simulate_vector.hpp:31
double density
Definition simulate_vector.hpp:36
double lower
Definition simulate_vector.hpp:26
SeedType seed
Definition simulate_vector.hpp:41