Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ping Feeb: borked random number distributions

372 views
Skip to first unread message

DFS

unread,
Dec 10, 2023, 8:33:31 AM12/10/23
to

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?

Diego Garcia

unread,
Dec 10, 2023, 9:27:10 AM12/10/23
to
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!

Relf

unread,
Dec 10, 2023, 12:19:33 PM12/10/23
to
> 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 ) )

> it returns month = 2 too often https://imgur.com/a/yQHDyXf
> Any ideas ?

Use (__int64) Seconds Since The Start of 1970, "localtime()" & "mktime()".

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

#define Rand( Min, Max ) ( Min + ( Max - Min )*rand()/RAND_MAX )

Physfitfreak

unread,
Dec 10, 2023, 2:10:00 PM12/10/23
to
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 :)


Physfitfreak

unread,
Dec 10, 2023, 2:31:19 PM12/10/23
to
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.


DFS

unread,
Dec 10, 2023, 3:43:04 PM12/10/23
to
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

Relf

unread,
Dec 10, 2023, 6:04:37 PM12/10/23
to
> 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

Physfitfreak

unread,
Dec 10, 2023, 7:31:32 PM12/10/23
to
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.


vallor

unread,
Dec 10, 2023, 7:38:19 PM12/10/23
to
On Sun, 10 Dec 2023 15:04:27 -0800 (Seattle), "Relf"
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

vallor

unread,
Dec 10, 2023, 8:22:44 PM12/10/23
to
On Mon, 11 Dec 2023 00:38:14 -0000 (UTC), vallor <val...@cultnix.org>
wrote in <ul5llm$2s7iu$1...@dont-email.me>:
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

Relf

unread,
Dec 10, 2023, 8:34:48 PM12/10/23
to
> you can get an int64_t integer definition from #include <stdint.h>

Normally, I write "i64 i ;" ( typedef __int64 i64 ).

> "( time_t * ) &RandTime"
> Why not make those variables "time_t" in the first place?

"i64" (signed) prevents _RIDICULOUS_ compile time errors;
ChrisV might prefer "time_t".

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

Because that's what my "Visual C console" expects, to test the code.

UTF-16 is _EASIER_ to work with ( more readable, when debugging );
UTF-32 would be even easier, especially when handling emojis.

Relf

unread,
Dec 10, 2023, 9:24:23 PM12/10/23
to
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.

vallor

unread,
Dec 10, 2023, 9:47:03 PM12/10/23
to
On Sun, 10 Dec 2023 18:24:12 -0800 (Seattle), "Relf"
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

Chris Ahlstrom

unread,
Dec 11, 2023, 8:12:09 AM12/11/23
to
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.

DFS

unread,
Dec 11, 2023, 8:54:22 AM12/11/23
to
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
...

Relf

unread,
Dec 11, 2023, 11:27:48 AM12/11/23
to
You (DFS) replied ( to me ):
> > #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).

Right, it should've been: "float( Max - Min )*rand()/RAND_MAX".

wchar_t Out[ 400 ], *D = Out; __int64 RandDay, RandTime, Min, Max ;
tm rRandTime, rTimeB = {}, rTimeE ;
float TotalSeconds, TotalDays, SecsPerDay = 24.*60*60 ;
const int StartYear = 2023, Years = 4, szBucket = 15*Years ;
rTimeB.tm_mday = 1, rTimeB.tm_year = StartYear - 1900, rTimeB.tm_isdst = -1 ;
rTimeE = rTimeB, rTimeE.tm_year += Years ;
Min = mktime( &rTimeB ), Max = mktime( &rTimeE );
TotalDays = TotalSeconds = Max - Min, TotalDays /= SecsPerDay ;
const int iterations = TotalDays/szBucket ;
int Bucket[366*Years/szBucket] = {};

LoopJ(2000000) { RandTime = RandDay = TotalSeconds*rand()/RAND_MAX, RandTime += Min ;
RandDay /= SecsPerDay, rRandTime = *localtime( ( time_t * ) &RandTime );
Bucket[ RandDay/szBucket ]++ ; }

LoopK(iterations) D += swprintf( D, L"%5d, ", Bucket[ K ] ); Sh( L"%s\n\n", Out );

// Output, each bucket holds 60 days (15*Years):
//
// 82306, 82091, 82080, 81876, 81668, 82360, 81806, 81960, 82504, 82301, 82502, 82043
// 82024, 81927, 82602, 82453, 81705, 82287, 82075, 82423, 82414, 82181, 82161, 81711

Farley Flud

unread,
Dec 11, 2023, 3:32:29 PM12/11/23
to
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!

candycanearter07

unread,
Dec 11, 2023, 3:41:12 PM12/11/23
to
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

Relf

unread,
Dec 11, 2023, 4:07:03 PM12/11/23
to
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 ?

Arter:
> Well, I learned something.

Did you ? Really ?

%

unread,
Dec 11, 2023, 4:40:03 PM12/11/23
to
.

it said snip so i did

Physfitfreak

unread,
Dec 11, 2023, 7:16:26 PM12/11/23
to
Show me the 3D distribution of a few thousand output numbers and I'd be
able to evaluate it. You would too :)





Physfitfreak

unread,
Dec 11, 2023, 7:46:22 PM12/11/23
to
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.


Relf

unread,
Dec 11, 2023, 7:56:16 PM12/11/23
to
Chris_Ahlstrom:
> 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.
> rand() is good enough for light randomizing.

No output, we can't see any results.

Farley Flud

unread,
Dec 12, 2023, 3:35:27 AM12/12/23
to
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


DFS

unread,
Dec 12, 2023, 8:15:09 AM12/12/23
to
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


Lord Master

unread,
Dec 12, 2023, 8:41:28 AM12/12/23
to
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.

Lord Master

unread,
Dec 12, 2023, 8:57:09 AM12/12/23
to
> --------------------------------------------------------------
> $ 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.

DFS

unread,
Dec 12, 2023, 9:10:30 AM12/12/23
to
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.

Lord Master

unread,
Dec 12, 2023, 9:44:58 AM12/12/23
to
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.

candycanearter07

unread,
Dec 12, 2023, 11:17:00 AM12/12/23
to
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.

DFS

unread,
Dec 12, 2023, 12:23:15 PM12/12/23
to
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?


Lord Master

unread,
Dec 12, 2023, 12:49:04 PM12/12/23
to
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.

DFS

unread,
Dec 12, 2023, 1:21:58 PM12/12/23
to
On 12/12/2023 8:57 AM, Lord Master wrote:
>> --------------------------------------------------------------
>> $ 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!


If I don't link libbsd-dev, it won't compile:

