Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

A right is not what someone gives you; it's what no one can take from you. -- Ramsey Clark


computers / comp.os.linux.advocacy / Ping Feeb: borked random number distributions

SubjectAuthor
* Ping Feeb: borked random number distributionsDFS
+- Re: Ping Feeb: borked random number distributionsDiego Garcia
+* Re: Ping Feeb: borked random number distributionsPhysfitfreak
|+- Re: Ping Feeb: borked random number distributionsPhysfitfreak
|`* Re: Ping Feeb: borked random number distributionsChris Ahlstrom
| +* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| |`* Re: Ping Feeb: borked random number distributionsChris Ahlstrom
| | `* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| |  `* Re: Ping Feeb: borked random number distributionsChris Ahlstrom
| |   +- Re: Ping Feeb: borked random number distributionsPhysfitfreak
| |   `* Re: Ping Feeb: borked random number distributionschrisv
| |    `- Re: Ping Feeb: borked random number distributionsFarley Flud
| `- Re: No output, we can't see any results.Chris Ahlstrom
+* Re: Random numbers in a range.DFS
|+- Re: You don't need "strftime()".Physfitfreak
|`* Re: You don't need "strftime()".vallor
| `* GNU Indent on Linux (was: Re: You don't need "strftime()".)vallor
|  `- Re: Excessive whitespace/comments is a big, red flag.vallor
+- Re: Random numbers in a range.DFS
+* Re: Ping Feeb: borked random number distributionsFarley Flud
|+* Re: Ping Feeb: borked random number distributionscandycanearter07
||+- Re: Ping Feeb: borked random number distributions%
||`- Re: No one is doing: "Rand%MaxRand" (modulo).candycanearter07
|+* Re: Ping Feeb: borked random number distributionsPhysfitfreak
||`* Re: Ping Feeb: borked random number distributionsFarley Flud
|| `* Re: Ping Feeb: borked random number distributionsPhysfitfreak
||  +- Re: Ping Feeb: borked random number distributionsFarley Flud
||  `* Re: Ping Feeb: borked random number distributionsStéphane CARPENTIER
||   `* Re: Ping Feeb: borked random number distributionsPhysfitfreak
||    `* Re: Ping Feeb: borked random number distributionsStéphane CARPENTIER
||     `* Re: Ping Feeb: borked random number distributionsPhysfitfreak
||      `* Re: Ping Feeb: borked random number distributionsStéphane CARPENTIER
||       `- Re: Ping Feeb: borked random number distributionsPhysfitfreak
|`* Re: Ping Feeb: borked random number distributionsDFS
| +* Re: Ping Feeb: borked random number distributionsLord Master
| |`* Re: Ping Feeb: borked random number distributionsDFS
| | +* Re: Ping Feeb: borked random number distributionsLord Master
| | |+* Re: Ping Feeb: borked random number distributionsDFS
| | ||+* Re: Ping Feeb: borked random number distributionsLord Master
| | |||`* Re: Ping Feeb: borked random number distributionsDFS
| | ||| +* Re: Ping Feeb: borked random number distributionsFarley Flud
| | ||| |`- Re: Ping Feeb: borked random number distributionsDFS
| | ||| `* Re: Ping Feeb: borked random number distributionsDFS
| | |||  `* Re: Ping Feeb: borked random number distributionsFarley Flud
| | |||   `* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |||    `* Re: Ping Feeb: borked random number distributionsRabidPedagog
| | |||     `* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |||      +* Re: Ping Feeb: borked random number distributionsFarley Flud
| | |||      |+- Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |||      |`* Re: Ping Feeb: borked random number distributionsDFS
| | |||      | +- Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |||      | +- Re: Ping Feeb: borked random number distributionsRabidPedagog
| | |||      | `* Re: Ping Feeb: borked random number distributionsFarley Flud
| | |||      |  +* Re: Ping Feeb: borked random number distributionsDFS
| | |||      |  |`- Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |||      |  `- Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |||      `* Re: Ping Feeb: borked random number distributionsRabidPedagog
| | |||       +* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |||       |`* Re: Ping Feeb: borked random number distributionsRabidPedagog
| | |||       | `- Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |||       `- Re: Ping Feeb: borked random number distributionsRonB
| | ||`* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | || `* Re: Ping Feeb: borked random number distributionsRonB
| | ||  `- Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |`* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | | `* Re: Ping Feeb: borked random number distributionsFarley Flud
| | |  +* Re: Ping Feeb: borked random number distributionsChris Ahlstrom
| | |  |+- Re: Ping Feeb: borked random number distributionsLord Master
| | |  |`* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |  | `* Re: Ping Feeb: borked random number distributionsChris Ahlstrom
| | |  |  `- Re: Ping Feeb: borked random number distributionsFarley Flud
| | |  +* Re: Ping Feeb: borked random number distributionscandycanearter07
| | |  |`- Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |  `* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |   `* Re: Ping Feeb: borked random number distributionscandycanearter07
| | |    `* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |     `* Re: Ping Feeb: borked random number distributionscandycanearter07
| | |      `* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |       `* Re: Ping Feeb: borked random number distributionscandycanearter07
| | |        +* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |        |+* Re: Ping Feeb: borked random number distributionsFarley Flud
| | |        ||+* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |        |||`* Re: Ping Feeb: borked random number distributionsFarley Flud
| | |        ||| `- Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |        ||+- Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |        ||`* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |        || +* Re: Ping Feeb: borked random number distributionsFarley Flud
| | |        || |`* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |        || | +* Re: Ping Feeb: borked random number distributionsFarley Flud
| | |        || | |+- Re: Ping Feeb: borked random number distributionsDFS
| | |        || | |+* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |        || | ||+* Re: Ping Feeb: borked random number distributionsrbowman
| | |        || | |||`* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |        || | ||| +- Re: Ping Feeb: borked random number distributionsrbowman
| | |        || | ||| `* Re: Ping Feeb: borked random number distributionsStéphane CARPENTIER
| | |        || | |||  `* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |        || | |||   `* Re: Ping Feeb: borked random number distributionsrbowman
| | |        || | |||    `* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |        || | |||     `* Re: Ping Feeb: borked random number distributionsStéphane CARPENTIER
| | |        || | |||      +- Re: Ping Feeb: borked random number distributionschrisv
| | |        || | |||      `* Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |        || | ||`* Re: Ping Feeb: borked random number distributionsFarley Flud
| | |        || | |`- Re: Ping Feeb: borked random number distributionsPhysfitfreak
| | |        || | `* Re: Ping Feeb: borked random number distributionsFarley Flud
| | |        || `- Re: Ping Feeb: borked random number distributionsrbowman
| | |        |`* Re: Ping Feeb: borked random number distributionscandycanearter07
| | |        `* Re: Ping Feeb: borked random number distributionsrbowman
| | `- Re: Ping Feeb: borked random number distributionsPhysfitfreak
| `* Re: Ping Feeb: borked random number distributionsLord Master
`* Re: The Answer, Of Course, Is... (was: Ping Feeb: borked random number distributTyrone

Pages:123456789
Ping Feeb: borked random number distributions

<E6jdN.7678$83n7.58@fx18.iad>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5464&group=comp.os.linux.advocacy#5464

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Betterbird (Windows)
Newsgroups: comp.os.linux.advocacy
Content-Language: en-US
From: nospam@dfs.com (DFS)
Subject: Ping Feeb: borked random number distributions
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 92
Message-ID: <E6jdN.7678$83n7.58@fx18.iad>
X-Complaints-To: abuse@blocknews.net
NNTP-Posting-Date: Sun, 10 Dec 2023 13:33:24 UTC
Organization: blocknews - www.blocknews.net
Date: Sun, 10 Dec 2023 08:33:28 -0500
X-Received-Bytes: 2180
 by: DFS - Sun, 10 Dec 2023 13:33 UTC

Generated 2M random dates via this code, compiled with:
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)

//get random number from within range
int randNbr(int low, int high) {
return (low + rand() / (RAND_MAX / (high - low + 1) + 1));
}

//test for leap year
int isleapyear(int yr) {
if(((yr%4==0) && (yr%100!=0)) || (yr%400==0))
{return 0;}
return -1;
}
//build random date in format YYYY-MM-DD
int mdays[12]={31,28,31,30,31,30,31,31,30,31,30,31}; //days in month
char *randDate() {
//year
int ryear = randNbr(2023,2023);
//random month
int rmth = randNbr(1,12);
//random day from that month
int rday = randNbr(1,mdays[rmth-1]);

//leap years
if((isleapyear(ryear)==0) && (rmth==2)) {
rday = randNbr(1,29);
}

char *randDt = malloc(sizeof(char) * 11);
sprintf(randDt,"%d-%02d-%02d",ryear, rmth, rday);
randDt[10] = '\0';
return randDt;
}

Results: https://imgur.com/a/yQHDyXf

The distribution of the dates is definitely FUBAR (it returns month = 2
way too often), so the randNbr() function code must be bad.

Oddly, the distribution of day = 2 is normal, while the counts of days
29,30,31 are also invalid.

Day|Count
01|65897
02|65890
03|65563
04|65743
05|65969
06|65904
07|65847
08|65285
09|65924
10|66052
11|65780
12|66071
13|66084
14|65670
15|66057
16|65810
17|66036
18|65845
19|65605
20|66024
21|65516
22|65638
23|65894
24|65726
25|65948
26|65506
27|65619
28|65980
29|59466
30|59983
31|37668
Total = 2M

Any ideas?

What do you use to get random numbers in a range?

Re: Ping Feeb: borked random number distributions

<179f7ea3daf8ff41$32284$755348$802601b3@news.usenetexpress.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5474&group=comp.os.linux.advocacy#5474

  copy link   Newsgroups: comp.os.linux.advocacy
From: dg@chaos.rocks (Diego Garcia)
Subject: Re: Ping Feeb: borked random number distributions
Newsgroups: comp.os.linux.advocacy
References: <E6jdN.7678$83n7.58@fx18.iad>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 29
Path: i2pn2.org!i2pn.org!news.1d4.us!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!news.usenetexpress.com!not-for-mail
Date: Sun, 10 Dec 2023 14:27:06 +0000
Nntp-Posting-Date: Sun, 10 Dec 2023 14:27:06 +0000
X-Received-Bytes: 1169
Organization: UsenetExpress - www.usenetexpress.com
X-Complaints-To: abuse@usenetexpress.com
Message-Id: <179f7ea3daf8ff41$32284$755348$802601b3@news.usenetexpress.com>
 by: Diego Garcia - Sun, 10 Dec 2023 14:27 UTC

On Sun, 10 Dec 2023 08:33:28 -0500, DFS wrote:

> Generated 2M random dates via this code, compiled with:
> gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
>
>
> //get random number from within range
> int randNbr(int low, int high) {
> return (low + rand() / (RAND_MAX / (high - low + 1) + 1));
> }
>

Totally fucked right from the start, and totally expected from the
DuFuS Supremus.

You want a random date? Then generate a random "Julian Date"
integer and then convert to the YYYY-MM-DD format.

Today's (2023-12-10) Julian Date is 2460289.

Also, use an UNBIASED uniform random PRNG. The C rand()
suffers from modulo bias.

The problem is solved.

Now cue the code monkeys.

Ahahahahahahahahahahahahahahahaha!

Re: Ping Feeb: borked random number distributions

<ul52e4$2jr56$6@solani.org>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5509&group=comp.os.linux.advocacy#5509

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: Physfitfreak@gmail.com (Physfitfreak)
Newsgroups: comp.os.linux.advocacy
Subject: Re: Ping Feeb: borked random number distributions
Date: Sun, 10 Dec 2023 13:09:55 -0600
Message-ID: <ul52e4$2jr56$6@solani.org>
References: <E6jdN.7678$83n7.58@fx18.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 10 Dec 2023 19:09:56 -0000 (UTC)
Injection-Info: solani.org;
logging-data="2747558"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:gEUNylJGqCscyvuS2kJAL1t9y0g=
Content-Language: en-US
X-User-ID: eJwFwQcBwEAIBDBLzzigcpj+JTSBGFm7GkxxOH4vOds2YtqHdIu1FDaNlynjssjW1shT/7ik9og6aCsKP2XIFjs=
In-Reply-To: <E6jdN.7678$83n7.58@fx18.iad>
 by: Physfitfreak - Sun, 10 Dec 2023 19:09 UTC

On 12/10/2023 7:33 AM, DFS wrote:
>
> Generated 2M random dates via this code, compiled with:
> gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
>
>
> //get random number from within range
> int randNbr(int low, int high) {
>     return (low + rand() / (RAND_MAX / (high - low + 1) + 1));
> }
>
>
> //test for leap year
> int isleapyear(int yr) {
>     if(((yr%4==0) && (yr%100!=0)) || (yr%400==0))
>         {return 0;}
>     return -1;
> }
>
> //build random date in format YYYY-MM-DD
> int mdays[12]={31,28,31,30,31,30,31,31,30,31,30,31};  //days in month
> char *randDate() {
>
>     //year
>     int ryear = randNbr(2023,2023);
>
>     //random month
>     int rmth = randNbr(1,12);
>
>     //random day from that month
>     int rday = randNbr(1,mdays[rmth-1]);
>
>     //leap years
>     if((isleapyear(ryear)==0) && (rmth==2)) {
>         rday = randNbr(1,29);
>     }
>
>
>     char *randDt = malloc(sizeof(char) * 11);
>     sprintf(randDt,"%d-%02d-%02d",ryear, rmth, rday);
>     randDt[10] = '\0';
>
>     return randDt;
> }
>
>
> Results: https://imgur.com/a/yQHDyXf
>
>
> The distribution of the dates is definitely FUBAR (it returns month = 2
> way too often), so the randNbr() function code must be bad.
>
> Oddly, the distribution of day = 2 is normal, while the counts of days
> 29,30,31 are also invalid.
>
> Day|Count
> 01|65897
> 02|65890
> 03|65563
> 04|65743
> 05|65969
> 06|65904
> 07|65847
> 08|65285
> 09|65924
> 10|66052
> 11|65780
> 12|66071
> 13|66084
> 14|65670
> 15|66057
> 16|65810
> 17|66036
> 18|65845
> 19|65605
> 20|66024
> 21|65516
> 22|65638
> 23|65894
> 24|65726
> 25|65948
> 26|65506
> 27|65619
> 28|65980
> 29|59466
> 30|59983
> 31|37668
> Total = 2M
>
> Any ideas?
>
> What do you use to get random numbers in a range?
>

Whatever way you choose, plot the results in 3D. If they don't spread
all over, it's not a good random number generator.

Most of the generators are bad :)

Re: Ping Feeb: borked random number distributions

<ul53m2$2judb$1@solani.org>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5514&group=comp.os.linux.advocacy#5514

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: Physfitfreak@gmail.com (Physfitfreak)
Newsgroups: comp.os.linux.advocacy
Subject: Re: Ping Feeb: borked random number distributions
Date: Sun, 10 Dec 2023 13:31:14 -0600
Message-ID: <ul53m2$2judb$1@solani.org>
References: <E6jdN.7678$83n7.58@fx18.iad> <ul52e4$2jr56$6@solani.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 10 Dec 2023 19:31:15 -0000 (UTC)
Injection-Info: solani.org;
logging-data="2750891"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Vugkr91iTFkXOKYJnLCwigardvQ=
Content-Language: en-US
In-Reply-To: <ul52e4$2jr56$6@solani.org>
X-User-ID: eJwNyMEBwCAIA8CVChKQcTQ0+4/Q3vOw0pIViQwIOr2casmqwJ7J47dpvV2vYcPp/7IUV08EJ2NV59wMx+EHZYoV3g==
 by: Physfitfreak - Sun, 10 Dec 2023 19:31 UTC

On 12/10/2023 1:09 PM, Physfitfreak wrote:
> On 12/10/2023 7:33 AM, DFS wrote:
>>
>> Generated 2M random dates via this code, compiled with:
>> gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
>>
>>
>> //get random number from within range
>> int randNbr(int low, int high) {
>>      return (low + rand() / (RAND_MAX / (high - low + 1) + 1));
>> }
>>
>>
>> //test for leap year
>> int isleapyear(int yr) {
>>      if(((yr%4==0) && (yr%100!=0)) || (yr%400==0))
>>          {return 0;}
>>      return -1;
>> }
>>
>> //build random date in format YYYY-MM-DD
>> int mdays[12]={31,28,31,30,31,30,31,31,30,31,30,31};  //days in month
>> char *randDate() {
>>
>>      //year
>>      int ryear = randNbr(2023,2023);
>>
>>      //random month
>>      int rmth = randNbr(1,12);
>>
>>      //random day from that month
>>      int rday = randNbr(1,mdays[rmth-1]);
>>
>>      //leap years
>>      if((isleapyear(ryear)==0) && (rmth==2)) {
>>          rday = randNbr(1,29);
>>      }
>>
>>
>>      char *randDt = malloc(sizeof(char) * 11);
>>      sprintf(randDt,"%d-%02d-%02d",ryear, rmth, rday);
>>      randDt[10] = '\0';
>>
>>      return randDt;
>> }
>>
>>
>> Results: https://imgur.com/a/yQHDyXf
>>
>>
>> The distribution of the dates is definitely FUBAR (it returns month =
>> 2 way too often), so the randNbr() function code must be bad.
>>
>> Oddly, the distribution of day = 2 is normal, while the counts of days
>> 29,30,31 are also invalid.
>>
>> Day|Count
>> 01|65897
>> 02|65890
>> 03|65563
>> 04|65743
>> 05|65969
>> 06|65904
>> 07|65847
>> 08|65285
>> 09|65924
>> 10|66052
>> 11|65780
>> 12|66071
>> 13|66084
>> 14|65670
>> 15|66057
>> 16|65810
>> 17|66036
>> 18|65845
>> 19|65605
>> 20|66024
>> 21|65516
>> 22|65638
>> 23|65894
>> 24|65726
>> 25|65948
>> 26|65506
>> 27|65619
>> 28|65980
>> 29|59466
>> 30|59983
>> 31|37668
>> Total = 2M
>>
>> Any ideas?
>>
>> What do you use to get random numbers in a range?
>>
>
> Whatever way you choose, plot the results in 3D. If they don't spread
> all over, it's not a good random number generator.
>
> Most of the generators are bad :)
>
>

Use each three consecutively produced numbers as the coordinates for a
single dot in 3D plot. Then see they exhibit a rather uniform
distribution or are concentrated in a certain volume, or over a certain
surface or along a certain line. Truly random numbers aren't that easy
to generate. They may even be impossible to generate.

Re: Random numbers in a range.

<nppdN.486$JLvf.188@fx44.iad>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5519&group=comp.os.linux.advocacy#5519

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx44.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Betterbird (Windows)
Subject: Re: Random numbers in a range.
Newsgroups: comp.os.linux.advocacy
References: <E6jdN.7678$83n7.58@fx18.iad>
<Jeff-Relf.Me@Dec.10--9.19am.Seattle.2023>
Content-Language: en-US
From: nospam@dfs.com (DFS)
In-Reply-To: <Jeff-Relf.Me@Dec.10--9.19am.Seattle.2023>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 29
Message-ID: <nppdN.486$JLvf.188@fx44.iad>
X-Complaints-To: abuse@blocknews.net
NNTP-Posting-Date: Sun, 10 Dec 2023 20:42:59 UTC
Organization: blocknews - www.blocknews.net
Date: Sun, 10 Dec 2023 15:43:01 -0500
X-Received-Bytes: 1568
 by: DFS - Sun, 10 Dec 2023 20:43 UTC

On 12/10/2023 12:19 PM, Relf wrote:
>> int isleapyear(int yr) { // test for leap year
>> if(((yr%4==0) && (yr%100!=0)) || (yr%400==0))
>> {return 0;}
>> return -1;
>> }
>
> #define isLeapYear( Yr ) ( !( Yr%400 ) || Yr%100 && !( Yr%4 ) )

That's a good shortie. You posted it before - I need to remember to use it.

>> it returns month = 2 too often https://imgur.com/a/yQHDyXf
>> Any ideas ?
>
> Use (__int64) Seconds Since The Start of 1970, "localtime()" & "mktime()".

I used that in the past. But it required strftime to get it to the
format I wanted, and was a hassle.

>> What do you use to get random numbers in a range ?
>
> #define Rand( Min, Max ) ( Min + ( Max - Min )*rand()/RAND_MAX )

I'm gonna try that. My results are bad:

* Feb (mth 2) way overrepresented
* days 29,30,31 of the month underrepresented

Re: You don't need "strftime()".

<ul5l8v$2k5fu$3@solani.org>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5536&group=comp.os.linux.advocacy#5536

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: Physfitfreak@gmail.com (Physfitfreak)
Newsgroups: comp.os.linux.advocacy
Subject: Re: You don't need "strftime()".
Date: Sun, 10 Dec 2023 18:31:27 -0600
Message-ID: <ul5l8v$2k5fu$3@solani.org>
References: <E6jdN.7678$83n7.58@fx18.iad>
<Jeff-Relf.Me@Dec.10--9.19am.Seattle.2023> <nppdN.486$JLvf.188@fx44.iad>
<Jeff-Relf.Me@Dec.10--3.04pm.Seattle.2023>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 11 Dec 2023 00:31:27 -0000 (UTC)
Injection-Info: solani.org;
logging-data="2758142"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:rLiNxOz1zQrnG/0ilvtpYXOqjYU=
X-User-ID: eJwNyskBwCAIBMCWXI5FyjEI/ZcQ5z2uBCuMTvPxyYsUH11ShVPIXexu9I6+C5j8FMMTb4gOu8zqYJm8Jn5/VTEVgg==
Content-Language: en-US
In-Reply-To: <Jeff-Relf.Me@Dec.10--3.04pm.Seattle.2023>
 by: Physfitfreak - Mon, 11 Dec 2023 00:31 UTC

On 12/10/2023 5:04 PM, Relf wrote:
>> Re: https://imgur.com/a/yQHDyXf
>> * Feb (mth 2) overrepresented
>> * days 29,30,31 of the month underrepresented
>
> You (DFS) replied ( to me ):
>>> Use (__int64) Seconds Since The Start of 1970, "localtime()" & "mktime()".
>>
>> I used that in the past. But it required strftime to get it to the
>> format I wanted, and was a hassle.
>
> You don't need "strftime()".
>
> #define LoopJ( N ) int J = -1, eJ = N ; eJ-- ; while ( ++J <= eJ )
> #define LoopK( N ) int K = -1, eK = N ; eK-- ; while ( ++K <= eK )
>
> wchar_t Out[ 400 ], *D = Out; const int szBucket = 15 ;
> int Year[365/szBucket] = {}; tm rRandTime, rTimeB = {}, rTimeE ; __int64 RandTime, Min, Max ;
> rTimeB.tm_mday = 1, rTimeB.tm_year = 2023 - 1900, rTimeB.tm_isdst = -1 ;
> rTimeE = rTimeB, rTimeE.tm_year = 2024 - 1900 ;
> Min = mktime( &rTimeB ), Max = mktime( &rTimeE );
>
> LoopJ(2000000) { RandTime = Min + ( Max - Min )*rand()/RAND_MAX ;
> rRandTime = *localtime( ( time_t * ) &RandTime ), Year[ rRandTime.tm_yday / szBucket ]++ ; }
>
> LoopK(365/szBucket) D += swprintf( D, L"%5d, ", Year[ K ] ); Sh( L"%s\n\n", Out );
>
> // Output, each bucket holds 15 days:
> // 82445, 82322, 81810, 82482, 81621, 82347, 82275, 82281, 81993, 81771, 82151, 81956
> // 82327, 82463, 82122, 81660, 82791, 81764, 81933, 82255, 82550, 82232, 82323, 82699

That's not enough output to show the degree of randomness in the code.
Take a couple of thousands of them and make a 3D plot with them, each
three numbers forming one dot's coordinates. Then one can perhaps see
the quality of randomness in them.

Re: You don't need "strftime()".

<ul5llm$2s7iu$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5537&group=comp.os.linux.advocacy#5537

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: vallor@cultnix.org (vallor)
Newsgroups: comp.os.linux.advocacy
Subject: Re: You don't need "strftime()".
Date: Mon, 11 Dec 2023 00:38:14 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <ul5llm$2s7iu$1@dont-email.me>
References: <E6jdN.7678$83n7.58@fx18.iad>
<Jeff-Relf.Me@Dec.10--9.19am.Seattle.2023> <nppdN.486$JLvf.188@fx44.iad>
<Jeff-Relf.Me@Dec.10--3.04pm.Seattle.2023>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 11 Dec 2023 00:38:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="34242a5d6399dbccc236e50a924e558a";
logging-data="3022430"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19pTK8S99ejUq89vb4Q2plk"
User-Agent: Pan/0.155 (Kherson; fc5a80b gitlab.gnome.org/GNOME/pan.git;
x86_64-pc-linux-gnu)
Cancel-Lock: sha1:OzW9iJBnPZHbeHz0jETEbCFupsI=
X-Face: \}2`P"_@pS86<'EM:'b.Ml}8IuMK"pV"?FReF$'c.S%u9<Q#U*4QO)$l81M`{Q/n
XL'`91kd%N::LG:=*\35JS0prp\VJN^<s"b#bff@fA7]5lJA.jn,x_d%Md$,{.EZ
 by: vallor - Mon, 11 Dec 2023 00:38 UTC

