/*[deutsch]
Liefert ein Zufallsdatum innerhalb dieses Intervalls. </p>

@return  random date within this interval
@throws  IllegalStateException if this interval is infinite or empty or if there is no canonical form
@see     #toCanonical()
@since   5.0
350227
public PlainDate random() {

        DateInterval interval = this.toCanonical();

        if (interval.isFinite() && !interval.isEmpty()) {
            long randomNum =
                ThreadLocalRandom.current().nextLong(
                    interval.getStartAsCalendarDate().getDaysSinceEpochUTC(),
                    interval.getEndAsCalendarDate().getDaysSinceEpochUTC() + 1);
            return PlainDate.of(randomNum, EpochDays.UTC);
        } else {
            throw new IllegalStateException("Cannot get random date in an empty or infinite interval: " + this);
        }

    }
42134
public RandomVariableInterface sin() {
		if(isDeterministic()) {
			double newValueIfNonStochastic = FastMath.sin(valueIfNonStochastic);
			return new RandomVariableLowMemory(time, newValueIfNonStochastic);
		}
		else {
			double[] newRealizations = new double[realizations.length];
			for(int i=0; i<newRealizations.length; i++) {
				newRealizations[i]		 = FastMath.sin(realizations[i]);
			}
			return new RandomVariableLowMemory(time, newRealizations);
		}
	}
1143035
public Date toDate() {
    long secondsInMilliseconds = TimeUnit.SECONDS.toMillis(this.seconds);
    long nanosInMilliseconds = TimeUnit.NANOSECONDS.toMillis(this.nanos);
    return new Date(secondsInMilliseconds + nanosInMilliseconds);
  }
1283088
public String generateSecureRandomId() {
        try {
            val random = new HexRandomStringGenerator(RANDOM_ID_SIZE);
            val hex = random.getNewString();
            if (StringUtils.isBlank(hex)) {
                throw new IllegalArgumentException("Could not generate a secure random id based on " + random.getAlgorithm());
            }
            return '_' + hex;
        } catch (final Exception e) {
            throw new IllegalStateException("Cannot create secure random ID generator for SAML message IDs.", e);
        }
    }
683468
def random(self):
        
        utc_now = datetime.datetime.utcnow()
        return self.valueFromString(utc_now.strftime(self.defaultFormat()))
1265007
public Date getDateBetween(final Date minDate, final Date maxDate) {
    // this can break if seconds is an int
    long seconds = (maxDate.getTime() - minDate.getTime()) / 1000;
    seconds = (long) (random.nextDouble() * seconds);
    Date result = new Date();
    result.setTime(minDate.getTime() + (seconds * 1000));
    return result;
  }
1216784
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
    @JsonProperty("enrolled_at")
    public Date getEnrolledAt() {
        return enrolledAt;
    }
875808
public static MonthDay randomMonthDay(boolean includeLeapDay) {
    Month month = randomMonth();
    int dayOfMonth = RandomUtils.nextInt(1, month.maxLength() + 1);
    MonthDay monthDay = MonthDay.of(month, dayOfMonth);
    if (!includeLeapDay && DateUtils.isLeapDay(monthDay)) {
      return randomMonthDay(false);
    }
    return monthDay;
  }
547683
public static Date getDateWithPrevDays(int noOfDays) throws ParseException {
        Calendar currentDate = Calendar.getInstance();
        currentDate.add(Calendar.DATE, -noOfDays);
        SimpleDateFormat formatter = new SimpleDateFormat(DATE_yyyyMMddTHHmmssSSSZ);
        String dateNow = formatter.format(currentDate.getTime());
        return getDateFromString(dateNow);
    }
166044
def random_date():
    ''''''
    d = datetime.datetime.now().date()
    d = d - datetime.timedelta(random.randint(20,2001))
    return d
973066
public long getCreationTime() {
        if (!_iSess.isValid())
            throw new IllegalStateException();
        long value = 0;
        if (_iSess != null) {
            value = _iSess.getCreationTime();
        }
        return value;
    }
264433
public static String generateRandom() {
		long next = ATOMIC_COUNT.incrementAndGet();
		StringBuffer random = new StringBuffer();
		random.append(new Date().getTime()).append('-').append(next);
		return random.toString();
	}
766057
public static final Parser<Date> instance() { // NOPMD it's thread save!
    if (DateTimeLocalParser.instanceParser == null) {
      synchronized (DateTimeLocalParser.class) {
        if (DateTimeLocalParser.instanceParser == null) {
          DateTimeLocalParser.instanceParser = new DateTimeLocalParser("yyyy-MM-dd'T'HH:mm:ss");
        }
      }
    }
    return DateTimeLocalParser.instanceParser;
  }
283718
public static Random getRandom()
  {
    if (_isTest) {
      return _testRandom;
    }

    Random random = _freeRandomList.allocate();

    if (random == null) {
      random = new SecureRandom();
    }

    return random;
  }
265184
public CmsJspInstanceDateBean getLast() {

        if ((m_lastEvent == null) && (m_dates != null) && (!m_dates.isEmpty())) {
            m_lastEvent = new CmsJspInstanceDateBean((Date)m_dates.last().clone(), CmsJspDateSeriesBean.this);
        }
        return m_lastEvent;
    }
1023040
public static String createNonce() {
        val fmtDate = ZonedDateTime.now(ZoneOffset.UTC).toString();
        val rand = RandomUtils.getNativeInstance();
        val randomInt = rand.nextInt();
        return DigestUtils.md5Hex(fmtDate + randomInt);
    }
1124823
@Override
    public double rand() {
        double out, x, y, r, z;

        if (boxMuller != null) {
            out = boxMuller.doubleValue();
            boxMuller = null;

        } else {
            do {
                x = Math.random(-1, 1);
                y = Math.random(-1, 1);
                r = x * x + y * y;
            } while (r >= 1.0);

            z = Math.sqrt(-2.0 * Math.log(r) / r);
            boxMuller = new Double(x * z);
            out = y * z;
        }

        return mu + sigma * out;
    }