Feeb_rand_dates.c: In function ‘main’:
Feeb_rand_dates.c:64:33: warning: implicit declaration of function
‘arc4random_uniform’ [-Wimplicit-function-declaration]
64 | mjd = ((time_t)(arc4random_uniform(365*yrs*2))
- (time_t)(365*yrs)) * (time_t)86400;
| ^~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccopYmAb.o: in function `main':
Feeb_rand_dates.c:(.text+0x1ed): undefined reference to `arc4random_uniform'
collect2: error: ld returned 1 exit status


If I do link it, I just get the warning and it does compile and runs
cleanly.



>> 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.

Must it?

It's a regular old Linux environment, with a full Linux kernel.

Linux DESKTOP-MJUDRC5 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct
5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

$ cat /proc/sys/kernel/random/poolsize
256

$ cat /proc/sys/kernel/random/entropy_avail
256



> You program like a fucking dress maker.

Someone has to make your dresses. And somebody has to test your shit-code.


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

You don't want your borked programming exposed.

Relf

unread,
Dec 12, 2023, 1:56:35 PM12/12/23
to
DetroitsFinest wrote: "365*yrs".

A year is not 365 days.

const int StartYear = 2023, Years = 4 ;
const float SecsPerDay = 24.*60*60 ;

tm rTimeB = {}, rTimeE ;
rTimeB.tm_mday = 1, rTimeB.tm_year = StartYear - 1900, rTimeB.tm_isdst = -1 ;
rTimeE = rTimeB, rTimeE.tm_year += Years ;

const __int64 Min = mktime( &rTimeB ), Max = mktime( &rTimeE );

const float TotalDays = ( Max - Min )/ SecsPerDay ;

Lord Master

unread,
Dec 12, 2023, 1:58:52 PM12/12/23
to
On Tuesday, December 12, 2023 at 1:21:58 PM UTC-5, DFS wrote:
> >
> > Libbsd is NOT needed! Total idiot!
> If I don't link libbsd-dev, it won't compile:
>

Then just add:

#include <stdlib.h>

Now don't bother me. I hate having to babysit totally incompetent idiots
that have the atrocious sense of running GNU/Linux on Microslop.

>
> $ cat /proc/sys/kernel/random/poolsize
> 256
>
> $ cat /proc/sys/kernel/random/entropy_avail
> 256
>

Holy moley! On a real GNU/Linux system the pool would use the Intel
rdrand to increase entropy blazingly fast.

In that case, my wonderful and fantastic code would be done in a miilisecond.

Relf

unread,
Dec 12, 2023, 2:11:53 PM12/12/23
to
DetroitsFinest wrote:
> my wonderful and fantastic code would be done in a miilisecond.

Eliminate all of your pointless code & it'd run even faster.

Lord Master

unread,
Dec 12, 2023, 2:12:31 PM12/12/23
to
On Tuesday, December 12, 2023 at 1:56:35 PM UTC-5, Relf wrote:

>
> A year is not 365 days.
>

And your fucking brain is not even 365 brain cells.

Butt out and drop dead.

Joel

unread,
Dec 12, 2023, 2:13:30 PM12/12/23
to
Lord Master <lordi...@gmail.com> wrote:

>Microslop


I find it funny that a guy resorting to Google Groups for some
unexplained reason is so quick to imply that Microsoft doesn't have
high standards for their code, they actually do, with specific
exceptions in the past (including the 2019-2020 Win10 era, when I was
wisely not using the POS), it's just not a platform to stay with
upgrades on, whereas Linux is. Windows 13 would outgrow the machine I
have now, I'd be stuck with 12. It's just crapware, from my point of
view, Linux will be with me till the end of the age.

--
Joel W. Crump

Amendment XIV
Section 1.

[...] No state shall make or enforce any law which shall
abridge the privileges or immunities of citizens of the
United States; nor shall any state deprive any person of
life, liberty, or property, without due process of law;
nor deny to any person within its jurisdiction the equal
protection of the laws.

Dobbs rewrites this, it is invalid precedent. States are
liable for denying needed abortions, e.g. TX.

Chris Ahlstrom

unread,
Dec 12, 2023, 3:04:39 PM12/12/23
to
Relf wrote this copyrighted missive and expects royalties:
Not my problem.

--
Kindness is a language which the deaf can hear and the blind can read.
-- Mark Twain

Chris Ahlstrom

unread,
Dec 12, 2023, 3:09:43 PM12/12/23
to
Physfitfreak wrote this copyrighted missive and expects royalties:

> 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++:
>>
>> 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;
>>
>> 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 :)

Nah, I already know it has an error. One of these days I will fix it but for
now it works well enough for the basic purposes of my app (jittering MIDI
time-stamps and note amplitudes).

My main point here is that the C++ standard supports a hella randomization
options.

--
It is often the case that the man who can't tell a lie thinks he is the best
judge of one.
-- Mark Twain, "Pudd'nhead Wilson's Calendar"

RabidPedagog

unread,
Dec 12, 2023, 5:09:51 PM12/12/23
to
On 12/12/23 14:13, Joel wrote:
> Lord Master <lordi...@gmail.com> wrote:
>
>> Microslop
>
>
> I find it funny that a guy resorting to Google Groups for some
> unexplained reason is so quick to imply that Microsoft doesn't have
> high standards for their code, they actually do, with specific
> exceptions in the past (including the 2019-2020 Win10 era, when I was
> wisely not using the POS), it's just not a platform to stay with
> upgrades on, whereas Linux is. Windows 13 would outgrow the machine I
> have now, I'd be stuck with 12. It's just crapware, from my point of
> view, Linux will be with me till the end of the age.

If your means are limited, there is nothing wrong with using Linux. I
often jump into Linux to check whether hardware is faulty or not. I
figure if it doesn't work in Windows, there are lots of reasons; if it
doesn't work in Linux, either it's either not supported or merely
defective.

DFS

unread,
Dec 12, 2023, 5:44:52 PM12/12/23
to
On 12/12/2023 12:49 PM, Lord Master wrote:
> 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."

You should. You would've learned something.



> I gave an example of the correct
> way to do it that can be applied to any situation.

There is no "correct way".



> 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.

tut tut bozo: you have 5 simpleton challenges hanging over your dense
head before I EVER answer another code challenge from you.



> 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!


How do you determine leap years in your code?



> You also quite likely NEVER heard of Julian Dates or Modified Julian Dates
> before I mentioned them in this thread.

Used Oracle's TO_DATE() and TO_CHAR() functions to work with J dates at
least 20 years ago.

More recently, using SQLite's julianday() and VBA's DatePart().



> Again, that just shows how far removed
> you actually are from the art of programming.

It just shows you making yet another stupid, incorrect assumption.

Physfitfreak

