Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #40862 > unrolled thread

Re: Random numbers

Started byFirst name Last name <he1291983@gmail.com>
First post2022-05-13 23:14 -0700
Last post2022-05-15 02:57 -0700
Articles 15 — 7 participants

Back to article view | Back to comp.lang.javascript

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Random numbers First name Last name <he1291983@gmail.com> - 2022-05-13 23:14 -0700
    Re: Random numbers John Harris <niam@jghnorth.org.uk.invalid> - 2022-05-14 11:33 +0100
      Re: Random numbers Mister Kristjan <he1291983@gmail.com> - 2022-05-15 02:51 -0700
        Re: Random numbers John Harris <niam@jghnorth.org.uk.invalid> - 2022-05-18 18:29 +0100
          Re: Random numbers Jon Ribbens <jon+usenet@unequivocal.eu> - 2022-05-18 20:38 +0000
            Re: Random numbers Ingel <he12091983@gmail.com> - 2022-05-29 09:12 -0700
              Re: Random numbers John Harris <niam@jghnorth.org.uk.invalid> - 2022-05-29 18:05 +0100
              Re: Random numbers V V V V V <ya00000100000@worker.com> - 2023-01-15 02:05 -0800
                Re: Random numbers V <vvvvvvvvvvvvvv@mail.ee> - 2023-08-14 23:24 -0700
                Re: Random numbers V <vvvvvvvvvvvvvv@mail.ee> - 2023-08-14 23:28 -0700
                 ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀N⠀u⠀m⠀b⠀r⠀i⠀d ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ V <vvvvvvvvvvvvvv@mail.ee> - 2023-08-14 23:53 -0700
                Re: Random numbers V <vvvvvvvvvvvvvv@mail.ee> - 2023-08-15 00:05 -0700
                Re: Random numbers V <vvvvvvvvvvvvvv@mail.ee> - 2023-08-16 22:44 -0700
                Re: Random numbers V <vvvvvvvvvvvvvv@mail.ee> - 2023-08-16 22:51 -0700
      Re: Random numbers Mister Kristjan <he1291983@gmail.com> - 2022-05-15 02:57 -0700

#40862 — Re: Random numbers

FromFirst name Last name <he1291983@gmail.com>
Date2022-05-13 23:14 -0700
SubjectRe: Random numbers
Message-ID<4f747cef-38ab-4cbe-886a-52f50e80819en@googlegroups.com>
You don't need to get random numbers with a program. You create random numbers with your brain.

[toc] | [next] | [standalone]


#40863

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2022-05-14 11:33 +0100
Message-ID<t5o0hq$umk$1@dont-email.me>
In reply to#40862
On 14/05/2022 07:14, First name Last name wrote:
> You don't need to get random numbers with a program. You create random numbers with your brain.

Many experiments have shown that human brains are very bad at creating 
"random" numbers.

   John

[toc] | [prev] | [next] | [standalone]


#40864

FromMister Kristjan <he1291983@gmail.com>
Date2022-05-15 02:51 -0700
Message-ID<01ecfd5e-500a-4eda-a86e-3d91877a4814n@googlegroups.com>
In reply to#40863
John Harris kirjutas Laupäev, 14. mai 2022 kl 12:33:38 UTC+2:
> On 14/05/2022 07:14, First name Last name wrote: 
> > You don't need to get random numbers with a program. You create random numbers with your brain.
> Many experiments have shown that human brains are very bad at creating 
> "random" numbers. 
> 
> John

Okey, try then this 
|
|
|
|
V


<html>
<body>
<div id="aa1" style="width: 100%;word-break:break-word;">
</div>
<script>
var a1=Math.random()*106875;
a1=Math.round(a1*100000000000)/1000000000000;
for(var i=0; i<9876; i++) {
var i01=i*0.1342626246475681396246346+i*0.267629578752464837134+0.13257568494264346234;
a1=a1*a1*0.263856787598547681531;
if(a1<0.1) a1=a1+4.37469234896;
if(a1>100000) a1=a1*0.000004398734756825426923475896;
var j=a1*2.4326974639679758456872875*i01;
j=Math.round(j*100000000000)/100000000000;
document.getElementById("aa1").append(j);
}
var aa001=document.getElementById("aa1").innerHTML;
aa001=aa001.replace(/\./g,'');
aa001=aa001.replace(/\+/g,'');
aa001=aa001.replace(/e/g,'');
aa001=aa001.replace(/\-/g,'');
document.getElementById("aa1").innerHTML=aa001;
</script>