On Sun, 10 Dec 2023 15:04:27 -0800 (Seattle), "Relf"
<Usenet@Jeff-Relf.Me> wrote in <Jeff-Relf.Me@Dec.10--3.04pm.Seattle.2023>:

>> Re: https://imgur.com/a/yQHDyXf * Feb (mth 2) overrepresented * days
>> 29,30,31 of the month underrepresented
>
> You (DFS) replied ( to me ):
>> > Use (__int64) Seconds Since The Start of 1970, "localtime()" &
>> > "mktime()".
>>
>> I used that in the past. But it required strftime to get it to the
>> format I wanted, and was a hassle.
>
> You don't need "strftime()".
>
> #define LoopJ( N ) int J = -1, eJ = N ; eJ-- ; while ( ++J <= eJ )
> #define LoopK( N ) int K = -1, eK = N ; eK-- ; while ( ++K <= eK )
>
> wchar_t Out[ 400 ], *D = Out; const int szBucket = 15 ;
> int Year[365/szBucket] = {}; tm rRandTime, rTimeB = {}, rTimeE ;
> __int64 RandTime, Min, Max ;
> rTimeB.tm_mday = 1, rTimeB.tm_year = 2023 - 1900, rTimeB.tm_isdst = -1 ;
> rTimeE = rTimeB, rTimeE.tm_year = 2024 - 1900 ;
> Min = mktime( &rTimeB ), Max = mktime( &rTimeE );
>
> LoopJ(2000000) { RandTime = Min + ( Max - Min )*rand()/RAND_MAX ;
> rRandTime = *localtime( ( time_t * ) &RandTime ), Year[
> rRandTime.tm_yday / szBucket ]++ ; }
>
> LoopK(365/szBucket) D += swprintf( D, L"%5d, ", Year[ K ] ); Sh(
> L"%s\n\n", Out );
>
> // Output, each bucket holds 15 days:
> // 82445, 82322, 81810, 82482, 81621, 82347, 82275, 82281, 81993,
> 81771, 82151, 81956 // 82327, 82463, 82122, 81660, 82791, 81764, 81933,
> 82255, 82550, 82232, 82323, 82699