unread,
Dec 12, 2023, 7:14:33 PM12/12/23
to
On 12/12/2023 12:56 PM, Relf wrote:
> const int StartYear = 2023, Years = 4 ;
> const float SecsPerDay = 24.*60*60 ;


Puh... Depends on whether you take it as a sidereal day or a solar day,
you Subject header changer moron.

Physfitfreak

unread,
Dec 12, 2023, 7:42:38 PM12/12/23
to
Wouldn't any pattern among the sequence suggest a departure from the
randomness of such numbers?

And again - right or wrong! - you get my vote only if you show me a
uniform distribution of dots in a 3D plot, created by that generator. I
won't buy anything else :)

If your 3D distribution show extra concentrations on any surface, on any
line, or around any point or points in that plot, then your generator
doesn't provide random enough numbers. It can quickly be modeled, and a
little software can use that model to predict your generator's results.

Then your missile is hit and destroyed before reaching its target :)






Physfitfreak

unread,
Dec 12, 2023, 7:44:42 PM12/12/23
to
On 12/12/2023 8:10 AM, DFS wrote:
> 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.


What an ill-informed nonsense to say. God I'm still discovering more
holes in this person's female brain space. Just what are you? Is that
what every Nazi was and is, or is it just you who're that dumb? ...

A more powerful programming language doesn't make a programmer a better
programmer.

I did anything I wanted, and did it perfectly well, using VBA. It's the
programmer that counts, not the language. VBA is just BASIC. Consider it
another flavor of "Simon's BASIC" :)

Nazis obey orders and shut up. So it must be your female brain that's so
talkative.



Physfitfreak

unread,
Dec 12, 2023, 7:51:29 PM12/12/23
to
But a few weeks back I had to test it on Windows to find out a device
was bad. Linux didn't give me a clue. It only had complicated the matters.

Physfitfreak

unread,
Dec 12, 2023, 7:52:44 PM12/12/23
to
I haven't tried them, but I don't think any of them is perfect. Some
must be better and some worse. Also, the concept of "random number"
itself means different things in some of its applications under other
contexts. Everything discussed here so far pertains only one type of
random number generator that gives numbers equally probable to get
chosen from a set range.


RonB

unread,
Dec 12, 2023, 11:57:50 PM12/12/23
to
If your means are NOT limited there is nothing wrong with Linux. Especially
if you don't play video games and aren't married to Microsoft Office.

--
"Evil preaches tolerance until it is dominant, then it tries to silence good."
-- Archbishop Charles J. Chaput

RonB

unread,
Dec 13, 2023, 12:04:53 AM12/13/23
to
Yeah, but you were plugging your monitor into the built-in Intel video port
and were trying to get the add-on (and defective) nVidia video card
installed. So installing drivers for a defective video card is not going to
work. Not even close to being a fault in Linux.

Farley Flud

unread,
Dec 13, 2023, 4:10:23 AM12/13/23
to
On Tue, 12 Dec 2023 18:42:34 -0600, Physfitfreak wrote:

>
> And again - right or wrong! - you get my vote only if you show me a
> uniform distribution of dots in a 3D plot, created by that generator. I
> won't buy anything else :)
>

It passes the Dieharder tests:

https://webhome.phy.duke.edu/~rgb/General/dieharder.php

The Dieharder tests include a test that measures clustering
in up to 52 dimensions -- way above your 3D.

Try it yourself.

But such clustering does not always indicate a lack of
randomness. A truly random sequence of say, UTF-8 chars,
will eventually include all the works of William Shakespeare
as well as all the world's literature.

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

Thus, if you open a book of Shakespeare's plays you are
viewing part pf a random sequence.

Farley Flud

unread,
Dec 13, 2023, 4:55:18 AM12/13/23
to
On Tue, 12 Dec 2023 13:21:54 -0500, DFS wrote:

>
> If I don't link libbsd-dev, it won't compile:
>

I found out the reason, but YOU had the problem and
YOU have found out yourself.

The arc4random() functions first appear in version
2.36 of the GNU C Library, which is over a year ago.

That piece-of-shit Ubuntu system of yours is obviously
using an older glibc.

With GNU/Linux, one has to keep up to date or else,
like you, one is going to be left behind.

Farley Flud

unread,
Dec 13, 2023, 5:03:47 AM12/13/23
to
On Tue, 12 Dec 2023 17:44:49 -0500, DFS wrote:

>
>> You also quite likely NEVER heard of Julian Dates or Modified Julian Dates
>> before I mentioned them in this thread.
>
> Used Oracle's TO_DATE() and TO_CHAR() functions to work with J dates at
> least 20 years ago.
>
> More recently, using SQLite's julianday() and VBA's DatePart().
>

OMG! The fails just keep on coming!

Those functions refer the the Julian "Day," which is a number
from 1 - 365.

I am referring the the Julian "Date," which is something entirely
different:

https://aa.usno.navy.mil/data/JulianDate

Chris Ahlstrom

unread,
Dec 13, 2023, 6:43:28 AM12/13/23
to
Random numbers are too important to be left to chance.

https://cplusplus.com/reference/random/

Refers to almost 20 random distribution generators, such as Poisson and Cauchy.

The rub is using them correctly!

--
Try the Moo Shu Pork. It is especially good today.

Chris Ahlstrom

unread,
Dec 13, 2023, 6:48:43 AM12/13/23
to
RabidPedagog wrote this copyrighted missive and expects royalties:

> On 12/12/23 14:13, Joel wrote:
>> Lord Master <lordi...@gmail.com> wrote:
>>
>>> Microslop
>>
>> I find it funny that a guy resorting to Google Groups for some
>> unexplained reason is so quick to imply that Microsoft doesn't have
>> high standards for their code, they actually do, with specific
>> exceptions in the past (including the 2019-2020 Win10 era, when I was
>> wisely not using the POS), it's just not a platform to stay with
>> upgrades on, whereas Linux is. Windows 13 would outgrow the machine I
>> have now, I'd be stuck with 12. It's just crapware, from my point of
>> view, Linux will be with me till the end of the age.
>
> If your means are limited, there is nothing wrong with using Linux.

If your means are not limited, there is nothing wrong with using Linux.
And frankly, I like the environtment a lot. Even at this late date,
Microsoft's flagship desktop OS still merits the name of "Windoze".

With Linux, I never feel the need to "click twice".

> I often jump into Linux to check whether hardware is faulty or not. I
> figure if it doesn't work in Windows, there are lots of reasons; if it
> doesn't work in Linux, either it's either not supported or merely
> defective.

Hmmm, maybe I should go to the thrift or pawn shop to get another
laptop for testing.

I have a desktop box in the attack, but the noise!!!

--
Q: What do you have when you have a lawyer buried up to his neck in sand?
A: Not enough sand.

RabidPedagog

unread,
Dec 13, 2023, 8:33:37 AM12/13/23
to
Well, I'm actually trying out the video games part as we speak. Since I
finally finished the Cyberpunk 2077 Phantom Liberty expansion (it turns
out I didn't need my save files after all), I have no attachment to
platforms like GOG in Windows. Also, since Macrium Reflect decided to
fuck up and claim that my computer needed to be repaired when I tried to
restore an image of my Windows 11 installation, I figured I'd just
install Ubuntu 23.10 and test it out a bit. Shockingly, this
distribution feels like it was custom made for my particular laptop. I
can't get a single game to play (Jedi Fallen Order), but it has
everything to do with the Electronic Arts launcher and nothing to do
with Linux. I'm trying out Tiny Tina's Wonderlands as we speak, and it's
running fine as are others I installed through Lutris. It gets a 62fps
with some stuttering, but it'll certainly perform better later on when I
optimize the settings.

Either way, I'll try once again to reload my Windows 11 image later on
but if it fails and claims that my computer needs repairs, I'll just
stick to this. I'm getting a little tired of the constant headaches.

--
@RabidPedagog

DFS

unread,
Dec 13, 2023, 8:38:15 AM12/13/23
to
On 12/13/2023 5:03 AM, Farley Flud wrote:
> On Tue, 12 Dec 2023 17:44:49 -0500, DFS wrote:
>
>>
>>> You also quite likely NEVER heard of Julian Dates or Modified Julian Dates
>>> before I mentioned them in this thread.
>>
>> Used Oracle's TO_DATE() and TO_CHAR() functions to work with J dates at
>> least 20 years ago.
>>
>> More recently, using SQLite's julianday() and VBA's DatePart().
>>
>
> OMG! The fails just keep on coming!
>
> Those functions refer the the Julian "Day," which is a number
> from 1 - 365.

That's the ordinal day, and it ranges from 1-366.


2 UUUUGGGGGE FAAAAIIIILLLLSSSSS!!!!!

RING THE BELL! KEEP RINGING IT UNTIL HE SHUTS THE FUCK UP!




> I am referring the the Julian "Date," which is something entirely
> different:
>
> https://aa.usno.navy.mil/data/JulianDate


"entirely different"? Are you sho'?

"The Julian date (JD) of any instant is the Julian day number plus the
fraction of a day since the preceding noon in Universal Time. Julian
dates are expressed as a Julian day number with a decimal fraction added."

The term Julian date may also refer, outside of astronomy, to the
day-of-year number (more properly, the ordinal date) in the Gregorian
calendar, especially in computer programming, the military and the food
industry,[10] or it may refer to dates in the Julian calendar.



ANOTHER FEEBLE FEEB FAIL!

RING! RING! RING! RING! RING! RING!


RabidPedagog

unread,
Dec 13, 2023, 8:39:01 AM12/13/23
to
On 12/13/23 06:48, Chris Ahlstrom wrote:
> RabidPedagog wrote this copyrighted missive and expects royalties:
>
>> On 12/12/23 14:13, Joel wrote:
>>> Lord Master <lordi...@gmail.com> wrote:
>>>
>>>> Microslop
>>>
>>> I find it funny that a guy resorting to Google Groups for some
>>> unexplained reason is so quick to imply that Microsoft doesn't have
>>> high standards for their code, they actually do, with specific
>>> exceptions in the past (including the 2019-2020 Win10 era, when I was
>>> wisely not using the POS), it's just not a platform to stay with
>>> upgrades on, whereas Linux is. Windows 13 would outgrow the machine I
>>> have now, I'd be stuck with 12. It's just crapware, from my point of
>>> view, Linux will be with me till the end of the age.
>>
>> If your means are limited, there is nothing wrong with using Linux.
>
> If your means are not limited, there is nothing wrong with using Linux.
> And frankly, I like the environtment a lot. Even at this late date,
> Microsoft's flagship desktop OS still merits the name of "Windoze".
>
> With Linux, I never feel the need to "click twice".

I will say this much: Ubuntu 23.10 looks a lot better than Windows 11
does and is a lot faster. Using it also allows me to ignore the constant
Windows-related security reports I read on BleepingComputer.com. It's
not perfect, but everything on this laptop works very well, including
standby and hibernation.

< snip >

--
@RabidPedagog

DFS

unread,
Dec 13, 2023, 8:39:57 AM12/13/23
to
On 12/12/2023 1:58 PM, Lord Master wrote:
> On Tuesday, December 12, 2023 at 1:21:58 PM UTC-5, DFS wrote:
>>>
>>> Libbsd is NOT needed! Total idiot!
>> If I don't link libbsd-dev, it won't compile:
>>
>
> Then just add:
>
> #include <stdlib.h>

It was already included.



> Now don't bother me. I hate having to babysit totally incompetent idiots
> that have the atrocious sense of running GNU/Linux on Microslop.

"They concluded that Ubuntu WSL performance was around 94% the speed of
bare metal Ubuntu on the same system overall."

And the vast majority of what I do in Linux now is console code.

So I'm good.



>> $ cat /proc/sys/kernel/random/poolsize
>> 256
>>
>> $ cat /proc/sys/kernel/random/entropy_avail
>> 256
>>
>
> Holy moley! On a real GNU/Linux system the pool would use the Intel
> rdrand to increase entropy blazingly fast.


> In that case, my wonderful and fantastic code would be done
> in a miilisecond.


Wouldn't it be nice if you could write code like me to prove it?

============================================================================
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

//settings
int dates = 2000000;
int beginYear = 1923;
int endYear = 2023;
int years = 100;

//program timing
double elapsedtime(clock_t start) {
return (clock() - (double)start)/CLOCKS_PER_SEC;
}

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


//DFS
//build random date in format YYYY-MM-DD
//number of days in the month
int mdays[12]={31,28,31,30,31,30,31,31,30,31,30,31};
char *genRandDate(void) {

//get year, then random month, then random day from that month
int ryear = randNbr(beginYear, endYear);
int rmth = randNbr(1,12);
int rday = randNbr(1,mdays[rmth-1]);

//leap year calc - executes only if Feb is chosen
if(rmth == 2) {
if(((ryear%4==0) && (ryear%100!=0)) || (ryear%400==0)) {
rday = randNbr(1,29);
}
}

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


int main(void) {

//Feeb
time_t mjd;
struct tm *local_time;
char rnd_date[20];

//timing-related
clock_t start;

//seed rng
srand(time(NULL));

//speed tests
printf("generating random dates...\n");

//DFS
start = clock();
for (int i=1; i<=dates; i++) {
genRandDate();
}
printf("%d DFS dates generated in %.2f seconds\n", dates,
elapsedtime(start));


//Feeb
start = clock();
for (int i=1; i<=dates; i++) {
mjd = ((time_t)(arc4random_uniform(365*years*2)) -
(time_t)(365*years)) * (time_t)86400;
local_time = localtime(&mjd);
strftime(rnd_date, sizeof(rnd_date), "%F", local_time);
}
printf("%d Feeb dates generated in %.2f seconds\n", dates,
elapsedtime(start));


printf("done\n");
return 0;
}

============================================================================


Multiply or divide whatever you claim by the "Feeb Blab Constant" of
296847 and you get the actual result.

DFS

unread,
Dec 13, 2023, 8:41:52 AM12/13/23
to
On 12/13/2023 4:55 AM, Farley Flud wrote:
> On Tue, 12 Dec 2023 13:21:54 -0500, DFS wrote:
>
>>
>> If I don't link libbsd-dev, it won't compile:
>>
>
> I found out the reason, but YOU had the problem and
> YOU have found out yourself.
>
> The arc4random() functions first appear in version
> 2.36 of the GNU C Library, which is over a year ago.

A year ago?

arc4random() functions were in OpenBSD 2.0, by Oct 1996.

https://www.openbsd.org/plus20.html
"arc4-based random support in kernel"

Why is glibc 26 years behind?

Another GuhNoo FAIL.



> That piece-of-shit Ubuntu system of yours is obviously
> using an older glibc.

$ ldd --version
ldd (Ubuntu GLIBC 2.35-0ubuntu3.5) 2.35



> With GNU/Linux, one has to keep up to date or else,
> like you, one is going to be left behind.

Quit babbling. You still to this day use rand().




DFS

unread,
Dec 13, 2023, 8:59:53 AM12/13/23
to
On 12/13/2023 8:38 AM, RabidPedagog wrote:

> I will say this much: Ubuntu 23.10 looks a lot better than Windows 11
> does and is a lot faster. Using it also allows me to ignore the constant
> Windows-related security reports I read on BleepingComputer.com. It's
> not perfect, but everything on this laptop works very well, including
> standby and hibernation.


Slimer Nov 21:

"*I* *GIVE* *UP
I am going to be formatting every last key I have with Linux on it and I
am quitting this forum. I don't even want to think about this steaming
pile of garbage anymore. It was a fucking routine installation on a
basic computer and even THAT Linux manages to complete screw up.
*I* *GIVE* *UP*"


You barely made it 2 weeks - you're beyond addicted to the stench of
Linux and cola.

Lord Master

unread,
Dec 13, 2023, 9:01:51 AM12/13/23
to
On Wednesday, December 13, 2023 at 8:41:52 AM UTC-5, DFS wrote:
>
> arc4random() functions were in OpenBSD 2.0, by Oct 1996.
>
> https://www.openbsd.org/plus20.html
> "arc4-based random support in kernel"
>
> Why is glibc 26 years behind?
>

Such a comment only further proves (if any proof is necessary) just what
a clueless dolt you actually are.

Glibc is a C library. It includes functions and facilities that are contained
in the C standard, and the standard does not include comprehensive
PRNGs.

C programmers who need a PRNG would always use a library devoted
to the purpose.

The arc4random() functions are actually not POSIX but part of the XPG
standard.

You need SERIOUS remediation. You are totally unfit to function in the
sophisticated GNU/Linux environment.

RabidPedagog

unread,
Dec 13, 2023, 9:31:14 AM12/13/23
to
I might be.

--
@RabidPedagog

Joel

unread,
Dec 13, 2023, 12:04:07 PM12/13/23
to
RabidPedagog <ra...@pedag.og> wrote:

>> [Windows is] just not a platform to stay with
>> upgrades on, whereas Linux is. Windows 13 would outgrow the machine I
>> have now, I'd be stuck with 12. It's just crapware, from my point of
>> view, Linux will be with me till the end of the age.
>
>If your means are limited, there is nothing wrong with using Linux.


It's not just having the means to constantly build new computers, it's
thinking it's sensible. It's insane, is what it is. For me to get
Win13, in the not so distant future, I'd realistically need to retire
this box.

Joel

unread,
Dec 13, 2023, 12:08:37 PM12/13/23
to
It makes no difference, to me, whether I have Windows or Linux. The
difference in what software I use on either is very small.

%

unread,
Dec 13, 2023, 12:41:13 PM12/13/23
to
Joel wrote:
> RonB <ronb02...@gmail.com> wrote:
>> On 2023-12-12, RabidPedagog <ra...@pedag.og> wrote:
>>> On 12/12/23 14:13, Joel wrote:
>>>> Lord Master <lordi...@gmail.com> wrote:
>>>>
>>>>> Microslop
>>>>
>>>> I find it funny that a guy resorting to Google Groups for some
>>>> unexplained reason is so quick to imply that Microsoft doesn't have
>>>> high standards for their code, they actually do, with specific
>>>> exceptions in the past (including the 2019-2020 Win10 era, when I was
>>>> wisely not using the POS), it's just not a platform to stay with
>>>> upgrades on, whereas Linux is. Windows 13 would outgrow the machine I
>>>> have now, I'd be stuck with 12. It's just crapware, from my point of
>>>> view, Linux will be with me till the end of the age.
>>>
>>> If your means are limited, there is nothing wrong with using Linux. I
>>> often jump into Linux to check whether hardware is faulty or not. I
>>> figure if it doesn't work in Windows, there are lots of reasons; if it
>>> doesn't work in Linux, either it's either not supported or merely
>>> defective.
>>
>> If your means are NOT limited there is nothing wrong with Linux. Especially
>> if you don't play video games and aren't married to Microsoft Office.
>
>
> It makes no difference, to me, whether I have Windows or Linux. The
> difference in what software I use on either is very small.
>
i just push the buttons

RonB

unread,
Dec 13, 2023, 7:09:32 PM12/13/23
to
So you've changed from Windows to Linux again on that laptop? Or are just
doing a live USB boot?

Physfitfreak

unread,
Dec 13, 2023, 7:19:15 PM12/13/23
to
On 12/12/2023 8: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.
>
> 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.
>


:-) ...

Don't leave! :) I want you around when I begin to have questions in C++.

Unfortunately, they'll perhaps be tricky or tough ones, but I'm usually
hampered by simple stuff that I don't happen to know or notice or
remember. So don't disappear :)

Every time I began refreshing my C++ skills, the HD crashed and I lost
all the work in them. Then a year or two later, I'd begin another run of
that, starting to remember and learn and use it in some exciting program
on another HD or another computer, and yet again I'd lose it for some
crappy reason.

Right now, one of my unfinished programs, the latest one, is waiting
inside a laptop that doesn't charge anymore because the charging plug on
it is screwed up. I ordered another little plug that came with its own
little wires behind it, and installed it, and brought the computer to
life again. But the plug got screwed up again later, and this time one
of the wires behind it got cut as well while messing with it.

So I got sick of it. It is still there with that unfinished nice program
in C++ which I have forgotten again and need refreshing.

Perhaps the "cloud" guys have a point or two :) But I don't pay to put
my stuff on the cloud. They should pay.