</body>
</html>

[toc] | [prev] | [next] | [standalone]


#40870

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2022-05-18 18:29 +0100
Message-ID<t63ad8$m7h$1@dont-email.me>
In reply to#40864
On 15/05/2022 10:51, Mister Kristjan wrote:
> John Harris kirjutas Laupäev, 14. mai 2022 kl 12:33:38 UTC+2:
>> On 14/05/2022 07:14, First name Last name wrote:
>>> You don't need to get random numbers with a program. You create random numbers with your brain.
>> Many experiments have shown that human brains are very bad at creating
>> "random" numbers.
>>
>> John
> 
> Okey, try then this
> |
> |
> |
> |
> V
> 
> 
> <html>
> <body>
> <div id="aa1" style="width: 100%;word-break:break-word;">
> </div>
> <script>
> var a1=Math.random()*106875;
> a1=Math.round(a1*100000000000)/1000000000000;
> for(var i=0; i<9876; i++) {
> var i01=i*0.1342626246475681396246346+i*0.267629578752464837134+0.13257568494264346234;
> a1=a1*a1*0.263856787598547681531;
> if(a1<0.1) a1=a1+4.37469234896;
> if(a1>100000) a1=a1*0.000004398734756825426923475896;
> var j=a1*2.4326974639679758456872875*i01;
> j=Math.round(j*100000000000)/100000000000;
> document.getElementById("aa1").append(j);
> }
> var aa001=document.getElementById("aa1").innerHTML;
> aa001=aa001.replace(/\./g,'');
> aa001=aa001.replace(/\+/g,'');
> aa001=aa001.replace(/e/g,'');
> aa001=aa001.replace(/\-/g,'');
> document.getElementById("aa1").innerHTML=aa001;
> </script>
> 
> </body>
> </html>
> 


Here's a simpler version :-

<html>

<title> Random digits </title>

<body>
<div id="aa1" style="width: 100%;word-break:break-word;">
</div>

<script>
	var s = "";  // Random digit sequence

	for(var i = 0; i<160000; i++)
	  {
		var d = Math.floor(10*Math.random());
		if (d < 10)  // In case random = 1.0 (Shouldn't be)
		  s += d;
	  }
	
	document.getElementById("aa1").innerHTML = s;
	
</script>

</body>
</html>


   John

[toc] | [prev] | [next] | [standalone]


#40871

FromJon Ribbens <jon+usenet@unequivocal.eu>
Date2022-05-18 20:38 +0000
Message-ID<slrnt8amav.10dg.jon+usenet@raven.unequivocal.eu>
In reply to#40870
On 2022-05-18, John Harris <niam@jghnorth.org.uk.invalid> wrote:
> Here's a simpler version :-

Here's a less simple version:

  Array(160000).fill(0).map(_=>10*Math.random()|0).join('')

[toc] | [prev] | [next] | [standalone]


#40892

FromIngel <he12091983@gmail.com>
Date2022-05-29 09:12 -0700
Message-ID<00eafba7-4910-4aa5-bc67-db228003d722n@googlegroups.com>
In reply to#40871
Newer try
|
|
|
|
|
V

<html>
<body>
<div id="aa1" style="width: 100%;word-break:break-word;">
</div>
<script>
var a1=Math.random()*106875;
a1=Math.round(a1*7456896368674)/7456896368674;
for(var i=0; i<9876; i++) {
var i01=i*0.8342626246475681396246346+i*0.767629578752464837134+0.13257568494264346234;
a1=a1*a1*0.563856787598547681531;
if(a1<0.1) a1=a1+4.37469234896;
if(a1>100000) a1=a1*0.000004398734756825426923475896;
var j=a1*9.4326974639679758456872875*i01;
j=Math.round(j*7456896368674)/7456896368674;
document.getElementById("aa1").append(j);
}
var aa001=document.getElementById("aa1").innerHTML;
aa001=aa001.replace(/\./g,'');
aa001=aa001.replace(/\+/g,'');
aa001=aa001.replace(/e/g,'');
aa001=aa001.replace(/\-/g,'');
document.getElementById("aa1").innerHTML=aa001;
</script>