BTW, you can get an int64_t integer definition
from #include <stdint.h>

(I believe it is making its way into the standard.)

Also:

"( time_t * ) &RandTime"

Why not make those variables "time_t" in the first place?

Also:

Why the wide characters? Are you just used to using them?

--
-v

GNU Indent on Linux (was: Re: You don't need "strftime()".)

<ul5o8v$2s7iu$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5539&group=comp.os.linux.advocacy#5539

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: vallor@cultnix.org (vallor)
Newsgroups: comp.os.linux.advocacy
Subject: GNU Indent on Linux (was: Re: You don't need "strftime()".)
Date: Mon, 11 Dec 2023 01:22:39 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 74
Message-ID: <ul5o8v$2s7iu$2@dont-email.me>
References: <E6jdN.7678$83n7.58@fx18.iad>
<Jeff-Relf.Me@Dec.10--9.19am.Seattle.2023> <nppdN.486$JLvf.188@fx44.iad>
<Jeff-Relf.Me@Dec.10--3.04pm.Seattle.2023> <ul5llm$2s7iu$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 11 Dec 2023 01:22:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="34242a5d6399dbccc236e50a924e558a";
logging-data="3022430"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+n3Ml9s6tN0NPMP4YHEyTM"
User-Agent: Pan/0.155 (Kherson; fc5a80b gitlab.gnome.org/GNOME/pan.git;
x86_64-pc-linux-gnu)
Cancel-Lock: sha1:9QQG9uZPhDXbhmBERPk5ycG33U4=
X-Face: \}2`P"_@pS86<'EM:'b.Ml}8IuMK"pV"?FReF$'c.S%u9<Q#U*4QO)$l81M`{Q/n
XL'`91kd%N::LG:=*\35JS0prp\VJN^<s"b#bff@fA7]5lJA.jn,x_d%Md$,{.EZ
 by: vallor - Mon, 11 Dec 2023 01:22 UTC

On Mon, 11 Dec 2023 00:38:14 -0000 (UTC), vallor <vallor@cultnix.org>
wrote in <ul5llm$2s7iu$1@dont-email.me>:

> On Sun, 10 Dec 2023 15:04:27 -0800 (Seattle), "Relf"
> <Usenet@Jeff-Relf.Me> wrote in <Jeff-Relf.Me@Dec.10--3.04pm.Seattle.2023>:
>
>>> Re: https://imgur.com/a/yQHDyXf * Feb (mth 2) overrepresented * days
>>> 29,30,31 of the month underrepresented
>>
>> You (DFS) replied ( to me ):
>>> > Use (__int64) Seconds Since The Start of 1970, "localtime()" &
>>> > "mktime()".
>>>
>>> I used that in the past. But it required strftime to get it to the
>>> format I wanted, and was a hassle.
>>
>> You don't need "strftime()".
>>
>> #define LoopJ( N ) int J = -1, eJ = N ; eJ-- ; while ( ++J <= eJ )
>> #define LoopK( N ) int K = -1, eK = N ; eK-- ; while ( ++K <= eK )
>>
>> wchar_t Out[ 400 ], *D = Out; const int szBucket = 15 ;
>> int Year[365/szBucket] = {}; tm rRandTime, rTimeB = {}, rTimeE ;
>> __int64 RandTime, Min, Max ;
>> rTimeB.tm_mday = 1, rTimeB.tm_year = 2023 - 1900, rTimeB.tm_isdst = -1 ;
>> rTimeE = rTimeB, rTimeE.tm_year = 2024 - 1900 ;
>> Min = mktime( &rTimeB ), Max = mktime( &rTimeE );
>>
>> LoopJ(2000000) { RandTime = Min + ( Max - Min )*rand()/RAND_MAX ;
>> rRandTime = *localtime( ( time_t * ) &RandTime ), Year[
>> rRandTime.tm_yday / szBucket ]++ ; }
>>
>> LoopK(365/szBucket) D += swprintf( D, L"%5d, ", Year[ K ] ); Sh(
>> L"%s\n\n", Out );
>>
>> // Output, each bucket holds 15 days:
>> // 82445, 82322, 81810, 82482, 81621, 82347, 82275, 82281, 81993,
>> 81771, 82151, 81956 // 82327, 82463, 82122, 81660, 82791, 81764, 81933,
>> 82255, 82550, 82232, 82323, 82699
>
> BTW, you can get an int64_t integer definition
> from #include <stdint.h>
>
> (I believe it is making its way into the standard.)
>
> Also:
>
> "( time_t * ) &RandTime"
>
> Why not make those variables "time_t" in the first place?
>
> Also:
>
> Why the wide characters? Are you just used to using them?

Incidentally, GNU indent is handy for reformatting C code, and
will even let you pick a favorite C indent style.

$ man indent
[...]
The indent program can be used to make code easier to
read. It can also convert from one style of writing C
to another.

indent understands a substantial amount about the syntax
of C, but it also attempts to cope with incomplete and
misformed syntax.

In version 1.2 and more recent versions, the GNU style
of indenting is the default.
_ _ _ _ _ _ _

--
-v

Re: Excessive whitespace/comments is a big, red flag.

<ul5t72$2s7iu$4@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5547&group=comp.os.linux.advocacy#5547

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: vallor@cultnix.org (vallor)
Newsgroups: comp.os.linux.advocacy
Subject: Re: Excessive whitespace/comments is a big, red flag.
Date: Mon, 11 Dec 2023 02:46:58 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <ul5t72$2s7iu$4@dont-email.me>
References: <E6jdN.7678$83n7.58@fx18.iad>
<Jeff-Relf.Me@Dec.10--9.19am.Seattle.2023> <nppdN.486$JLvf.188@fx44.iad>
<Jeff-Relf.Me@Dec.10--3.04pm.Seattle.2023> <ul5llm$2s7iu$1@dont-email.me>
<ul5o8v$2s7iu$2@dont-email.me> <Jeff-Relf.Me@Dec.10--6.24pm.Seattle.2023>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 11 Dec 2023 02:46:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="34242a5d6399dbccc236e50a924e558a";
logging-data="3022430"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19u5lKRAgXZEeRbJVWlPQaF"
User-Agent: Pan/0.155 (Kherson; fc5a80b gitlab.gnome.org/GNOME/pan.git;
x86_64-pc-linux-gnu)
Cancel-Lock: sha1:kI5a4y+xzf6R42aVr3QIfLPvacY=
X-Face: \}2`P"_@pS86<'EM:'b.Ml}8IuMK"pV"?FReF$'c.S%u9<Q#U*4QO)$l81M`{Q/n
XL'`91kd%N::LG:=*\35JS0prp\VJN^<s"b#bff@fA7]5lJA.jn,x_d%Md$,{.EZ
 by: vallor - Mon, 11 Dec 2023 02:46 UTC

On Sun, 10 Dec 2023 18:24:12 -0800 (Seattle), "Relf"
<Usenet@Jeff-Relf.Me> wrote in <Jeff-Relf.Me@Dec.10--6.24pm.Seattle.2023>:

> ScottGNU tortured my source code thusly:
>> > > // Output, each bucket holds 15 days:
>> > > // 82445, 82322, 81810, 82482, 81621, 82347, 82275, 82281, 81993,
>> > > 81771, 82151, 81956 // 82327, 82463, 82122, 81660, 82791, 81764, 81933,
>> > > 82255, 82550, 82232, 82323, 82699
>
> Whitespace speaks to me, so it's always custom.
>
> Excessive whitespace/comments is a big, red flag.

It depends on the quality of the whitespacing and comments.

If someone is adhering to a programming standard, and
carefully commenting their code, there's not a
damned thing wrong with that -- good for them!

--
-v

Re: Ping Feeb: borked random number distributions

<ul71r4$35pn9$5@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5554&group=comp.os.linux.advocacy#5554

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: OFeem1987@teleworm.us (Chris Ahlstrom)
Newsgroups: comp.os.linux.advocacy
Subject: Re: Ping Feeb: borked random number distributions
Date: Mon, 11 Dec 2023 08:12:04 -0500
Organization: None
Lines: 60
Message-ID: <ul71r4$35pn9$5@dont-email.me>
References: <E6jdN.7678$83n7.58@fx18.iad> <ul52e4$2jr56$6@solani.org>
Reply-To: OFeem1987@teleworm.us
Injection-Date: Mon, 11 Dec 2023 13:12:05 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="9bf575fed3c224ba946372365aa4cd43";
logging-data="3335913"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//wez7FHg8Axfsjm7xox9T"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:ge//gL7lPLh2DtB3C+4t5Q2kqyM=
X-User-Agent: Microsoft Outl00k, Usenet K00k Editions
X-Mutt: The most widely-used MUA
X-Slrn: Why use anything else?
 by: Chris Ahlstrom - Mon, 11 Dec 2023 13:12 UTC

Physfitfreak wrote this copyrighted missive and expects royalties:

> On 12/10/2023 7:33 AM, DFS wrote:
>>
>> Generated 2M random dates via this code, compiled with:
>> gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
>>
>> . . .
>> Any ideas?
>>
>> What do you use to get random numbers in a range?
>>
>
> Whatever way you choose, plot the results in 3D. If they don't spread
> all over, it's not a good random number generator.
>
> Most of the generators are bad :)

Check out C++:

class randomizer
{ private:

static const int s_upper_limit = std::numeric_limits<int>::max();

std::random_device m_rd; /* seed source for random number engine */
std::mt19937 m_mtwister; /* mersenne_twister_engine, maybe seeded */
std::uniform_int_distribution<int> m_distribution;

public:

randomizer (int seed = -1) :
m_rd (), /* random device (opt.) */
m_mtwister (m_rd()), /* internal generator */
m_distribution (0, s_upper_limit) /* uniform int range */
{
if (seed != (-1))
m_mtwister.seed(seed);
}

int generate ()
{
return m_distribution(m_mtwister);
}

int generate (int range)
{
int rnd = generate();
long result = 2 * range * long(rnd) / long(s_upper_limit);
return int(result) - range;
}

};

Hasn't had any heavy testing, though. The primitive linear congruential
function rand() is good enough for light randomizing.

--
You will get what you deserve.

Re: Random numbers in a range.

<dwEdN.12039$Wp_8.3334@fx17.iad>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5555&group=comp.os.linux.advocacy#5555

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx17.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Betterbird (Windows)
From: nospam@dfs.com (DFS)
Subject: Re: Random numbers in a range.
Newsgroups: comp.os.linux.advocacy
References: <E6jdN.7678$83n7.58@fx18.iad>
<Jeff-Relf.Me@Dec.10--9.19am.Seattle.2023>
Content-Language: en-US
In-Reply-To: <Jeff-Relf.Me@Dec.10--9.19am.Seattle.2023>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 26
Message-ID: <dwEdN.12039$Wp_8.3334@fx17.iad>
X-Complaints-To: abuse@blocknews.net
NNTP-Posting-Date: Mon, 11 Dec 2023 13:54:17 UTC
Organization: blocknews - www.blocknews.net
Date: Mon, 11 Dec 2023 08:54:21 -0500
X-Received-Bytes: 1310
 by: DFS - Mon, 11 Dec 2023 13:54 UTC

On 12/10/2023 12:19 PM, Relf wrote:

>> What do you use to get random numbers in a range ?
>
> #define Rand( Min, Max ) ( Min + ( Max - Min )*rand()/RAND_MAX )

Have you tested this?

It always returns 1, so I get results like this when building a random
date in the range of (2023,2026).

DFS Relf
1 2025-10-10 2023-01-01
2 2026-09-10 2023-01-01
3 2024-12-13 2023-01-01
4 2026-12-04 2023-01-01
5 2023-09-05 2023-01-01
6 2026-12-22 2023-01-01
7 2025-09-06 2023-01-01
8 2026-10-23 2023-01-01
9 2024-04-05 2023-01-01
10 2023-03-15 2023-01-01
....

Re: Ping Feeb: borked random number distributions

<179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5586&group=comp.os.linux.advocacy#5586

  copy link   Newsgroups: comp.os.linux.advocacy
From: ff@linux.rocks (Farley Flud)
Subject: Re: Ping Feeb: borked random number distributions
Newsgroups: comp.os.linux.advocacy
References: <E6jdN.7678$83n7.58@fx18.iad>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 82
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!news.usenetexpress.com!not-for-mail
Date: Mon, 11 Dec 2023 20:32:25 +0000
Nntp-Posting-Date: Mon, 11 Dec 2023 20:32:25 +0000
X-Received-Bytes: 2666
Organization: UsenetExpress - www.usenetexpress.com
X-Complaints-To: abuse@usenetexpress.com
Message-Id: <179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>
 by: Farley Flud - Mon, 11 Dec 2023 20:32 UTC

On Sun, 10 Dec 2023 08:33:28 -0500, the DuFuS Supremus wrote:

>
> Any ideas?
>

What a pack of stupid fucks!

Here is how the Lord Master does it. The whole thing can be done
is a SINGLE FUCKING LINE of C code, but I have teased it out over
several lines for the benefit of you dumb shits.

Firstly, we need a PRNG that does not exhibit modulo bias. The GNU
C Library provides "arc4random_uniform" just for this purpose.

Secondly, we select a random day either before or after the Unix Epoch
of 1970-01-01:00:00:00 UTC. I have chosen a hundred year range either
before or after but one could have any number up to the limit, in days,
of uint32_t. (This is actually the Modified Julian Date.)

The code automatically converts from UTC to the timezone specified in
the TZ variable and accounts for leap years as well and also for Daylight
Saving time.

A quiz question for you lamentable dumb-fucks:

The PRNG in the code below has not been seeded. Why the fuck not?

Now, the magnificent code from the from the C Programmer Extraordinaire:
(This is just a one-shot. If you want more, then put it in a loop yourself
-- if you could even manage that. Ahahahaha!)

==========================================
Begin C code
==========================================

#define _GNU_SOURCE
#include <time.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{ time_t mjd;
struct tm *local_time;
char rnd_date[20];

// Select a time span around the Unix epoch
// The discrete uniform distribution is only shifted and therefore no bias is introduced.

mjd = ((time_t)(arc4random_uniform(365*100*2)) - (time_t)(365*100)) * (time_t)86400;

local_time = localtime(&mjd);

strftime(rnd_date, sizeof(rnd_date), "%F", local_time);

fprintf(stdout, "Random Date: %s\n", rnd_date);

exit(0);

}

