Package java.security

Examples of java.security.SecureRandom.nextDouble()


            throw MathRuntimeException.createIllegalArgumentException(
                  "upper bound ({0}) must be greater than lower bound ({1})",
                  upper, lower);
        }
        SecureRandom sec = getSecRan();
        return lower + (int) (sec.nextDouble() * (upper - lower + 1));
    }

    /**
     * Generate a random long value uniformly distributed between
     * <code>lower</code> and <code>upper</code>, inclusive. This algorithm uses
View Full Code Here


            throw MathRuntimeException.createIllegalArgumentException(
                  "upper bound ({0}) must be greater than lower bound ({1})",
                  upper, lower);
        }
        SecureRandom sec = getSecRan();
        return lower + (long) (sec.nextDouble() * (upper - lower + 1));
    }

    /**
     * {@inheritDoc}
     * <p>
 
View Full Code Here

          if (lower >= upper) {
              throw new IllegalArgumentException
                ("lower bound must be < upper bound");
          }
          SecureRandom sec = getSecRan();
          return lower + (int) (sec.nextDouble() * (upper - lower + 1));
    }

    /**
     * Generate a random long value uniformly distributed between
     * <code>lower</code> and <code>upper</code>, inclusive.  This algorithm
View Full Code Here

        if (lower >= upper) {
            throw new IllegalArgumentException
            ("lower bound must be < upper bound");
        }
        SecureRandom sec = getSecRan();
        return lower + (long) (sec.nextDouble() * (upper - lower + 1));
    }

    /**
     * Generates a random long value from the Poisson distribution with the
     * given mean.
View Full Code Here

            final SecureRandom rand = new SecureRandom();

            @Override
            public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
                for (int i = 0; i < 100000; i++) {
                    cnt += rand.nextDouble();
                }

                request.response().end();
            }
        });
View Full Code Here

        int result = -1;
        try {
            long long_end = (long) end;
            long long_start = (long) start;
            SecureRandom secure_random = SecureRandom.getInstance("SHA1PRNG");
            double d_ran = secure_random.nextDouble();
            long long_base = (long) ((long_end - long_start + 1) * d_ran);
            result = (int) (start + long_base);
        } catch (Exception exc) {
            exc.printStackTrace();
        }
View Full Code Here

          if (lower >= upper) {
              throw new IllegalArgumentException
                ("lower bound must be < upper bound");
          }
          SecureRandom sec = getSecRan();
          return lower + (int) (sec.nextDouble() * (upper - lower + 1));
    }
    
    /**
     * Generate a random long value uniformly distributed between
     * <code>lower</code> and <code>upper</code>, inclusive.  This algorithm
View Full Code Here

        if (lower >= upper) {
            throw new IllegalArgumentException
            ("lower bound must be < upper bound");
        }
        SecureRandom sec = getSecRan();
        return lower + (long) (sec.nextDouble() * (upper - lower + 1));
    }
   
    /**
     * <strong>Algorithm Description</strong>:
     * Uses simulation of a Poisson process using Uniform deviates, as
View Full Code Here

            throw MathRuntimeException.createIllegalArgumentException(
                  "upper bound ({0}) must be greater than lower bound ({1})",
                  upper, lower);
        }
        SecureRandom sec = getSecRan();
        return lower + (int) (sec.nextDouble() * (upper - lower + 1));
    }

    /**
     * Generate a random long value uniformly distributed between
     * <code>lower</code> and <code>upper</code>, inclusive. This algorithm uses
View Full Code Here

            throw MathRuntimeException.createIllegalArgumentException(
                  "upper bound ({0}) must be greater than lower bound ({1})",
                  upper, lower);
        }
        SecureRandom sec = getSecRan();
        return lower + (long) (sec.nextDouble() * (upper - lower + 1));
    }

    /**
     * {@inheritDoc}
     * <p>
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.