</body>
</html>

[toc] | [prev] | [next] | [standalone]


#40894

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2022-05-29 18:05 +0100
Message-ID<t70957$jf1$1@dont-email.me>
In reply to#40892
On 29/05/2022 17:12, Ingel wrote:

   <snip>
> j=Math.round(j*7456896368674)/7456896368674;
   <snip>

Never use round!

   John


[toc] | [prev] | [next] | [standalone]


#41170

FromV V V V V <ya00000100000@worker.com>
Date2023-01-15 02:05 -0800
Message-ID<2f6d0559-a2e1-4a47-9bed-3e3dc056004fn@googlegroups.com>
In reply to#40892
The latest

 |
 |
 |
 |
 |
 |
 |
V

<html>
<body>
<div id="aa1" style="width: 100%;word-break:break-word;">
</div>
<script>
var a1=Math.random()*754234711;
a1=Math.round(a1*100000000)/1000000000;
for(var i=0; i<507777; i++) {
var i01=i*0.73142627471096247698275431743696346+0.0132542709641827386927342746234;
a1=a1*a1*2.6875961902437860984278546302;
if(a1<0.001) a1=a1+0.346989016742698173234896;
if(a1>10000000) a1=(a1%10000000)*0.035439873198467428963279406273498673469234896;
var j=a1*0.54326974673472134921438965875*i01;
j=Math.round(j*100000000)/100000000;
document.getElementById("aa1").append(j);
}
var aa001=document.getElementById("aa1").innerHTML;
aa001=aa001.replace(/\./g,'');
aa001=aa001.replace(/\+/g,'');
aa001=aa001.replace(/e/g,'');
aa001=aa001.replace(/\-/g,'');
document.getElementById("aa1").innerHTML=aa001;
</script>

</body>
</html> 




On Sunday, May 29, 2022 at 7:12:51 PM UTC+3, Ingel wrote:
> Newer try
> | 
> | 
> | 
> | 
> | 
> V 
> 
> <html> 
> <body> 
> <div id="aa1" style="width: 100%;word-break:break-word;"> 
> </div> 
> <script> 
> var a1=Math.random()*106875;
> a1=Math.round(a1*7456896368674)/7456896368674;
> for(var i=0; i<9876; i++) {
> var i01=i*0.8342626246475681396246346+i*0.767629578752464837134+0.13257568494264346234; 
> a1=a1*a1*0.563856787598547681531;
> if(a1<0.1) a1=a1+4.37469234896; 
> if(a1>100000) a1=a1*0.000004398734756825426923475896;
> var j=a1*9.4326974639679758456872875*i01; 
> j=Math.round(j*7456896368674)/7456896368674;
> document.getElementById("aa1").append(j); 
> } 
> var aa001=document.getElementById("aa1").innerHTML; 
> aa001=aa001.replace(/\./g,''); 
> aa001=aa001.replace(/\+/g,''); 
> aa001=aa001.replace(/e/g,''); 
> aa001=aa001.replace(/\-/g,''); 
> document.getElementById("aa1").innerHTML=aa001; 
> </script> 
> 
> </body> 
> </html>

[toc] | [prev] | [next] | [standalone]


#41401