==========================================
End C code
==========================================

I should charge y'all $15,000 for this fantastic and supremely
efficient code, but the spirit of FOSS has gotten the better of me.

Farley Flud

Perl guru.

C programmer extraordinaire.

Assembly language genius.

We do thank you.

Ahahahahahahahahahahahahahahahahahahahahahahaha!

Re: Ping Feeb: borked random number distributions

<ul7s53$3abd8$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5587&group=comp.os.linux.advocacy#5587

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: no@thanks.net (candycanearter07)
Newsgroups: comp.os.linux.advocacy
Subject: Re: Ping Feeb: borked random number distributions
Date: Mon, 11 Dec 2023 14:41:07 -0600
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <ul7s53$3abd8$1@dont-email.me>
References: <E6jdN.7678$83n7.58@fx18.iad>
<179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 11 Dec 2023 20:41:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d1c43bcade5156b4ff20a53f02da35b6";
logging-data="3485096"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/GqZCObRNgYze+9IDl6T5S/w8HQPgE1OhQftyfVSMjIg=="
User-Agent: Betterbird (Linux)
Cancel-Lock: sha1:k+ybO1Db1ERfIvNkQjjnQUq96fo=
Content-Language: en-US
In-Reply-To: <179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>
 by: candycanearter07 - Mon, 11 Dec 2023 20:41 UTC

