using System;
using System.Diagnostics;
public class Test
{
static Random random = new Random();
public static Double Random() {
return random.NextDouble();
}
public static Double Random2() {
return -1;
}
public static void Main()
{
{
Stopwatch s = new Stopwatch();
Double a = 0;
s.Start();
for (Int32 i = 0; i < 5000000; i++)
a += Random();
s.Stop();
Console.WriteLine(s.ElapsedMilliseconds);
}
{
Stopwatch s = new Stopwatch();
Double a = 0;
s.Start();
for (Int32 i = 0; i < 5000000; i++)
a += Random2();
s.Stop();
Console.WriteLine(s.ElapsedMilliseconds);
}
{
Stopwatch s = new Stopwatch();
Double a = 0;
s.Start();
for (Int32 i = 0; i < 5000000; i++)
a += random.NextDouble();
s.Stop();
Console.WriteLine(s.ElapsedMilliseconds);
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uRGlhZ25vc3RpY3M7CgpwdWJsaWMgY2xhc3MgVGVzdAp7CglzdGF0aWMgUmFuZG9tIHJhbmRvbSA9IG5ldyBSYW5kb20oKTsKCglwdWJsaWMgc3RhdGljIERvdWJsZSBSYW5kb20oKSB7CiAgICAgICAgICAgIHJldHVybiByYW5kb20uTmV4dERvdWJsZSgpOwogICAgICAgIH0KCiAgICAgICAgcHVibGljIHN0YXRpYyBEb3VibGUgUmFuZG9tMigpIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIH0KCglwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpCgl7CgkgICAgewogICAgICAgICAgICAgICAgU3RvcHdhdGNoIHMgPSBuZXcgU3RvcHdhdGNoKCk7CiAgICAgICAgICAgICAgICBEb3VibGUgYSA9IDA7CiAgICAgICAgICAgICAgICBzLlN0YXJ0KCk7CiAgICAgICAgICAgICAgICBmb3IgKEludDMyIGkgPSAwOyBpIDwgNTAwMDAwMDsgaSsrKQogICAgICAgICAgICAgICAgICAgIGEgKz0gUmFuZG9tKCk7CiAgICAgICAgICAgICAgICBzLlN0b3AoKTsKICAgICAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKHMuRWxhcHNlZE1pbGxpc2Vjb25kcyk7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIFN0b3B3YXRjaCBzID0gbmV3IFN0b3B3YXRjaCgpOwogICAgICAgICAgICAgICAgRG91YmxlIGEgPSAwOwogICAgICAgICAgICAgICAgcy5TdGFydCgpOwogICAgICAgICAgICAgICAgZm9yIChJbnQzMiBpID0gMDsgaSA8IDUwMDAwMDA7IGkrKykKICAgICAgICAgICAgICAgICAgICBhICs9IFJhbmRvbTIoKTsKICAgICAgICAgICAgICAgIHMuU3RvcCgpOwogICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUocy5FbGFwc2VkTWlsbGlzZWNvbmRzKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgU3RvcHdhdGNoIHMgPSBuZXcgU3RvcHdhdGNoKCk7CiAgICAgICAgICAgICAgICBEb3VibGUgYSA9IDA7CiAgICAgICAgICAgICAgICBzLlN0YXJ0KCk7CiAgICAgICAgICAgICAgICBmb3IgKEludDMyIGkgPSAwOyBpIDwgNTAwMDAwMDsgaSsrKQogICAgICAgICAgICAgICAgICAgIGEgKz0gcmFuZG9tLk5leHREb3VibGUoKTsKICAgICAgICAgICAgICAgIHMuU3RvcCgpOwogICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUocy5FbGFwc2VkTWlsbGlzZWNvbmRzKTsKICAgICAgICAgICAgfQoJfQp9