FromV <vvvvvvvvvvvvvv@mail.ee>
Date2023-08-14 23:24 -0700
Message-ID<e9b85c9c-4b2f-4a1a-8f2e-cee1068cbeben@googlegroups.com>
In reply to#41170
<html>
<body>
<div id="aa1" style="width: 100%;word-break:break-word;">
</div>
<script>
var a1=64876389467839;
a1=Math.round(a1*100000000)/1000000000;
for(var i=0; i<507777; i++) {
var i01=i*0.73142627471096247698275431743696346+0.0132542709641827386927342746234;
a1=a1*a1*2.6875961902437860984278546302;
if(a1<0.001) a1=a1+0.346989016742698173234896;
if(a1>10000000) a1=(a1%10000000)*0.035439873198467428963279406273498673469234896;
var j=a1*0.54326974673472134921438965875*i01;
j=Math.round(j*100000000)/100000000;
document.getElementById("aa1").append(j);
}
var aa001=document.getElementById("aa1").innerHTML;
aa001=aa001.replace(/\./g,'');
aa001=aa001.replace(/\+/g,'');
aa001=aa001.replace(/e/g,'');
aa001=aa001.replace(/\-/g,'');
document.getElementById("aa1").innerHTML=aa001;
</script>

</body>
</html>

[toc] | [prev] | [next] | [standalone]


#41402

FromV <vvvvvvvvvvvvvv@mail.ee>
Date2023-08-14 23:28 -0700
Message-ID<fcdd0d2a-196f-4013-9573-2d69d9338a6an@googlegroups.com>
In reply to#41170
<html>
<body>
<div id="a" style="width: 100%;word-break:break-word;">
</div>
<script>
var a1=518923758236358972138;
a1=Math.round(a1*100000000)/1000000000;
for(var i=0; i<507777; i++) {
var i01=i*0.73142627471096247698275431743696346+0.0132542709641827386927342746234;
a1=a1*a1*2.6875961902437860984278546302;
if(a1<0.001) a1=a1+0.346989016742698173234896;
if(a1>10000000) a1=(a1%10000000)*0.035439873198467428963279406273498673469234896;
var j=a1*0.54326974673472134921438965875*i01;
j=Math.round(j*100000000)/100000000;
document.getElementById("a").append(j);
}
var aa001=document.getElementById("a").innerHTML;
aa001=aa001.replace(/\./g,'');
aa001=aa001.replace(/\+/g,'');
aa001=aa001.replace(/e/g,'');
aa001=aa001.replace(/\-/g,'');
document.getElementById("a").innerHTML=aa001;
</script>

</body>
</html>

[toc] | [prev] | [next] | [standalone]


#41403 — ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀N⠀u⠀m⠀b⠀r⠀i⠀d ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀

FromV <vvvvvvvvvvvvvv@mail.ee>
Date2023-08-14 23:53 -0700
Subject ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀N⠀u⠀m⠀b⠀r⠀i⠀d ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀ ⠀
Message-ID<49e09f9b-db75-45af-937a-4d9eae0b01d0n@googlegroups.com>
In reply to#41170
<html>
<body>
<div id="a" style="width: 100%;word-break:break-word;">
</div>
<script>
var a1=518923758236358972138;
a1=Math.round(a1*100000000)/1000000000;
for(var i=0; i<62479; i++) {
var i01=i*0.73142627471096247698275431743696346+0.0132542709641827386927342746234;
a1=a1*a1*2.6875961902437860984278546302;
if(a1<0.001) a1=a1+0.346989016742698173234896;
if(a1>10000000) a1=(a1%10000000)*0.035439873198467428963279406273498673469234896;
var j=a1*0.54326974673472134921438965875*i01;
j=Math.round(j*100000000)/100000000;
document.getElementById("a").append(j);
}
var aa001=document.getElementById("a").innerHTML;
aa001=aa001.replace(/\./g,'');
aa001=aa001.replace(/\+/g,'');
aa001=aa001.replace(/e/g,'');
aa001=aa001.replace(/\-/g,'');
document.getElementById("a").innerHTML=aa001;
</script>

</body>
</html>

[toc] | [prev] | [next] | [standalone]


#41404