Physfitfreak

unread,
Dec 13, 2023, 7:20:08 PM12/13/23
to
On 12/12/2023 11:23 AM, DFS wrote:
> 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?")


Nobody can perfectly answer that, you cro-magnon pig-head.

Physfitfreak

unread,
Dec 13, 2023, 7:23:26 PM12/13/23
to
That site looks good. I'll bookmark it for later when I get back to my
C++ fun again.

Yes the subject is important. Ultimately, it can make the difference
between being on your own, or being traced. So you just have to test
them on the output side. Nothing else matters unless you happen to want
to improve upon the generators.

Physfitfreak

unread,
Dec 13, 2023, 7:33:24 PM12/13/23
to
I described in another post how a site on the web gave instructions to
install the correct driver for it. I found the driver for that exact
card for Linux, but when I went through the myriad of steps so later I
make a go at it, I found it too crazy to even attempt. I wished I had
that site's link to show you what it said I should do.


DFS

unread,
Dec 13, 2023, 9:16:30 PM12/13/23
to
On 12/12/2023 5:44 PM, DFS wrote:
> On 12/12/2023 12:49 PM, Lord Master wrote:
>>
>> Only an idiot like you wastes effort by clumsily writing code to check
>> for leap
>> years.  Ahahahahaha!  What a chump!
>
>
> How do you determine leap years in your code?


crickets

Relf

unread,
Dec 13, 2023, 11:47:36 PM12/13/23
to
DFS:
> // get random number from within range
> int randNbr(int low, int high) {
> return low + rand()/( RAND_MAX/(high - low + 1) + 1 ); }

That's just wrong; suppose rand() returns RAND_MAX;
& suppose "high - low" == 0; now:

return RAND_MAX/( RAND_MAX + 1 );
// integer divide "0x7fff/0x8000" == 0

This is correct:

#define Rand( Min, Max ) ( Min + float( Max - Min )*rand()/RAND_MAX )

// "rand()/float(RAND_MAX)" returns a float between 0 and 1, inclusive.

DFS:
> Wouldn't it be nice if you could write code like me to prove it?
>
> start = clock(); for (int i=1; i<=dates; i++) genRandDate();
> printf("%d DFS dates generated in %.2f seconds\n", dates,
> elapsedtime(start));

My method costs 0.853 Seconds. What's your time ?

const int NumDates = 2000000, StartYear = 1923, Years = 100, szDate = 12 ;
wchar_t *Out, *D; D = Out = MallocTmp( NumDates*szDate*szChr );
__int64 Sec, TotalSecs, RandSec, Min, Max ;
tm Rec, rTimeB = {}, rTimeE ;
rTimeB.tm_mday = 1, rTimeB.tm_year = StartYear - 1900, rTimeB.tm_isdst = -1 ;
rTimeE = rTimeB, rTimeE.tm_year += Years ;
Min = mktime( &rTimeB ), Max = mktime( &rTimeE ), TotalSecs = Max - Min ;
double Mark = UpSecs ;
LoopJ(NumDates) { Sec = float(TotalSecs)*rand()/RAND_MAX ;
Rec = *localtime( ( time_t * ) &Sec ); D += swprintf( D, L"%d-%02d-%02d, ",
Rec.tm_year + 1900, Rec.tm_mon, Rec.tm_mday ); }

Out[5*szDate] = 0, Sh( L"%.3f Seconds. %s", UpSecs - Mark, Out );

// 0.853 Seconds. 1996-10-12, 2020-10-09, 1971-10-22, 2016-10-28, 1994-06-09

Relf

unread,
Dec 14, 2023, 12:06:04 AM12/14/23
to
Oops, StartYear must be >= 1970, corrections below:

const int NumDates = 2000000, StartYear = 1970, Years = 100, szDate = 12 ;
wchar_t *Out, *D; D = Out = MallocTmp( NumDates*szDate*szChr );
__int64 Sec, TotalSecs, Min, Max ;
tm Rec, rTimeB = {}, rTimeE ;
rTimeB.tm_mday = 1, rTimeB.tm_year = StartYear - 1900, rTimeB.tm_isdst = -1 ;
rTimeE = rTimeB, rTimeE.tm_year += Years ;
Min = mktime( &rTimeB ), Max = mktime( &rTimeE ), TotalSecs = Max - Min ;
double Mark = UpSecs ;
LoopJ(NumDates) { Sec = Min + float(TotalSecs)*rand()/RAND_MAX ;
Rec = *localtime( ( time_t * ) &Sec ); D += swprintf( D, L"%d-%02d-%02d, ",
Rec.tm_year + 1900, Rec.tm_mon, Rec.tm_mday ); }

Out[5*szDate] = 0, Sh( L"%.3f Seconds. %s", UpSecs - Mark, Out );

// 0.852 Seconds. 1999-05-09, 2031-06-17, 2021-09-11, 1977-08-11, 2021-02-21,

RonB

unread,
Dec 14, 2023, 3:27:04 AM12/14/23
to
So, exactly, how do you separate out the "cro-magnons" from whatever you
think you are? I assume you believe you're a homo sapien (which is what
cro-magnons were).

Farley Flud

unread,
Dec 14, 2023, 4:49:01 AM12/14/23
to
On Wed, 13 Dec 2023 18:19:11 -0600, Physfitfreak wrote:

>
> Don't leave! :) I want you around when I begin to have questions in C++.
>

I don't use C++(*). It is an "object oriented" language and I do
not approve of the OO concept.

My one-and-only language is C.

C is essentially a short-cut for assembly language. C does not
depart from the actual machine and I think in terms of the
actual machine.

That's why I despise OO and "functional" programming.


(*) C++ means "C plus classes" but it's more OO classes than
C.

Farley Flud

unread,
Dec 14, 2023, 4:54:20 AM12/14/23
to
On Wed, 13 Dec 2023 21:16:27 -0500, DFS wrote:

>>
>> How do you determine leap years in your code?
>
> crickets
>

You need to be deloused. All Microslop supporters
need to be fumigated(*).

You also don't pay attention much.

I previously indicated that leap years are automatically
handled when using the GLIBC time facilities.


(*) "Fumigation" is a euphemism for "gassed."

Chris Ahlstrom

