PrevUpHomeNext

utx::random


utx::random

utx::random is a function object of a class used to generate random values to a range.

utx::random: Random Algorithm

utx::random calling sig

utx::random(begin, end);
utx::random(begin, end, border);
utx::random(begin, end, min, max);	// Don't worry if min > max, it will swap it internnally.
utx::random(range);
utx::random(range, border);
utx::random(range, min, max);	// Don't worry if min > max, it will swap it internnally.

Random Negative Value Support: YES

Notice

utx::random_class::border_type_default : utx::i16

utx::random_class::border_value_default : 1000

Header

#include <utxcpp/random.hpp>

utx::random is an algorithm to random generate values to a range, so it is part of utxcpp/algorithm.hpp.

c++ example

#include <utxcpp/core.hpp>
#include <utxcpp/random.hpp>
#include <vector>

int main()
{
	std::vector<utx::i32> v1(12);
	utx::random(v1);
	utx::print(v1);
	
	std::vector<utx::ix32> v2(12);
	utx::random(v2);
	utx::print(v2);

	std::vector<utx::f32> v3(12);
	utx::random(v3, -100, 50);
	utx::print(v3);
	
	std::vector<utx::fx32> v4(12);
	utx::random(v4, -100, 50);
	utx::print(v4);
}

See Also

utx::uniform_distribution

utx::print

utx::ix32

utx::fx32


PrevUpHomeNext

utx::print

esv::print