Creates the random date.

@param from
the from
@return the date
193835
public static Date newRandomDate(final Date from)
	{
		final Random secrand = new SecureRandom();
		final double randDouble = -secrand.nextDouble() * from.getTime();
		final double randomDouble = from.getTime() - secrand.nextDouble();
		final double result = randDouble * randomDouble;
		return new Date((long)result);
	}
1560
public NRShape makeShape(Date from, Date to) {
        UnitNRShape fromShape = tree.toUnitShape(from);
        UnitNRShape toShape = tree.toUnitShape(to);
        return tree.toRangeShape(fromShape, toShape);
    }
178424
private static byte[] copy(byte[] from) {
    if (from != null) {
      byte[] to = new byte[from.length];
      System.arraycopy(from, 0, to, 0, to.length);
      return to;
    }
    return null;
  }
20884
def randomdate(year: int) -> datetime.date:
    
    if calendar.isleap(year):
        doy = random.randrange(366)
    else:
        doy = random.randrange(365)

    return datetime.date(year, 1, 1) + datetime.timedelta(days=doy)
255676
public void setCreatedDate(Date createdDate) {
        _createdDate = createdDate == null ? null : new Date(createdDate.getTime());
    }
1165808
public Constraint createModel(final MathRandom random, final Element element) {
		if (element == null) {
			return null;
		}
		Class<? extends Constraint> classObject = null;
		Constraint object = null;
		try {
			classObject = getClassObject(element);
			Constructor<? extends Constraint> constructor = getConstructor(classObject);
			object = getObject(random, element, constructor);
		} catch (InvocationTargetException ex) {
			throw new JFunkException("Could not initialise object of class " + classObject, ex.getCause());
		} catch (Exception ex) {
			throw new JFunkException("Could not initialise object of class " + classObject, ex);
		}
		putToCache(element, object);
		return object;
	}
861919
public void setFrom(final String from) {
    if (null == from) {
      this.from = null;
    } else {
      if (Strings.contains(from.toLowerCase(), "from")) {
        this.from = from;
      } else {
        this.from = " from " + from;
      }
    }
  }
166044
def random_date():
    ''''''
    d = datetime.datetime.now().date()
    d = d - datetime.timedelta(random.randint(20,2001))
    return d
311874
private SecureRandom createSecureRandom()
    {

        SecureRandom result = null;

        long t1 = System.currentTimeMillis();
        if (secureRandomClass != null)
        {
            try
            {
                // Construct and seed a new random number generator
                Class<?> clazz = Class.forName(secureRandomClass);
                result = (SecureRandom) clazz.newInstance();
            }
            catch (Exception e)
            {
                log.log(Level.SEVERE, "Exception initializing random number generator of class "+ 
                        secureRandomClass + ". Falling back to java.secure.SecureRandom", e);
            }
        }

        if (result == null)
        {
            // No secureRandomClass or creation failed. Use SecureRandom.
            try
            {
                if (secureRandomProvider != null
                        && secureRandomProvider.length() > 0)
                {
                    result = SecureRandom.getInstance(secureRandomAlgorithm,
                            secureRandomProvider);
                }
                else
                {
                    if (secureRandomAlgorithm != null
                            && secureRandomAlgorithm.length() > 0)
                    {
                        result = SecureRandom.getInstance(secureRandomAlgorithm);
                    }
                }
            }
            catch (NoSuchAlgorithmException e)
            {
                log.log(Level.SEVERE, "Exception initializing random number generator using algorithm: "+
                        secureRandomAlgorithm, e);
            }
            catch (NoSuchProviderException e)
            {
                log.log(Level.SEVERE, "Exception initializing random number generator using provider: " + 
                        secureRandomProvider, e);
            }
        }

        if (result == null)
        {
            // Invalid provider / algorithm
            try
            {
                result = SecureRandom.getInstance("SHA1PRNG");
            }
            catch (NoSuchAlgorithmException e)
            {
                log.log(Level.SEVERE, "Invalid provider / algoritm SHA1PRNG for generate secure random token", e);
            }
        }

        if (result == null)
        {
            // Nothing works - use platform default
            result = new SecureRandom();
        }

        // Force seeding to take place
        result.nextInt();

        long t2 = System.currentTimeMillis();
        if ((t2 - t1) > 100)
        {
            if (log.isLoggable(Level.FINEST))
            {
                log.info("Creation of SecureRandom instance for session ID generation using ["
                        +result.getAlgorithm()+"] took ["+Long.valueOf(t2 - t1)+"] milliseconds.");
            }
        }
        return result;
    }
348475
public static Interval fromTo(int from, int to)
    {
        if (from <= to)
        {
            return Interval.fromToBy(from, to, 1);
        }
        return Interval.fromToBy(from, to, -1);
    }
539021
@NonNull
    @Override
    public From from(@NonNull DataSource dataSource) {
        if (dataSource == null) {
            throw new IllegalArgumentException("dataSource cannot be null.");
        }
        return new From(this, dataSource);
    }
843003
public static LocalDate from(Calendar cal) {
        int year = cal.get(Calendar.YEAR);
        int month = cal.get(Calendar.MONTH)+1;
        int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
        return new LocalDate(year, month, dayOfMonth);
    }
87293
public static long random(long min, long max) {
        return Math.round(ThreadLocalRandom.current().nextDouble()
                * (max - min) + min);
    }
38039
static double fromDate(Date dt) {

        // the number of milliseconds since January 1, 1970, 00:00:00 GMT
        long t = dt.getTime();

        // the number of milliseconds since January 1, 1970, 00:00:00 Local Time
        Calendar c = new GregorianCalendar();
        c.setTime(dt);
        t += (c.get(Calendar.ZONE_OFFSET) + c.get(Calendar.DST_OFFSET)) ;

        // the number of milliseconds since December 30, 1899, 00:00:00 Local Time
        t += 2209161600000L;

        // DATE is an offset from "30 December 1899"
        if (t < 0) {
            // -0.3 -> -0.7
            long offset = -(t % MSPD);    // TODO: check
            t = t - MSPD + offset;
        }
        double d = ((double) t) / MSPD;
        return d;
    }
902775
@Override
    public E getRandomValue() {
        int randomIndex = random.nextInt(enumConstants.size());
        return enumConstants.get(randomIndex);
    }
559451
public Date getFrom() {
        final TimeInterval first = intervals.first();
        if (first != null) {
            return new Date(first.getFrom());
        }
        return null;
    }
1285857
public static Date copy(final Date d) {
        if (d == null) {
            return null;
        } else {
            return new Date(d.getTime());
        }
    }