On 12/11/23 14:32, Farley Flud wrote:
<snip>
> Firstly, we need a PRNG that does not exhibit modulo bias. The GNU
> C Library provides "arc4random_uniform" just for this purpose.
<snip>

Well, I learned something.
--
user <candycane> is generated from /dev/urandom

Re: Ping Feeb: borked random number distributions

<Axadnf-h75A3HOr4nZ2dnZfqnPudnZ2d@giganews.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5589&group=comp.os.linux.advocacy#5589

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!69.80.99.26.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 11 Dec 2023 21:39:54 +0000
Subject: Re: Ping Feeb: borked random number distributions
Newsgroups: comp.os.linux.advocacy
References: <E6jdN.7678$83n7.58@fx18.iad> <179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com> <ul7s53$3abd8$1@dont-email.me>
From: pursent100@gmail.com (%)
Date: Mon, 11 Dec 2023 14:39:54 -0700
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.17.1
MIME-Version: 1.0
In-Reply-To: <ul7s53$3abd8$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Antivirus: AVG (VPS 231211-6, 2023-12-11), Outbound message
X-Antivirus-Status: Clean
Message-ID: <Axadnf-h75A3HOr4nZ2dnZfqnPudnZ2d@giganews.com>
Lines: 3
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-ZcfSmzdwvNT+DYZ9GX0oGd9/mux9cUDKf5xaBOlWP9hsbEYMOMx/MzkEqNIE7sQGRXgtf87O6gokyFW!fsjJsdmfWN9GaZu8FsUcI/YdHVubjz0qa0zWYmu9E1zqTT6nYXZovqQdiq5lEMvKhTH83V58yYEq
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: % - Mon, 11 Dec 2023 21:39 UTC

..

it said snip so i did

Re: Ping Feeb: borked random number distributions

