这段代码每次都会给出一个随机输出,但由于某种原因,输出非常相似:这是代码:
using System;
using System.Collections.Generic;
namespace dimensionrandomwalk
{
class MainClass
{
public static void Main (string[] args){
for(int p = 0; p<100; p++){
{
Random rnd = new Random();
int[] x;
x = new int[500];
for (int i = 0; i < 500; i++){
int L = rnd.Next (0, 2);
x[i] = (L==0) ? -1 : 1;
}
int total_value = 0;
for (int i = 0; i < 500; i++)
total_value += x[i];
Console.WriteLine ("Total: " + total_value);
}
}
}
}
}
这是输出: http: //gyazo.com/a0f11edd17eff6dde8523ac4dbf19629.png
请帮忙。