Re: 100 Random Single Variable Linear Equations

Liste des GroupesRevenir à cl awk 
Sujet : Re: 100 Random Single Variable Linear Equations
De : porkchop (at) *nospam* invalid.foo (Mike Sanders)
Groupes : comp.lang.awk
Date : 08. Dec 2024, 07:40:33
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vj3f11$3l0qi$1@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

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.

See downthread, tell me what you think please kind sir...

--
:wq
Mike Sanders


Date Sujet#  Auteur
6 Dec 24 * 100 Random Single Variable Linear Equations23Mike Sanders
6 Dec 24 +* Re: 100 Random Single Variable Linear Equations19Mike Sanders
6 Dec 24 i`* Re: 100 Random Single Variable Linear Equations18Janis Papanagnou
6 Dec 24 i +* Re: 100 Random Single Variable Linear Equations3Janis Papanagnou
7 Dec 24 i i+- Re: 100 Random Single Variable Linear Equations1Mike Sanders
7 Dec 24 i i`- Re: 100 Random Single Variable Linear Equations1Mike Sanders
6 Dec 24 i `* Re: 100 Random Single Variable Linear Equations14Mike Sanders
6 Dec 24 i  +* Re: 100 Random Single Variable Linear Equations3Janis Papanagnou
7 Dec 24 i  i`* Re: 100 Random Single Variable Linear Equations2Christian Weisgerber
7 Dec 24 i  i `- Re: 100 Random Single Variable Linear Equations1Mike Sanders
6 Dec 24 i  +* Re: 100 Random Single Variable Linear Equations3Keith Thompson
7 Dec 24 i  i`* Re: 100 Random Single Variable Linear Equations2Mike Sanders
7 Dec 24 i  i `- Re: 100 Random Single Variable Linear Equations1Mike Sanders
7 Dec 24 i  `* Re: 100 Random Single Variable Linear Equations7Mike Sanders
7 Dec 24 i   `* Re: 100 Random Single Variable Linear Equations6Mike Sanders
7 Dec 24 i    `* Re: 100 Random Single Variable Linear Equations5Janis Papanagnou
8 Dec 24 i     `* Re: 100 Random Single Variable Linear Equations4Mike Sanders
8 Dec 24 i      `* Re: 100 Random Single Variable Linear Equations3Janis Papanagnou
9 Dec 24 i       `* Re: 100 Random Single Variable Linear Equations2Mike Sanders
9 Dec 24 i        `- Re: 100 Random Single Variable Linear Equations1Janis Papanagnou
8 Dec 24 +* Re: 100 Random Single Variable Linear Equations2Mike Sanders
8 Dec 24 i`- Re: 100 Random Single Variable Linear Equations1Mike Sanders
8 Dec 24 `- Re: 100 Random Single Variable Linear Equations1Mike Sanders

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal