24double random_double ();
26template <
class T,
class U>
27void random_value (T& value, U scale)
29 value = (random_double() - 0.5) * 2.0 * scale;
32template <
class T,
class U>
33void random_value (std::complex<T>& value, U scale)
37 random_value (real, scale);
38 random_value (imag, scale);
40 value = std::complex<T> (real, imag);
43template <
class T,
class U>
44void random_vector (T& array, U scale)
46 for (
unsigned i=0; i<array.size(); i++)
47 random_value (array[i], scale);
50template <
class T,
class U>
51void random_matrix (T& array, U scale)
53 for (
unsigned i=0; i<array.size(); i++)
54 random_vector (array[i], scale);