回答編集履歴
2
Markdownを使って直した
test
CHANGED
@@ -1,5 +1,35 @@
|
|
1
|
-
|
1
|
+
こんな風に書くかな
|
2
|
+
|
3
|
+
```C#
|
2
4
|
|
3
5
|
Random random = new Random();
|
4
6
|
|
5
7
|
double value = random.NextDouble() * (maximum - minimum) + minimum;
|
8
|
+
|
9
|
+
```
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
関数化するなら
|
14
|
+
|
15
|
+
```C#
|
16
|
+
|
17
|
+
public static class RandomExtensions {
|
18
|
+
|
19
|
+
public static double NextDouble(this Random random, double minimum, double maximum) {
|
20
|
+
|
21
|
+
return random.NextDouble() * (maximum - minimum) + minimum;
|
22
|
+
|
23
|
+
}
|
24
|
+
|
25
|
+
}
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
Random random = new Random();
|
30
|
+
|
31
|
+
double value = random.NextDouble(minimum, maximum);
|
32
|
+
|
33
|
+
```
|
34
|
+
|
35
|
+
でどうかな。
|
1
誤記
test
CHANGED
@@ -1 +1,5 @@
|
|
1
|
+
// こんな風に書くかな
|
2
|
+
|
3
|
+
Random random = new Random();
|
4
|
+
|
1
|
-
|
5
|
+
double value = random.NextDouble() * (maximum - minimum) + minimum;
|