FromV <vvvvvvvvvvvvvv@mail.ee>
Date2023-08-15 00:05 -0700
Message-ID<a7836f5b-c1f2-4954-8412-f5744a387783n@googlegroups.com>
In reply to#41170
<html>
<style>
p { word-break: break-word;}
</style>
<body>
<p id="a">
<p>
<script>
var a=468347638683947623684376;
a=Math.round(a*100000000)/1000000000;
for(var i=0; i<629; i++) {
var j=i*0.73142627471096247698275431743696346+0.0132542709641827386927342746234;
a=a*a*2.6875961902437860984278546302;
if(a<0.001) a=a+0.346989016742698173234896;
if(a>10000000) a=(a%10000000)*0.035439873198467428963279406273498673469234896;
j=a*0.54326974673472134921438965875*j;
j=Math.round(j*100000000)/100000000;
document.getElementById("a").append(j);
}
var aa=document.getElementById("a").innerHTML;
aa=aa.replace(/\./g,'');
aa=aa.replace(/\+/g,'');
aa=aa.replace(/e/g,'');
aa=aa.replace(/\-/g,'');
document.getElementById("a").innerHTML=aa;
</script>
</body>
</html>



jsfiddle.net/6sfqwtra

[toc] | [prev] | [next] | [standalone]


#41405

FromV <vvvvvvvvvvvvvv@mail.ee>
Date2023-08-16 22:44 -0700
Message-ID<423214b2-c504-4183-b0dd-8b922051a616n@googlegroups.com>
In reply to#41170
jsfiddle.net/ofdgey6k/1/

[toc] | [prev] | [next] | [standalone]


#41406

FromV <vvvvvvvvvvvvvv@mail.ee>
Date2023-08-16 22:51 -0700
Message-ID<58880ae2-cdbe-4483-b622-7ca26d091cffn@googlegroups.com>
In reply to#41170
<html>
<body>
<div id="aa1" style="width: 100%;word-break:break-word;">
</div>
<script>
var a1=97389;
a1=Math.round(a1*100000000000)/1000000000000;
for(var i=0; i<82; i++) {
var i01=i*0.8342626246475681396246346+i*0.767629578752464837134+0.13257568494264346234;
a1=a1*a1*0.563856787598547681531;
if(a1<0.1) a1=a1+4.37469234896;
if(a1>100000) a1=a1*0.000004398734756825426923475896;
var j=a1*9.4326974639679758456872875*i01;
j=Math.round(j*100000000000)/100000000000;
document.getElementById("aa1").append(j);
}
var aa001=document.getElementById("aa1").innerHTML;
aa001=aa001.replace(/\./g,'');
aa001=aa001.replace(/\+/g,'');
aa001=aa001.replace(/e/g,'');
aa001=aa001.replace(/\-/g,'');
document.getElementById("aa1").innerHTML=aa001;
</script>

</body>
</html>

[toc] | [prev] | [next] | [standalone]


#40865

FromMister Kristjan <he1291983@gmail.com>
Date2022-05-15 02:57 -0700
Message-ID<a1e1c69b-84d2-4d69-b32e-3f85c9f52f78n@googlegroups.com>
In reply to#40863
John Harris kirjutas Laupäev, 14. mai 2022 kl 12:33:38 UTC+2:
> On 14/05/2022 07:14, First name Last name wrote: 
> > You don't need to get random numbers with a program. You create random numbers with your brain.
> Many experiments have shown that human brains are very bad at creating 
> "random" numbers. 
> 
> John

Try the below, guys

|
|
|
|
|
V

<html>
<body>
<div id="aa1" style="width: 100%;word-break:break-word;">
</div>
<script>
var a1=Math.random()*106875;
a1=Math.round(a1*100000000000)/1000000000000;
for(var i=0; i<9876; i++) {
var i01=i*0.8342626246475681396246346+i*0.767629578752464837134+0.13257568494264346234;
a1=a1*a1*0.563856787598547681531;
if(a1<0.1) a1=a1+4.37469234896;
if(a1>100000) a1=a1*0.000004398734756825426923475896;
var j=a1*9.4326974639679758456872875*i01;
j=Math.round(j*100000000000)/100000000000;
document.getElementById("aa1").append(j);
}
var aa001=document.getElementById("aa1").innerHTML;
aa001=aa001.replace(/\./g,'');
aa001=aa001.replace(/\+/g,'');
aa001=aa001.replace(/e/g,'');
aa001=aa001.replace(/\-/g,'');
document.getElementById("aa1").innerHTML=aa001;
</script>

</body>
</html>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web