Thread

  1. Re: [PATCH] Generate random dates/times in a specified range

    Greg Sabino Mullane <htamfids@gmail.com> — 2025-07-15T14:59:38Z

    On Mon, Jul 14, 2025 at 3:21 AM Dean Rasheed <dean.a.rasheed@gmail.com>
    wrote:
    
    > But it's completely trivial to emulate random(min_date, max_date), just by
    > doing
    >
    >   min_date + random(0, max_date - min_date)
    >
    > Is it really worth adding a core function for that?
    >
    
    Yes, I think it is. It is also trivial to get a random int from 50 to 100
    with
    
    50 + floor(random() * 51)
    
    but random(50,100) is so much nicer.
    
    Cheers,
    Greg
    
    --
    Crunchy Data - https://www.crunchydata.com
    Enterprise Postgres Software Products & Tech Support