<ul88om$2l9av$9@solani.org>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5595&group=comp.os.linux.advocacy#5595

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: Physfitfreak@gmail.com (Physfitfreak)
Newsgroups: comp.os.linux.advocacy
Subject: Re: Ping Feeb: borked random number distributions
Date: Mon, 11 Dec 2023 18:16:21 -0600
Message-ID: <ul88om$2l9av$9@solani.org>
References: <E6jdN.7678$83n7.58@fx18.iad> <ul52e4$2jr56$6@solani.org>
<ul71r4$35pn9$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 12 Dec 2023 00:16:22 -0000 (UTC)
Injection-Info: solani.org;
logging-data="2794847"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:So6U2wcrzNTB/sRKnBnrg99EFUs=
Content-Language: en-US
X-User-ID: eJwFwQkRADAIAzBLvGXI2XrgX8KSdChYgUTk5sqaDx4GONZ6gydMjMyhtCzt+nYUFVFjoqpSHNS49Xn+ATzoFJo=
In-Reply-To: <ul71r4$35pn9$5@dont-email.me>
 by: Physfitfreak - Tue, 12 Dec 2023 00:16 UTC

On 12/11/2023 7:12 AM, Chris Ahlstrom wrote:
> Physfitfreak wrote this copyrighted missive and expects royalties:
>
>> On 12/10/2023 7:33 AM, DFS wrote:
>>>
>>> Generated 2M random dates via this code, compiled with:
>>> gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
>>>
>>> . . .
>>> Any ideas?
>>>
>>> What do you use to get random numbers in a range?
>>>
>>
>> Whatever way you choose, plot the results in 3D. If they don't spread
>> all over, it's not a good random number generator.
>>
>> Most of the generators are bad :)
>
> Check out C++:
>
> class randomizer
> {
> private:
>
> static const int s_upper_limit = std::numeric_limits<int>::max();
>
> std::random_device m_rd; /* seed source for random number engine */
> std::mt19937 m_mtwister; /* mersenne_twister_engine, maybe seeded */
> std::uniform_int_distribution<int> m_distribution;
>
> public:
>
> randomizer (int seed = -1) :
> m_rd (), /* random device (opt.) */
> m_mtwister (m_rd()), /* internal generator */
> m_distribution (0, s_upper_limit) /* uniform int range */
> {
> if (seed != (-1))
> m_mtwister.seed(seed);
> }
>
> int generate ()
> {
> return m_distribution(m_mtwister);
> }
>
> int generate (int range)
> {
> int rnd = generate();
> long result = 2 * range * long(rnd) / long(s_upper_limit);
> return int(result) - range;
> }
>
> };
>
> Hasn't had any heavy testing, though. The primitive linear congruential
> function rand() is good enough for light randomizing.
>

Show me the 3D distribution of a few thousand output numbers and I'd be
able to evaluate it. You would too :)

Re: Ping Feeb: borked random number distributions

<ul8agp$2l9av$12@solani.org>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5601&group=comp.os.linux.advocacy#5601

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: Physfitfreak@gmail.com (Physfitfreak)
Newsgroups: comp.os.linux.advocacy
Subject: Re: Ping Feeb: borked random number distributions
Date: Mon, 11 Dec 2023 18:46:17 -0600
Message-ID: <ul8agp$2l9av$12@solani.org>
References: <E6jdN.7678$83n7.58@fx18.iad>
<179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 12 Dec 2023 00:46:17 -0000 (UTC)
Injection-Info: solani.org;
logging-data="2794847"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:SIa/D01Y2/VdcDWMUOYtqixTN7E=
In-Reply-To: <179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>
Content-Language: en-US
X-User-ID: eJwFwQkBwDAIA0BLMMJTOaUE/xJ25xYaLxEe8PUtBqZDTM1Pnc/ySuVmxUCk1WQIscYjnjKYox/Y5GFh7w8rwBU3
 by: Physfitfreak - Tue, 12 Dec 2023 00:46 UTC

On 12/11/2023 2:32 PM, Farley Flud wrote:
> On Sun, 10 Dec 2023 08:33:28 -0500, the DuFuS Supremus wrote:
>
>>
>> Any ideas?
>>
>
> What a pack of stupid fucks!
>
> Here is how the Lord Master does it. The whole thing can be done
> is a SINGLE FUCKING LINE of C code, but I have teased it out over
> several lines for the benefit of you dumb shits.
>
> Firstly, we need a PRNG that does not exhibit modulo bias. The GNU
> C Library provides "arc4random_uniform" just for this purpose.
>
> Secondly, we select a random day either before or after the Unix Epoch
> of 1970-01-01:00:00:00 UTC. I have chosen a hundred year range either
> before or after but one could have any number up to the limit, in days,
> of uint32_t. (This is actually the Modified Julian Date.)
>
> The code automatically converts from UTC to the timezone specified in
> the TZ variable and accounts for leap years as well and also for Daylight
> Saving time.
>
> A quiz question for you lamentable dumb-fucks:
>
> The PRNG in the code below has not been seeded. Why the fuck not?
>
> Now, the magnificent code from the from the C Programmer Extraordinaire:
> (This is just a one-shot. If you want more, then put it in a loop yourself
> -- if you could even manage that. Ahahahaha!)
>
> ==========================================
> Begin C code
> ==========================================
>
> #define _GNU_SOURCE
> #include <time.h>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main()
> {
> time_t mjd;
> struct tm *local_time;
> char rnd_date[20];
>
>
> // Select a time span around the Unix epoch
> // The discrete uniform distribution is only shifted and therefore no bias is introduced.
>
> mjd = ((time_t)(arc4random_uniform(365*100*2)) - (time_t)(365*100)) * (time_t)86400;
>
> local_time = localtime(&mjd);
>
> strftime(rnd_date, sizeof(rnd_date), "%F", local_time);
>
> fprintf(stdout, "Random Date: %s\n", rnd_date);
>
> exit(0);
>
> }
>
> ==========================================
> End C code
> ==========================================
>
> I should charge y'all $15,000 for this fantastic and supremely
> efficient code, but the spirit of FOSS has gotten the better of me.
>
> Farley Flud
>
> Perl guru.
>
> C programmer extraordinaire.
>
> Assembly language genius.
>
> We do thank you.
>
> Ahahahahahahahahahahahahahahahahahahahahahahaha!
>

Talk and code don't matter. Show me a 3D distribution of numbers
generated by it (each three consecutive, making the coordinates of one
point), then something about quality of the generator can be seen. Use
at least a few thousand points.

Re: Ping Feeb: borked random number distributions

<17a0089b80e2cbc9$47661$1805820$802601b3@news.usenetexpress.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5618&group=comp.os.linux.advocacy#5618

  copy link   Newsgroups: comp.os.linux.advocacy
From: ff@linux.rocks (Farley Flud)
Subject: Re: Ping Feeb: borked random number distributions
Newsgroups: comp.os.linux.advocacy
References: <E6jdN.7678$83n7.58@fx18.iad> <179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com> <ul8agp$2l9av$12@solani.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 21
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!newsfeed.hasname.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!news.usenetexpress.com!not-for-mail
Date: Tue, 12 Dec 2023 08:35:23 +0000
Nntp-Posting-Date: Tue, 12 Dec 2023 08:35:23 +0000
X-Received-Bytes: 1302
Organization: UsenetExpress - www.usenetexpress.com
X-Complaints-To: abuse@usenetexpress.com
Message-Id: <17a0089b80e2cbc9$47661$1805820$802601b3@news.usenetexpress.com>
 by: Farley Flud - Tue, 12 Dec 2023 08:35 UTC

On Mon, 11 Dec 2023 18:46:17 -0600, Physfitfreak wrote:

>
> Talk and code don't matter. Show me a 3D distribution of numbers
> generated by it (each three consecutive, making the coordinates of one
> point), then something about quality of the generator can be seen. Use
> at least a few thousand points.
>

That kind of test applies only to a sequence of random numbers.
Exploring multi-dimensional distributions will indicate if there
are patters within the sequence.

The PRNG here, the arc4random_uniform(), produces a discrete
uniform distribution of integers. The only test is that, for
a very large sample size, each sample has equal frequency and
the average and variance match that of a DUD:

https://en.wikipedia.org/wiki/Discrete_uniform_distribution

Re: Ping Feeb: borked random number distributions

<s1ZdN.9636$xHn7.2886@fx14.iad>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5619&group=comp.os.linux.advocacy#5619

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!news.furie.org.uk!newsfeed.endofthelinebbs.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Betterbird (Windows)
From: nospam@dfs.com (DFS)
Subject: Re: Ping Feeb: borked random number distributions
Newsgroups: comp.os.linux.advocacy
References: <E6jdN.7678$83n7.58@fx18.iad>
<179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>
Content-Language: en-US
In-Reply-To: <179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 42
Message-ID: <s1ZdN.9636$xHn7.2886@fx14.iad>
X-Complaints-To: abuse@blocknews.net
NNTP-Posting-Date: Tue, 12 Dec 2023 13:15:04 UTC
Organization: blocknews - www.blocknews.net
Date: Tue, 12 Dec 2023 08:15:05 -0500
X-Received-Bytes: 1959
 by: DFS - Tue, 12 Dec 2023 13:15 UTC

On 12/11/2023 3:32 PM, Farley Flud wrote:

> we select a random day either before or after the Unix Epoch
> of 1970-01-01:00:00:00 UTC. I have chosen a hundred year range either
> before or after

You "chose" because of your inability to pass in a year-range:

2021,2025

> this fantastic

