强化装备 垫子玄学

来源:互联网 发布:美工修图多少钱一张 编辑:程序博客网 时间:2024/06/10 04:07

 垫子问题

    如果游戏强化机制用的是random()函数,那么多半没有给定种子,以无参构造函数使用。

    而无参形式便与当前时间有关,也就有网友说的是  某强化时间段 成功率高的原因。

    但系统随机都是伪随机。

      例如给定种子(带参数的):

        Random random = new Random(50);
        System.out.println(random.nextInt(100));
        System.out.println(random.nextInt(100));
        Random random1 = new Random(50);
        System.out.println(random1.nextInt(100));
        System.out.println(random1.nextInt(100));

     输出:

               17 
               88 
               17 
               88

   而不给定种子的无参构造函数与当前时间有关。

  其源码:

 public Random() {

   this(seedUniquifier() ^ System.nanoTime());
    }

 System.nanoTime() 可以看出这个就是与系统时间相关的,继续百度。

 public static long nanoTime():

           Returns the current value of the most precise available system timer, in nanoseconds.
           This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time.The value returned represents nanoseconds since some fixed but arbitrary time (perhaps in the future, so values may be negative). This method provides nanosecond precision, but not necessarily nanosecond accuracy. No guarantees are made about how frequently values change. Differences in successive calls that span greater than approximately 292 years (263 nanoseconds) will not accurately compute elapsed time due to numerical overflow.

   Returns:The current value of the system timer, in nanoseconds.
   Since:1.5

   上面说返回当前的系统时间,以毫微秒的方式。

   但中间有段英语,说以何时开始计算起始点并不确定。。。也就是说,初始值不确定。

   于是这个函数一般用于计算中间的时间段。。。

   可是,初始值为什么不确定,可以继续研究。。。

 -----------------------------------------------

11.11日 看主播"撸了22年的右手"强化装备,各种失败。。。再次觉得冒险岛2强化装备 垫子没啥卵用。