Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #11830 > unrolled thread
| Started by | H e <he12457@hotmail.com> |
|---|---|
| First post | 2021-01-18 03:07 -0800 |
| Last post | 2021-01-18 10:29 -0800 |
| Articles | 7 — 3 participants |
Back to article view | Back to comp.programming
Increasing random() function speed. H e <he12457@hotmail.com> - 2021-01-18 03:07 -0800
Re: Increasing random() function speed. David Brown <david.brown@hesbynett.no> - 2021-01-18 12:15 +0100
Re: Increasing random() function speed. H E <kpuctjanpobam@mail.com> - 2021-01-18 06:41 -0800
Re: Increasing random() function speed. H E <kpuctjanpobam@mail.com> - 2021-01-18 06:42 -0800
Re: Increasing random() function speed. H E <kpuctjanpobam@mail.com> - 2021-01-18 06:45 -0800
Re: Increasing random() function speed. David Brown <david.brown@hesbynett.no> - 2021-01-18 16:14 +0100
Re: Increasing random() function speed. H e <he12457@hotmail.com> - 2021-01-18 10:29 -0800
| From | H e <he12457@hotmail.com> |
|---|---|
| Date | 2021-01-18 03:07 -0800 |
| Subject | Increasing random() function speed. |
| Message-ID | <88789e3e-9f73-4e6b-b42f-27ff7e24565an@googlegroups.com> |
I have noticed, that JavaScript Math.random() is a little bit slow. My function: Use smallest possible time, create digit of it. Make 10 digit number of it. Use function 2^a1+3^a2+...+11^a10 to create next digit with suming it until 1 digit. Function should always remember a2,...,a10, which will be next a1,...,a9. When the function is called in the same second(smallest clock unit usually), then increase a reminder variable digit when function is called again. When not, use next time produced digit as next a10. If it is already made, then please give me references. Mina, jah mina, kes küll muu. (372) 6861327
[toc] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2021-01-18 12:15 +0100 |
| Message-ID | <ru3qju$fft$1@dont-email.me> |
| In reply to | #11830 |
On 18/01/2021 12:07, H e wrote: > I have noticed, that JavaScript Math.random() is a little bit slow. Please stop posting this. You are wrong - you simply don't understand how to benchmark and measure speed. Once you have learned that, you will find that the function is extremely fast - so much so that the time is negligible compared to the time it takes a JavaScript engine to call a function. > > My function: > > Use smallest possible time, create digit of it. Make 10 digit number of it. > Use function 2^a1+3^a2+...+11^a10 to create next digit with suming it until 1 digit. Function should always remember a2,...,a10, which will be next a1,...,a9. When the function is called in the same second(smallest clock unit usually), then increase a reminder variable digit when function is called again. When not, use next time produced digit as next a10. > > If it is already made, then please give me references. > Making a good random number generator is not easy. It is hard to make it at least reasonably random, and hard to make it efficient. You are not qualified to do either - it takes a lot of mathematical knowledge and experience, as well as solid understanding of low-level coding. It can be fun to /try/ to make a random number generator, and you can learn a lot from experimenting and playing around. But don't kid yourself that /you/ can do something better than the standard library in JavaScript (or any other language). Maybe one day you will reach that level, but it's twenty years down the road at least. Learn to benchmark and to experiment.
[toc] | [prev] | [next] | [standalone]
| From | H E <kpuctjanpobam@mail.com> |
|---|---|
| Date | 2021-01-18 06:41 -0800 |
| Message-ID | <ebc3fb99-0226-408a-803b-dd7ee4dbe53en@googlegroups.com> |
| In reply to | #11832 |
David Brown kirjutas esmaspäev, 18. jaanuar 2021 kl 13:15:16 UTC+2: > On 18/01/2021 12:07, H e wrote: > > I have noticed, that JavaScript Math.random() is a little bit slow. > Please stop posting this. You are wrong - you simply don't understand > how to benchmark and measure speed. Once you have learned that, you > will find that the function is extremely fast - so much so that the time > is negligible compared to the time it takes a JavaScript engine to call > a function. > > > > My function: > > > > Use smallest possible time, create digit of it. Make 10 digit number of it. > > Use function 2^a1+3^a2+...+11^a10 to create next digit with suming it until 1 digit. Function should always remember a2,...,a10, which will be next a1,...,a9. When the function is called in the same second(smallest clock unit usually), then increase a reminder variable digit when function is called again. When not, use next time produced digit as next a10. > > > > If it is already made, then please give me references. > > > Making a good random number generator is not easy. It is hard to make > it at least reasonably random, and hard to make it efficient. You are > not qualified to do either - it takes a lot of mathematical knowledge > and experience, as well as solid understanding of low-level coding. > > It can be fun to /try/ to make a random number generator, and you can > learn a lot from experimenting and playing around. But don't kid > yourself that /you/ can do something better than the standard library in > JavaScript (or any other language). Maybe one day you will reach that > level, but it's twenty years down the road at least. > > Learn to benchmark and to experiment. Hmm... I counted the maximum possible random numbers in 1 second. I got this from thinking about the formula 2^a1+3^a2+...+11^a10. It is 10^10. Mina, jah mina, kes küll muu. (372) 6861327
[toc] | [prev] | [next] | [standalone]
| From | H E <kpuctjanpobam@mail.com> |
|---|---|
| Date | 2021-01-18 06:42 -0800 |
| Message-ID | <a235f5f5-aef5-43f5-8fac-9b1863dc5434n@googlegroups.com> |
| In reply to | #11832 |
David Brown kirjutas esmaspäev, 18. jaanuar 2021 kl 13:15:16 UTC+2: > On 18/01/2021 12:07, H e wrote: > > I have noticed, that JavaScript Math.random() is a little bit slow. > Please stop posting this. You are wrong - you simply don't understand > how to benchmark and measure speed. Once you have learned that, you > will find that the function is extremely fast - so much so that the time > is negligible compared to the time it takes a JavaScript engine to call > a function. > > > > My function: > > > > Use smallest possible time, create digit of it. Make 10 digit number of it. > > Use function 2^a1+3^a2+...+11^a10 to create next digit with suming it until 1 digit. Function should always remember a2,...,a10, which will be next a1,...,a9. When the function is called in the same second(smallest clock unit usually), then increase a reminder variable digit when function is called again. When not, use next time produced digit as next a10. > > > > If it is already made, then please give me references. > > > Making a good random number generator is not easy. It is hard to make > it at least reasonably random, and hard to make it efficient. You are > not qualified to do either - it takes a lot of mathematical knowledge > and experience, as well as solid understanding of low-level coding. > > It can be fun to /try/ to make a random number generator, and you can > learn a lot from experimenting and playing around. But don't kid > yourself that /you/ can do something better than the standard library in > JavaScript (or any other language). Maybe one day you will reach that > level, but it's twenty years down the road at least. > > Learn to benchmark and to experiment. Seems interesting, David ....... I counted the maximum possible random numbers in 1 second. I got this from thinking about the formula 2^a1+3^a2+...+11^a10. It is 10^10. Mina, jah mina, kes küll muu. (372) 6861327
[toc] | [prev] | [next] | [standalone]
| From | H E <kpuctjanpobam@mail.com> |
|---|---|
| Date | 2021-01-18 06:45 -0800 |
| Message-ID | <4170038e-7d4d-4bd3-a4b2-ada408070485n@googlegroups.com> |
| In reply to | #11837 |
H E kirjutas esmaspäev, 18. jaanuar 2021 kl 16:42:55 UTC+2: > David Brown kirjutas esmaspäev, 18. jaanuar 2021 kl 13:15:16 UTC+2: > > On 18/01/2021 12:07, H e wrote: > > > I have noticed, that JavaScript Math.random() is a little bit slow. > > Please stop posting this. You are wrong - you simply don't understand > > how to benchmark and measure speed. Once you have learned that, you > > will find that the function is extremely fast - so much so that the time > > is negligible compared to the time it takes a JavaScript engine to call > > a function. > > > > > > My function: > > > > > > Use smallest possible time, create digit of it. Make 10 digit number of it. > > > Use function 2^a1+3^a2+...+11^a10 to create next digit with suming it until 1 digit. Function should always remember a2,...,a10, which will be next a1,...,a9. When the function is called in the same second(smallest clock unit usually), then increase a reminder variable digit when function is called again. When not, use next time produced digit as next a10. > > > > > > If it is already made, then please give me references. > > > > > Making a good random number generator is not easy. It is hard to make > > it at least reasonably random, and hard to make it efficient. You are > > not qualified to do either - it takes a lot of mathematical knowledge > > and experience, as well as solid understanding of low-level coding. > > > > It can be fun to /try/ to make a random number generator, and you can > > learn a lot from experimenting and playing around. But don't kid > > yourself that /you/ can do something better than the standard library in > > JavaScript (or any other language). Maybe one day you will reach that > > level, but it's twenty years down the road at least. > > > > Learn to benchmark and to experiment. > Seems interesting, David ....... > > I counted the maximum possible random numbers in 1 second. > I got this from thinking about the formula 2^a1+3^a2+...+11^a10. > It is 10^10. > Mina, jah mina, kes küll muu. > > (372) 6861327 Actually the formula 2^a1+3^a2+...+11^a10 can be appended with something like: +12^a11 and so on. On the smallest case the result is 10^11. Mina, jah mina, kes küll muu. (372) 6861327
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2021-01-18 16:14 +0100 |
| Message-ID | <ru48l0$kc$1@dont-email.me> |
| In reply to | #11838 |
On 18/01/2021 15:45, H E wrote: > H E kirjutas esmaspäev, 18. jaanuar 2021 kl 16:42:55 UTC+2: >> I counted the maximum possible random numbers in 1 second. >> I got this from thinking about the formula 2^a1+3^a2+...+11^a10. >> It is 10^10. >> Mina, jah mina, kes küll muu. >> >> (372) 6861327 > > Actually the formula 2^a1+3^a2+...+11^a10 can be appended with something like: > +12^a11 and so on. > On the smallest case the result is 10^11. > You are not making any sense at all, in any way. There is no limit to the number of random numbers (or pseudo-random numbers) that can be generated in any given time (not until you start considering quantum mechanics, minimum energies for computations, maximum energy densities, and that sort of thing). I don't know what you think that "formula" means, but repeatedly posting the same gibberish won't help. If you have a question, post it. But you'll have to explain what you are trying to do.
[toc] | [prev] | [next] | [standalone]
| From | H e <he12457@hotmail.com> |
|---|---|
| Date | 2021-01-18 10:29 -0800 |
| Message-ID | <6ebc6ad1-b411-41f7-9c94-30e7107a9216n@googlegroups.com> |
| In reply to | #11841 |
Topic fix: https://groups.google.com/g/comp.programming/c/Pix_46kZ3BU Mina
[toc] | [prev] | [standalone]
Back to top | Article view | comp.programming
csiph-web