Integer MyValue;
MyValue = CInt(Int((20 * Rnd()) + 10))
若要生成某给定范围内的随机整数,可使用此公式:CInt(Int((upperbound - lowerbound + 1) * Rnd() + lowerbound))
这里,upperbound 是此范围的上限,而 lowerbound 是范围的下限。

解决方案 »

  1.   

    http://community.csdn.net/Expert/topic/2925/2925972.xml?temp=.6498377Console.Write("{0:E}", 250000);  -> 2.500000E+005 
    Console.Write("{0:F2}", 25);     -> 25.00
    假设变量名称为:d1
    Double.Parse(d1.ToString()).ToString("0.00")
      

  2.   

    RoundToHundredth 数字四舍五入为 2 个小数点位 
      

  3.   

    to boytomato(深爱一人叫颖的女孩!) :D:\工作夹\tuopan\Form1.cs(143): 找不到类型或命名空间名称“Integer”(是否缺少 using 指令或程序集引用?)
      

  4.   

    Int  MyValue;
    MyValue = CInt(Int((20 * Rnd()) + 10))
      

  5.   

    Random rand = new Random();
    int myValue = rand.Next(10,20);
      

  6.   

    boytomato(深爱一人叫颖的女孩!)
    Int  MyValue;
    MyValue = CInt(Int((20 * Rnd()) + 10))
    是VB.NET的语法吧.呵榀.同意
    yanwl(月之影) 
    Random rand = new Random();
    int myValue = rand.Next(10,20);
      

  7.   

    Random Rnd;
    Rnd = New Random();
    int MyValue = Rnd.Next(10,20);
      

  8.   

    Random r;
    r = New Random();
    int i = r.Next(10) + 10;
      

  9.   

    不好意思,上边是个vb 下的。以为c#下有。。
    楼上都对。。