码迷,mamicode.com
首页 > 其他好文 > 详细

141120 Random

时间:2014-11-20 12:17:05      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:io   ar   os   java   for   on   as   size   new   

pseudorandom:伪随机
maintain:保持,维持,维护
/**
     * Creates a new random number generator using a single {@code long} seed.
     * The seed is the initial value of the internal state of the pseudorandom
     * number generator which is maintained by method {@link #next}.
     *
     * <p>The invocation {@code new Random(seed)} is equivalent to:
     *  <pre> {@code
     * Random rnd = new Random();
     * rnd.setSeed(seed);}</pre>
     *
     * @param seed the initial seed
     * @see   #setSeed(long)
     */
    public Random(long seed) {
        this.seed = new AtomicLong(0L);
        setSeed(seed);
    }



approximate:约莫的 大概的 接近于;近似于
uniformly:统一的
distribute:分布,分配
/**
     * Returns the next pseudorandom, uniformly distributed {@code int}
     * value from this random number generator‘s sequence. The general
     * contract of {@code nextInt} is that one {@code int} value is
     * pseudorandomly generated and returned. All 2<font size="-1"><sup>32
     * </sup></font> possible {@code int} values are produced with
     * (approximately) equal probability.
     *
     * <p>The method {@code nextInt} is implemented by class {@code Random}
     * as if by:
     *  <pre> {@code
     * public int nextInt() {
     *   return next(32);
     * }}</pre>
     *
     * @return the next pseudorandom, uniformly distributed {@code int}
     *         value from this random number generator‘s sequence
     */
    public int nextInt() {
	return next(32);
    }





141120 Random

标签:io   ar   os   java   for   on   as   size   new   

原文地址:http://my.oschina.net/wrean/blog/346651

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!