Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connectionsPath: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou
Newsgroups: comp.lang.awk
Subject: Re: 100 Random Single Variable Linear Equations
Date: Sat, 7 Dec 2024 03:21:34 +0100
Organization: A noiseless patient Spider
Lines: 39
Message-ID:
References:
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 07 Dec 2024 03:21:35 +0100 (CET)
Injection-Info: dont-email.me; posting-host="bcd19ac4cfc6094ca73c8e05b6530ac7";
logging-data="2853250"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19iNBO+TTyiysF3eufNEOEm"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:wDBp7hQ1qN10ArDLVK4FzHWZhU8=
X-Enigmail-Draft-Status: N1110
In-Reply-To:
Bytes: 2114
On 07.12.2024 02:49, Mike Sanders wrote:
> Mike Sanders wrote:
>
>> [...]
>> SEED = SEED ? SEED : 1
>> [...]
>
> no, no, what am i thinking, better expressed as:
>
> if (!SEED) SEED = 1
>
A deliberately chosen seed of 0 gets overwritten?
How about (since you're expecting a number)
if (SEED=="") SEED = 1
or (for good measure) the more general pattern for
an "uninitialized" variable 'var'
if (var=="" && var==0) ... # uninitialized
else ... # initialized (including "" and 0)
But is a seed of 1 "better" than a seed of 0 ?
Both create deterministic random number sequences.
Only srand() (i.e. without argument) creates a
time-depending quasi non-deterministic sequence.
My choice would probably be
if (var=="" && var==0) srand() # random start
else srand(var) # deterministic
to have both options.
Janis