unread,
Dec 14, 2023, 7:29:50 AM12/14/23
to
Farley Flud wrote this copyrighted missive and expects royalties:

> On Wed, 13 Dec 2023 18:19:11 -0600, Physfitfreak wrote:
>
>> Don't leave! :) I want you around when I begin to have questions in C++.
>
> I don't use C++(*). It is an "object oriented" language and I do
> not approve of the OO concept.
>
> My one-and-only language is C.
>
> C is essentially a short-cut for assembly language. C does not
> depart from the actual machine and I think in terms of the
> actual machine.
>
> That's why I despise OO and "functional" programming.

Good luck managing your pointers without RAII :-D

--
In the Spring, I have counted 136 different kinds of weather inside of
24 hours.
-- Mark Twain, on New England weather

Lord Master

unread,
Dec 14, 2023, 7:59:49 AM12/14/23
to
On Thursday, December 14, 2023 at 7:29:50 AM UTC-5, Chris Ahlstrom wrote:

>
> Good luck managing your pointers without RAII :-D
>

That same mindset is what is causing the push for Rust to supplant C
(including in the Linux kernel).

But C will survive and even thrive in spite of it.

RabidPedagog

unread,
Dec 14, 2023, 9:03:27 AM12/14/23
to
On 2023-12-13 12:08 p.m., Joel wrote:
> RonB <ronb02...@gmail.com> wrote:
>> On 2023-12-12, RabidPedagog <ra...@pedag.og> wrote:
>>> On 12/12/23 14:13, Joel wrote:
>>>> Lord Master <lordi...@gmail.com> wrote:
>>>>
>>>>> Microslop
>>>>
>>>> I find it funny that a guy resorting to Google Groups for some
>>>> unexplained reason is so quick to imply that Microsoft doesn't have
>>>> high standards for their code, they actually do, with specific
>>>> exceptions in the past (including the 2019-2020 Win10 era, when I was
>>>> wisely not using the POS), it's just not a platform to stay with
>>>> upgrades on, whereas Linux is. Windows 13 would outgrow the machine I
>>>> have now, I'd be stuck with 12. It's just crapware, from my point of
>>>> view, Linux will be with me till the end of the age.
>>>
>>> If your means are limited, there is nothing wrong with using Linux. I
>>> often jump into Linux to check whether hardware is faulty or not. I
>>> figure if it doesn't work in Windows, there are lots of reasons; if it
>>> doesn't work in Linux, either it's either not supported or merely
>>> defective.
>>
>> If your means are NOT limited there is nothing wrong with Linux. Especially
>> if you don't play video games and aren't married to Microsoft Office.
>
>
> It makes no difference, to me, whether I have Windows or Linux. The
> difference in what software I use on either is very small.

The challenge is to find a distribution with cooperates properly with
your hardware. I have to admit that I could not find fault in Ubuntu
23.10 while I ran it yesterday. One game didn't work - Jedi Fallen Order
- but it was entirely the fault of the developer, not Linux. Another,
Tiny Tina's Wonderlands, ran wonderfully. Thunderbird, Brave and
anything else I ran did so well, even though I was using Snaps and not
Debs. It went to sleep properly, it woke properly, it allowed me to
update the firmware of my devices, the printer set up as it should and
all of my display settings worked as they should. It was also very
pretty, prettier than Windows 11, in my opinion.

RabidPedagog

unread,
Dec 14, 2023, 9:07:56 AM12/14/23
to
I installed because Macrium Reflect's inability to restore the image I
had made of Windows 11 pissed me off (I had installed Windows 10
temporarily to see if a hardware issue was merely related to the driver
or a true hardware issue). I figured that I might as well take the
opportunity to install Ubuntu and see how it's improved. To be very
honest, it's wonderful. It's almost exactly what I would want any
operating system to be like. It actually pained me to reinstall Windows
11 yesterday (mostly to make sure that my purchase of a game didn't end
up being a waste).

candycanearter07

unread,
Dec 14, 2023, 10:41:26 AM12/14/23
to
While I do think C++ is fine/usable, it does have way too much
complexities and too many options (like c arrays vs std::vector vs
std::array vs the maps vs std::deview)
--
user <candycane> is generated from /dev/urandom

Physfitfreak

unread,
Dec 14, 2023, 7:27:39 PM12/14/23
to
Can't C++ be used just as its C subset?

Here we go :) My first question I guess.

Physfitfreak

unread,
Dec 14, 2023, 7:28:18 PM12/14/23
to
On 12/14/2023 2:26 AM, RonB wrote:
> On 2023-12-14, Physfitfreak <Physfi...@gmail.com> wrote:
>> On 12/12/2023 11:23 AM, DFS wrote:
>>> 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?")
>>
>>
>> Nobody can perfectly answer that, you cro-magnon pig-head.
>
> So, exactly, how do you separate out the "cro-magnons" from whatever you
> think you are? I assume you believe you're a homo sapien (which is what
> cro-magnons were).
>


Read my blog in sci.physics.

Physfitfreak

unread,
Dec 14, 2023, 7:29:08 PM12/14/23
to
I don't mind Nazis get gassed :)

RabidPedagog

unread,
Dec 14, 2023, 7:31:48 PM12/14/23
to
Define Nazis. The word has become meaningless over the past decade.

--
@RabidPedagog

Physfitfreak

unread,
Dec 14, 2023, 7:42:44 PM12/14/23
to
A huge part of programming languages are redundant unnecessary load,
placed there by trigger-happy "engineers" after the languages were
created by scientists. Ignore them.


Physfitfreak

unread,
Dec 14, 2023, 7:45:13 PM12/14/23
to
On 12/14/2023 6:29 AM, Chris Ahlstrom wrote:
> Farley Flud wrote this copyrighted missive and expects royalties:
>
>> On Wed, 13 Dec 2023 18:19:11 -0600, Physfitfreak wrote:
>>
>>> Don't leave! :) I want you around when I begin to have questions in C++.
>>
>> I don't use C++(*). It is an "object oriented" language and I do
>> not approve of the OO concept.
>>
>> My one-and-only language is C.
>>
>> C is essentially a short-cut for assembly language. C does not
>> depart from the actual machine and I think in terms of the
>> actual machine.
>>
>> That's why I despise OO and "functional" programming.
>
> Good luck managing your pointers without RAII :-D
>


Is memory management still important these days?

Puh... yet another question. Don't get me started on these stuff, guys.
Too soon for me. I don't have time to delve back into this.




RonB

unread,
Dec 14, 2023, 8:11:18 PM12/14/23
to
Your poor SSD is going to give up the ghost with the constant OS installs. I
tried Ubuntu 23.10 a couple months ago. It seemed to work fine (even on my
trailing edge hardware) but I just don't like Gnome 3 and Ubuntu's
increasing use of Snaps. Did you ever figure out if your speaker issue was
OS or hardware related? (You may have mentioned that, but I don't the
remember the result.)

