27 lines
440 B
D
27 lines
440 B
D
import std.random;
|
|
import std.stdio;
|
|
|
|
void main()
|
|
{
|
|
// От 1 до 127 элементов
|
|
auto array = new double[uniform(1, 128)];
|
|
|
|
foreach (i; 0 .. array.length)
|
|
{
|
|
array[i] = uniform(0.0, 1.0);
|
|
}
|
|
|
|
writeln(array);
|
|
|
|
foreach (ref element; array)
|
|
{
|
|
element = uniform(0.0, 1.0);
|
|
}
|
|
|
|
writeln(array);
|
|
|
|
auto copy = array.dup;
|
|
assert(array !is copy);
|
|
assert(array == copy);
|
|
}
|