(without installing libbsd-dev your code wouldn't compile on my Ubuntu
install running on WSL. After installing the library, it still throws
warning "implicit declaration of function ‘arc4random_uniform’")

--------------------------------------------------------------
$ gcc -Wall speedtest_random_dates.c -o speeddates -lbsd
$ ./speeddates
generating random dates...

2000000 DFS dates generated in 0.25 seconds
2000000 Feeb dates generated in 1.72 seconds
done
--------------------------------------------------------------

> and supremely efficient code

0.25 vs 1.72? Looks extremely INefficient.

But... the arc4random() code is fewer lines and - even without my stupid
Feb anomaly - gives a better random distribution than rand(), so I would
use it (after altering it to accept any starting and ending year).

https://imgur.com/a/fw3L1Ag

Re: Ping Feeb: borked random number distributions

<b40a8c0c-9e82-44f7-acf0-71b46374089en@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5620&group=comp.os.linux.advocacy#5620

  copy link   Newsgroups: comp.os.linux.advocacy
X-Received: by 2002:ac8:4dd5:0:b0:423:e2ff:233e with SMTP id g21-20020ac84dd5000000b00423e2ff233emr44519qtw.5.1702388486226;
Tue, 12 Dec 2023 05:41:26 -0800 (PST)
X-Received: by 2002:a05:6830:4488:b0:6d9:e844:f38 with SMTP id
r8-20020a056830448800b006d9e8440f38mr5955720otv.2.1702388485497; Tue, 12 Dec
2023 05:41:25 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.linux.advocacy
Date: Tue, 12 Dec 2023 05:41:25 -0800 (PST)
In-Reply-To: <s1ZdN.9636$xHn7.2886@fx14.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=67.149.153.65; posting-account=VHdvsQoAAAB0SHzFot62NmvVr15syA7-
NNTP-Posting-Host: 67.149.153.65
References: <E6jdN.7678$83n7.58@fx18.iad> <179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>
<s1ZdN.9636$xHn7.2886@fx14.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b40a8c0c-9e82-44f7-acf0-71b46374089en@googlegroups.com>
Subject: Re: Ping Feeb: borked random number distributions
From: lordiemassa@gmail.com (Lord Master)
Injection-Date: Tue, 12 Dec 2023 13:41:26 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2353
 by: Lord Master - Tue, 12 Dec 2023 13:41 UTC

On Tuesday, December 12, 2023 at 8:15:09 AM UTC-5, DFS wrote:

> You "chose" because of your inability to pass in a year-range:
>
> 2021,2025
>

Wrong yet again. I "chose" because that's the correct and proper way to do it.
The stupid string "20xx" means nothing in the digital context. Computer systems
are designed to deal with time as numbers of seconds from epoch.

You program like a fucking dress maker.

>
> (without installing libbsd-dev your code wouldn't compile on my Ubuntu
> install running on WSL. After installing the library, it still throws
> warning "implicit declaration of function ‘arc4random_uniform’")
>

What kind of shit, FUBAR system are you using?

That's what the first definition is for:

#define _GNU_SOURCE

The arc4random_uniform() function is a GNU extension and it requires that
definition.

Moreover, it does NOT require libbsd. That's why you got that stupid oddball
warning in the first place.

You program like a fucking dress maker.

You'll never get anywhere with anything.

Re: Ping Feeb: borked random number distributions

<a6d7c7b5-efae-49ba-a7e0-89bb167e4190n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5621&group=comp.os.linux.advocacy#5621

  copy link   Newsgroups: comp.os.linux.advocacy
X-Received: by 2002:a05:622a:181b:b0:425:4bef:a6ec with SMTP id t27-20020a05622a181b00b004254befa6ecmr44616qtc.8.1702389427412;
Tue, 12 Dec 2023 05:57:07 -0800 (PST)
X-Received: by 2002:a05:6830:43a8:b0:6d9:d867:1149 with SMTP id
s40-20020a05683043a800b006d9d8671149mr4990667otv.5.1702389427213; Tue, 12 Dec
2023 05:57:07 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.linux.advocacy
Date: Tue, 12 Dec 2023 05:57:06 -0800 (PST)
In-Reply-To: <s1ZdN.9636$xHn7.2886@fx14.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=67.149.153.65; posting-account=VHdvsQoAAAB0SHzFot62NmvVr15syA7-
NNTP-Posting-Host: 67.149.153.65
References: <E6jdN.7678$83n7.58@fx18.iad> <179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>
<s1ZdN.9636$xHn7.2886@fx14.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a6d7c7b5-efae-49ba-a7e0-89bb167e4190n@googlegroups.com>
Subject: Re: Ping Feeb: borked random number distributions
From: lordiemassa@gmail.com (Lord Master)
Injection-Date: Tue, 12 Dec 2023 13:57:07 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2071
 by: Lord Master - Tue, 12 Dec 2023 13:57 UTC

> --------------------------------------------------------------
> $ gcc -Wall speedtest_random_dates.c -o speeddates -lbsd
>

OMFG! It's hard to believe that anybody could fuck this up so
fucking much!

Where the hell did that "-lbsd" shit come from?

Libbsd is NOT needed! Total idiot!

>
> 2000000 DFS dates generated in 0.25 seconds
> 2000000 Feeb dates generated in 1.72 seconds
> done
> --------------------------------------------------------------
>

This is also fucked up to high heaven.

The arc4random_uniform() requires system entropy in order to function.
On that piece-of-shit Microslop/Ubuntu set-up the entropy must be FUBAR
along with everything else.

You program like a fucking dress maker.

Furthermore, stay away from my fantastic, inimitable code. I don't want
a demented imbecile using even small parts of it.

Re: Ping Feeb: borked random number distributions

<lRZdN.20176$p%Mb.8126@fx15.iad>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5622&group=comp.os.linux.advocacy#5622

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.cmpublishers.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx15.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Betterbird (Windows)
From: nospam@dfs.com (DFS)
Subject: Re: Ping Feeb: borked random number distributions
Newsgroups: comp.os.linux.advocacy
References: <E6jdN.7678$83n7.58@fx18.iad>
<179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>
<s1ZdN.9636$xHn7.2886@fx14.iad>
<b40a8c0c-9e82-44f7-acf0-71b46374089en@googlegroups.com>
Content-Language: en-US
In-Reply-To: <b40a8c0c-9e82-44f7-acf0-71b46374089en@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 72
Message-ID: <lRZdN.20176$p%Mb.8126@fx15.iad>
X-Complaints-To: abuse@blocknews.net
NNTP-Posting-Date: Tue, 12 Dec 2023 14:10:25 UTC
Organization: blocknews - www.blocknews.net
Date: Tue, 12 Dec 2023 09:10:25 -0500
X-Received-Bytes: 3091
 by: DFS - Tue, 12 Dec 2023 14:10 UTC

On 12/12/2023 8:41 AM, Lord Master wrote:
> On Tuesday, December 12, 2023 at 8:15:09 AM UTC-5, DFS wrote:
>
>> You "chose" because of your inability to pass in a year-range:
>>
>> 2021,2025
>>
>
> Wrong yet again. I "chose" because that's the correct and proper way to do it.
> The stupid string "20xx" means nothing in the digital context. Computer systems
> are designed to deal with time as numbers of seconds from epoch.

wtf? epoch +- N years is NOT the right way to generate random dates in
a range.

You did it like a newb because you're too LAME to do it right: accept a
starting and ending year.

> You program like a fucking dress maker.

You mewled "If you want more, then put it in a loop yourself" because
you didn't know how to do it in a loop.

Nor do you know how to generate rands for a range, or write them to a
file, or to a database, or speedtest them, or measure their dispersion,
or do anything more than generate ONE random date at a time via
copy/pasting a few lines you found on a website that you pretend you wrote.

You have extremely weak programming skills, but you're a decent plagiarizer.

>> (without installing libbsd-dev your code wouldn't compile on my Ubuntu
>> install running on WSL. After installing the library, it still throws
>> warning "implicit declaration of function ‘arc4random_uniform’")
>>
>
> What kind of shit, FUBAR system are you using?

Linux.

> That's what the first definition is for:
>
> #define _GNU_SOURCE
>
> The arc4random_uniform() function is a GNU extension and it requires that
> definition.

> Moreover, it does NOT require libbsd. That's why you got that stupid oddball
> warning in the first place.

I installed libbsd AFTER your code threw that warning and failed to
compile. Someone online said it worked for them.

But it may have been due to the state of my new Ubuntu install.

> You program like a fucking dress maker.
>
> You'll never get anywhere with anything.

Get real. You claim to be a "C Programmer Extraordinaire" and in real
life you've gotten absolutely NOWHERE with C. Or perl. Or assembly.

Lucky you have Access and VBA to muddle through with.

Re: Ping Feeb: borked random number distributions

<f87154c5-52fe-45d4-9d8b-dde79da17a54n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5623&group=comp.os.linux.advocacy#5623

  copy link   Newsgroups: comp.os.linux.advocacy
