示例#1
0
        public Angle Arbitrary(IRandom gen, int size)
        {
            bool   positive = gen.Bool();
            double angle    = gen.Double(size, 0, Math.PI);

            return(new Angle(positive ? angle : -angle));
        }
        // NOTE: The types below do not use the same boilerplate as
        // NOTE: above when generating ranges.

        /// <summary>
        /// Generate a uniformly distributed <see cref="bool"/> in the
        /// range [x1, x2].
        /// </summary>
        public static bool Range(this IRandom random, bool x1, bool x2)
        {
            return(x1 == x2 ? x1 : random.Bool());
        }