RabidPedagog

unread,
Dec 15, 2023, 9:03:50 AM12/15/23
to
I figured out a few things, actually.

In the case of the speakers, merely unscrewing the bottom panel will
allow the speakers to work fine again. It seems that the bottom panel is
probably too tight. I recall losing one of the original screws at some
point and replacing it with one that was almost identical, but it might
have cause it to tighten up too severely. I'm not sure. I'm fine keeping
it unscrewed at every point except one since it's tight regardless, and
I might want to want quick access there anyway if ever I need to upgrade
the RAM or the SSD.

For the fingerprint sensor, the most likely scenario is that it is
simply defective. When I got my laptop back from repairs to replace the
keyboard, they replaced the entire top panel. By doing so, I got a new
keyboard but also a new fingerprint sensor. To say the least, it didn't
work right immediately. I tried everything I could to get it working
without success, until I noticed that if it was enabled, the BIOS would
periodically freeze and restart. I sent it back and they gave it back to
me within a week with the problem temporarily solved. I realize now that
they didn't bother to replace it, assuming that it was just a driver
issue. Considering how insecure fingerprint logins are and how unwilling
I am to send it out anyway, I'm content to just disable the sensor. If
another problem arises, I'll send it out since I have a warranty until
June. I'm thinking it's a matter of time before the fans need replacing,
so I'll send it out when that happens.

As for the SSD eventually dying, who cares? I can get a replacement for
less than $100 or one that's twice the size for a little more. We're no
longer in the 90s when such things required you to remortgage your home. :)

candycanearter07

unread,
Dec 15, 2023, 10:55:10 AM12/15/23
to
Yeah, but it's against the C++ "standard". You'll get tons of complaints
from the compiler.

Chris Ahlstrom

unread,
Dec 15, 2023, 1:18:06 PM12/15/23
to
Physfitfreak wrote this copyrighted missive and expects royalties:

> On 12/14/2023 6:29 AM, Chris Ahlstrom wrote:
>> Farley Flud wrote this copyrighted missive and expects royalties:
>>
>>> On Wed, 13 Dec 2023 18:19:11 -0600, Physfitfreak wrote:
>>>
>>>> Don't leave! :) I want you around when I begin to have questions in C++.
>>>
>>> I don't use C++(*). It is an "object oriented" language and I do
>>> not approve of the OO concept.
>>>
>>> My one-and-only language is C.
>>>
>>> C is essentially a short-cut for assembly language. C does not
>>> depart from the actual machine and I think in terms of the
>>> actual machine.
>>>
>>> That's why I despise OO and "functional" programming.
>>
>> Good luck managing your pointers without RAII :-D
>
> Is memory management still important these days?

Of course it is. Prefer it to be deterministic!

--
You're working under a slight handicap. You happen to be human.

chrisv

unread,
Dec 15, 2023, 3:52:24 PM12/15/23
to
Chris Ahlstrom wrote:

>Random numbers are too important to be left to chance.
>
> https://cplusplus.com/reference/random/
>
>Refers to almost 20 random distribution generators, such as Poisson and Cauchy.
>
>The rub is using them correctly!

Don't x86-64 CPU's have built-in random number generators, these days?
A truly random (or random enough for anything) source, that can be
read?

--
"Now Linosuck joins Lying Dumbkopf and JED as fools who believe all
the Star Wars movies were rendered on Linux." - Dumfsck, lying
shamelessly

Farley Flud

unread,
Dec 15, 2023, 5:02:36 PM12/15/23
to
On Fri, 15 Dec 2023 14:52:26 -0600, chrisv wrote:

>
> Don't x86-64 CPU's have built-in random number generators, these days?
> A truly random (or random enough for anything) source, that can be
> read?
>

Yes, the Intel CPUs have the "rdrand" instruction:

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

There are also many hardware "addons" that plug in to PCI
slots, or USB ports, that generate random numbers.

Other software uses the sound card:

https://github.com/douzzer/audio-entropyd-too

Physfitfreak

unread,
Dec 15, 2023, 7:43:31 PM12/15/23
to
Huh.. That's good to know. Then I'll switch to C then. There was a time
I knew C pretty well (and C++), but 30+ years throws all that to
somewhere you'd probably access only seconds after the process of death
has started.


candycanearter07

unread,
Dec 15, 2023, 10:49:37 PM12/15/23
to
I'm trying to learn C++ myself.

Physfitfreak

unread,
Dec 16, 2023, 1:54:15 AM12/16/23
to
By yourself? Or are you taking a college course in it?

Some old dude once told me (way back - in late 1980s) that reading and
understanding Kernighan and Richie's C book (the 2nd ed) and doing all
its exercises is enough to become a C programmer as well as passing the
interview for a C programmer job!... I had responded to him like, "How
do you show them what you know?". He said, "You only have to show them
evidence of having successfully done _all_ the exercises in that book -
they'll hire you on the spot." ... :) Hehe :) Is this, in this day and
times, still correct? Has C changed since the 2nd ed of that book
(1988)? Are there better books now available to take that same role even
better?








Stéphane CARPENTIER

unread,
Dec 16, 2023, 6:20:51 AM12/16/23
to
Le 13-12-2023, Physfitfreak <Physfi...@gmail.com> a écrit :
>
> And again - right or wrong! - you get my vote only if

Why anyone would want your vote?

> I won't buy anything else :)

Yes, that's my point. You refuse to believe anything written in the
English spoken media. And at the same time you believe FF/NV/FR/whatever
when he spoke nonsense about professionnel development. So why anyone
should be concerned about your opinion?

--
Si vous avez du temps à perdre :
https://scarpet42.gitlab.io

Farley Flud

unread,
Dec 16, 2023, 8:09:12 AM12/16/23
to
On Fri, 15 Dec 2023 13:18:01 -0500, Chris Ahlstrom wrote:

>>
>> Is memory management still important these days?
>
> Of course it is. Prefer it to be deterministic!
>

Garbage collection by any other name ...


candycanearter07

unread,
Dec 16, 2023, 12:55:17 PM12/16/23
to
By "myself", as in I'm reading through learncpp.com.
I do own Richie's C book 2E though!
and i dont really know if the new stuff is better

Physfitfreak

unread,
Dec 16, 2023, 1:07:19 PM12/16/23
to
A cro-magnon human usually has a big belly and a large ass (and thick
fingers). Under that big belly, if that human is male, something is
hanging. Short or long, that hanging thing is the "Nazi" that invariably
comes with him. And in that particular case, size won't matter.

I hope it helped.
It is loading more messages.
0 new messages