X-Received: by 2002:a05:620a:2989:b0:76d:e9c0:9109 with SMTP id r9-20020a05620a298900b0076de9c09109mr42363qkp.7.1702392295905;
Tue, 12 Dec 2023 06:44:55 -0800 (PST)
X-Received: by 2002:a05:6830:4104:b0:6d9:ebbe:6602 with SMTP id
w4-20020a056830410400b006d9ebbe6602mr6226189ott.1.1702392295763; Tue, 12 Dec
2023 06:44:55 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.linux.advocacy
Date: Tue, 12 Dec 2023 06:44:55 -0800 (PST)
In-Reply-To: <lRZdN.20176$p%Mb.8126@fx15.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=67.149.153.65; posting-account=VHdvsQoAAAB0SHzFot62NmvVr15syA7-
NNTP-Posting-Host: 67.149.153.65
References: <E6jdN.7678$83n7.58@fx18.iad> <179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>
<s1ZdN.9636$xHn7.2886@fx14.iad> <b40a8c0c-9e82-44f7-acf0-71b46374089en@googlegroups.com>
<lRZdN.20176$p%Mb.8126@fx15.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f87154c5-52fe-45d4-9d8b-dde79da17a54n@googlegroups.com>
Subject: Re: Ping Feeb: borked random number distributions
From: lordiemassa@gmail.com (Lord Master)
Injection-Date: Tue, 12 Dec 2023 14:44:55 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1855
 by: Lord Master - Tue, 12 Dec 2023 14:44 UTC

On Tuesday, December 12, 2023 at 9:10:30 AM UTC-5, DFS wrote:

>
> wtf? epoch +- N years is NOT the right way to generate random dates in
> a range.
>

Post your retarded ideas on comp.lang.c and you will get ridiculed to death..

Well, actually you won't. Those people are far too inhibited to give you what
you deserve.

Unfortunately, C.O.L.A. does not contain any highly competent programmers
(other than myself) to tell you exactly what an abysmally stupid freak you
really are.

Re: No one is doing: "Rand%MaxRand" (modulo).

<ula11n$3n9dn$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5625&group=comp.os.linux.advocacy#5625

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: no@thanks.net (candycanearter07)
Newsgroups: comp.os.linux.advocacy
Subject: Re: No one is doing: "Rand%MaxRand" (modulo).
Date: Tue, 12 Dec 2023 10:16:55 -0600
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <ula11n$3n9dn$2@dont-email.me>
References: <E6jdN.7678$83n7.58@fx18.iad>
<179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>
<ul7s53$3abd8$1@dont-email.me> <Jeff-Relf.Me@Dec.11--1.06pm.Seattle.2023>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 12 Dec 2023 16:16:55 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="49c4735c6ef748ed9d08bcc966f28c9d";
logging-data="3909047"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19yjE+mj8CcjXjjv9MWHZw8oG5oDKkPrKqA4kk/+kGxPQ=="
User-Agent: Betterbird (Linux)
Cancel-Lock: sha1:JG1oZTjB3P1gDvOMGEGbnQ5CL9c=
In-Reply-To: <Jeff-Relf.Me@Dec.11--1.06pm.Seattle.2023>
Content-Language: en-US
 by: candycanearter07 - Tue, 12 Dec 2023 16:16 UTC

On 12/11/23 15:06, Relf wrote:
> DetroitsFinest:
>>> Firstly, we need a PRNG that does not exhibit modulo bias.
>
> Why ? no one is doing: "Rand%MaxRand" (modulo).
>
> "arc4random_uniform()" has more precision ( 32 bits, instead of 15 ).
> How does that help ?

Some people are bothered by modulo not having an equal chance to roll
each number, it tends to lower ones slightly. I don't personally care
but eh.

> Arter:

If you're going to shorten my name, I'd prefer candy or candycane

>> Well, I learned something.
>
> Did you ? Really ?

Yeah, I didn't know about the arc4 stuff. Seems useful, even if I don't
need it.
--
user <candycane> is generated from /dev/urandom

Re: Ping Feeb: borked random number distributions

<2G0eN.24756$Wp_8.6791@fx17.iad>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5626&group=comp.os.linux.advocacy#5626

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx17.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Betterbird (Windows)
Subject: Re: Ping Feeb: borked random number distributions
Newsgroups: comp.os.linux.advocacy
References: <E6jdN.7678$83n7.58@fx18.iad>
<179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>
<s1ZdN.9636$xHn7.2886@fx14.iad>
<b40a8c0c-9e82-44f7-acf0-71b46374089en@googlegroups.com>
<lRZdN.20176$p%Mb.8126@fx15.iad>
<f87154c5-52fe-45d4-9d8b-dde79da17a54n@googlegroups.com>
Content-Language: en-US
From: nospam@dfs.com (DFS)
In-Reply-To: <f87154c5-52fe-45d4-9d8b-dde79da17a54n@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 45
Message-ID: <2G0eN.24756$Wp_8.6791@fx17.iad>
X-Complaints-To: abuse@blocknews.net
NNTP-Posting-Date: Tue, 12 Dec 2023 17:23:10 UTC
Organization: blocknews - www.blocknews.net
Date: Tue, 12 Dec 2023 12:23:11 -0500
X-Received-Bytes: 2356
 by: DFS - Tue, 12 Dec 2023 17:23 UTC

On 12/12/2023 9:44 AM, Lord Master wrote:
> On Tuesday, December 12, 2023 at 9:10:30 AM UTC-5, DFS wrote:
>
>>
>> wtf? epoch +- N years is NOT the right way to generate random dates in
>> a range.
>>
>
> Post your retarded ideas on comp.lang.c and you will get ridiculed to death.

"Select a time span around the Unix epoch"
"I have chosen a hundred year range"

LMFAO!!!!

The job is to generate random dates in any user-specified year range
begin..end, not start at 1970 and go +/- N years.

The result of generating 10M random dates with your 100-year shit-code
is dates between 1870-01-24 and 2069-12-05.

OMFG! What a fucking idiot.

You did it your bogus way because you didn't know how to set a start and
end year. Meaning the webpage you copied from didn't have such an example.

> Well, actually you won't. Those people are far too inhibited to give you what
> you deserve.

They're not inhibited. They're normal, helpful, decent people not angry
with the world like you are.

> Unfortunately, C.O.L.A. does not contain any highly competent programmers
> (other than myself) to tell you exactly what an abysmally stupid freak you
> really are.

Why do you think you're competent if you can't answer the actual
question ("What do you use to get random numbers in a range?"), but
instead try to morph it into something else and "solve" that?

Re: Ping Feeb: borked random number distributions

<d2904788-454e-49ff-8a5d-cb1a098efe18n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5627&group=comp.os.linux.advocacy#5627

  copy link   Newsgroups: comp.os.linux.advocacy
X-Received: by 2002:ad4:4f0f:0:b0:67e:f49d:ef69 with SMTP id fb15-20020ad44f0f000000b0067ef49def69mr1088qvb.1.1702403342284;
Tue, 12 Dec 2023 09:49:02 -0800 (PST)
X-Received: by 2002:a05:6830:441f:b0:6d9:d197:34af with SMTP id
q31-20020a056830441f00b006d9d19734afmr6046693otv.0.1702403342074; Tue, 12 Dec
2023 09:49:02 -0800 (PST)
Path: i2pn2.org!i2pn.org!news.nntp4.net!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.linux.advocacy
Date: Tue, 12 Dec 2023 09:49:01 -0800 (PST)
In-Reply-To: <2G0eN.24756$Wp_8.6791@fx17.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=67.149.153.65; posting-account=VHdvsQoAAAB0SHzFot62NmvVr15syA7-
NNTP-Posting-Host: 67.149.153.65
References: <E6jdN.7678$83n7.58@fx18.iad> <179fe127d19c3001$76784$2194212$802601b3@news.usenetexpress.com>
<s1ZdN.9636$xHn7.2886@fx14.iad> <b40a8c0c-9e82-44f7-acf0-71b46374089en@googlegroups.com>
<lRZdN.20176$p%Mb.8126@fx15.iad> <f87154c5-52fe-45d4-9d8b-dde79da17a54n@googlegroups.com>
<2G0eN.24756$Wp_8.6791@fx17.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d2904788-454e-49ff-8a5d-cb1a098efe18n@googlegroups.com>
Subject: Re: Ping Feeb: borked random number distributions
From: lordiemassa@gmail.com (Lord Master)
Injection-Date: Tue, 12 Dec 2023 17:49:02 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2491
 by: Lord Master - Tue, 12 Dec 2023 17:49 UTC

On Tuesday, December 12, 2023 at 12:23:15 PM UTC-5, DFS wrote:

>
> The job is to generate random dates in any user-specified year range
> begin..end, not start at 1970 and go +/- N years.
>

I don't give a flying fuck about "the job." I gave an example of the correct
way to do it that can be applied to any situation.

If given a year as a string, e.g. "2020", then simply convert this string value
into the Unix time and go from there.

I won't show you how to do this. Let's see if you can figure it out.

The GNU C Library contains comprehensive facilities for processing time data
and these facilities automatically compensate for leap years, time zones, and
even leap seconds.

Only an idiot like you wastes effort by clumsily writing code to check for leap
years. Ahahahahaha! What a chump!

You also quite likely NEVER heard of Julian Dates or Modified Julian Dates
before I mentioned them in this thread. Again, that just shows how far removed
you actually are from the art of programming.

Pages:123456789
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor