Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #88434 > unrolled thread
| Started by | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| First post | 2023-01-08 06:01 +0100 |
| Last post | 2023-01-13 05:04 -0800 |
| Articles | 20 on this page of 74 — 15 participants |
Back to article view | Back to comp.lang.c++
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.
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-08 06:01 +0100
Re: Compute Unique Numbers in a Set Bart <bc@freeuk.com> - 2023-01-08 14:48 +0000
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-08 18:22 +0100
Re: Compute Unique Numbers in a Set Bart <bc@freeuk.com> - 2023-01-08 17:46 +0000
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-09 04:58 +0100
Re: Compute Unique Numbers in a Set Bart <bc@freeuk.com> - 2023-01-09 11:26 +0000
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-09 15:57 +0100
Re: Compute Unique Numbers in a Set Bart <bc@freeuk.com> - 2023-01-08 17:34 +0000
Re: Compute Unique Numbers in a Set Ike Naar <ike@sdf.org> - 2023-01-08 21:45 +0000
Re: Compute Unique Numbers in a Set Bart <bc@freeuk.com> - 2023-01-08 23:13 +0000
Re: Compute Unique Numbers in a Set "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-08 15:18 -0800
Re: Compute Unique Numbers in a Set Tim Woodall <news001@woodall.me.uk> - 2023-01-13 06:35 +0000
Re: Compute Unique Numbers in a Set Tim Woodall <news001@woodall.me.uk> - 2023-01-13 06:39 +0000
Re: Compute Unique Numbers in a Set Paavo Helde <eesnimi@osa.pri.ee> - 2023-01-08 21:19 +0200
Re: Compute Unique Numbers in a Set Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-08 19:20 +0000
Re: Compute Unique Numbers in a Set "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2023-01-09 12:03 +0100
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-09 17:42 +0100
Re: Compute Unique Numbers in a Set Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-09 23:22 +0000
Re: Compute Unique Numbers in a Set Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-01-10 05:11 -0800
Re: Compute Unique Numbers in a Set Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-01-10 05:19 -0800
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-13 08:26 +0100
Re: Compute Unique Numbers in a Set Öö Tiib <ootiib@hot.ee> - 2023-01-13 03:26 -0800
Re: Compute Unique Numbers in a Set gazelle@shell.xmission.com (Kenny McCormack) - 2023-01-13 12:21 +0000
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-13 14:11 +0100
Re: Compute Unique Numbers in a Set gazelle@shell.xmission.com (Kenny McCormack) - 2023-01-13 13:55 +0000
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-13 15:02 +0100
Re: Compute Unique Numbers in a Set gazelle@shell.xmission.com (Kenny McCormack) - 2023-01-13 14:17 +0000
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-15 16:06 +0100
Re: Compute Unique Numbers in a Set Ralf Goertz <me@myprovider.invalid> - 2023-01-15 16:47 +0100
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-15 17:13 +0100
Re: Compute Unique Numbers in a Set Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-01-15 08:57 -0800
Re: Compute Unique Numbers in a Set Ralf Goertz <me@myprovider.invalid> - 2023-01-16 09:46 +0100
Re: Compute Unique Numbers in a Set Ralf Goertz <me@myprovider.invalid> - 2023-01-16 10:21 +0100
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-16 13:35 +0100
Re: Compute Unique Numbers in a Set Ralf Goertz <me@myprovider.invalid> - 2023-01-16 14:46 +0100
Re: Compute Unique Numbers in a Set Ralf Goertz <me@myprovider.invalid> - 2023-01-16 14:42 +0100
Re: Compute Unique Numbers in a Set Muttley@dastardlyhq.com - 2023-01-16 16:38 +0000
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-16 21:06 +0100
Re: Compute Unique Numbers in a Set Ralf Goertz <me@myprovider.invalid> - 2023-01-17 09:19 +0100
Re: Compute Unique Numbers in a Set Muttley@dastardlyhq.com - 2023-01-17 09:30 +0000
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-17 14:14 +0100
Re: Compute Unique Numbers in a Set Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-01-17 07:48 -0800
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-17 16:49 +0100
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-17 17:32 +0100
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-17 19:24 +0100
Re: Compute Unique Numbers in a Set Ralf Goertz <me@myprovider.invalid> - 2023-01-17 17:31 +0100
Re: Compute Unique Numbers in a Set Muttley@dastardlyhq.com - 2023-01-17 17:10 +0000
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-17 18:18 +0100
Re: Compute Unique Numbers in a Set Muttley@dastardlyhq.com - 2023-01-18 09:23 +0000
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-18 13:31 +0100
Re: Compute Unique Numbers in a Set Muttley@dastardlyhq.com - 2023-01-18 16:16 +0000
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-18 17:20 +0100
Re: Compute Unique Numbers in a Set Muttley@dastardlyhq.com - 2023-01-18 16:24 +0000
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-18 17:59 +0100
Re: Compute Unique Numbers in a Set Muttley@dastardlyhq.com - 2023-01-18 17:14 +0000
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-18 18:23 +0100
Re: Compute Unique Numbers in a Set Muttley@dastardlyhq.com - 2023-01-19 09:31 +0000
Re: Compute Unique Numbers in a Set "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-17 12:48 -0800
Re: Compute Unique Numbers in a Set scott@slp53.sl.home (Scott Lurndal) - 2023-01-17 21:21 +0000
Re: Compute Unique Numbers in a Set "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-17 13:29 -0800
Re: Compute Unique Numbers in a Set Paul N <gw7rib@aol.com> - 2023-01-18 06:50 -0800
Re: Compute Unique Numbers in a Set "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-18 11:59 -0800
Re: Compute Unique Numbers in a Set Muttley@dastardlyhq.com - 2023-01-17 16:25 +0000
Re: Compute Unique Numbers in a Set Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-01-17 09:08 -0800
Re: Compute Unique Numbers in a Set Muttley@dastardlyhq.com - 2023-01-17 17:16 +0000
Re: Compute Unique Numbers in a Set Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-01-17 17:32 +0000
Re: Compute Unique Numbers in a Set Muttley@dastardlyhq.com - 2023-01-18 09:23 +0000
Re: Compute Unique Numbers in a Set gazelle@shell.xmission.com (Kenny McCormack) - 2023-01-18 12:26 +0000
Re: Compute Unique Numbers in a Set Muttley@dastardlyhq.com - 2023-01-18 16:09 +0000
Re: Compute Unique Numbers in a Set Bart <bc@freeuk.com> - 2023-01-15 16:27 +0000
Re: Compute Unique Numbers in a Set Bonita Montero <Bonita.Montero@gmail.com> - 2023-01-15 17:42 +0100
Re: Compute Unique Numbers in a Set gazelle@shell.xmission.com (Kenny McCormack) - 2023-01-15 17:11 +0000
Re: Compute Unique Numbers in a Set Tim Woodall <news001@woodall.me.uk> - 2023-01-13 06:32 +0000
Re: Compute Unique Numbers in a Set Öö Tiib <ootiib@hot.ee> - 2023-01-13 05:04 -0800
Page 3 of 4 — ← Prev page 1 2 [3] 4 Next page →
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2023-01-17 14:14 +0100 |
| Message-ID | <tq66tg$38bg3$1@dont-email.me> |
| In reply to | #88552 |
Am 17.01.2023 um 10:30 schrieb Muttley@dastardlyhq.com: > On Tue, 17 Jan 2023 09:19:44 +0100 > Ralf Goertz <me@myprovider.invalid> wrote: >> Am Mon, 16 Jan 2023 21:06:41 +0100 >> schrieb Bonita Montero <Bonita.Montero@gmail.com>: >> >>> Am 16.01.2023 um 17:38 schrieb Muttley@dastardlyhq.com: >>> >>>> But wait, didn't she state that her algorithm was "perfect"? I >>>> simply won't believe Bonita has more hubris and self delusion than >>>> an angry mouse. >>> >>> And you don't check that Ralf's code does sth. completely different. >> >> I assume you don't mean to say, that I implemented your algorithm >> incorrectly (if I'm wrong about that will you please care to elaborate?) >> but that my algorithm is completely different from yours. Then, yes that >> was my point. I don't understand why you use such a complicated >> algorithm (compared to the very few lines I needed) if it doesn't > > You must be new here :) Complexity is Bonitas calling card. If you want the code to be as short and as performant as possible there's no way to program different.
[toc] | [prev] | [next] | [standalone]
| From | Malcolm McLean <malcolm.arthur.mclean@gmail.com> |
|---|---|
| Date | 2023-01-17 07:48 -0800 |
| Message-ID | <3d614abf-c869-4288-8837-2a7e9c11050bn@googlegroups.com> |
| In reply to | #88555 |
On Tuesday, 17 January 2023 at 13:13:37 UTC, Bonita Montero wrote: > Am 17.01.2023 um 10:30 schrieb Mut...@dastardlyhq.com: > > On Tue, 17 Jan 2023 09:19:44 +0100 > > Ralf Goertz <m...@myprovider.invalid> wrote: > >> Am Mon, 16 Jan 2023 21:06:41 +0100 > >> schrieb Bonita Montero <Bonita....@gmail.com>: > >> > >>> Am 16.01.2023 um 17:38 schrieb Mut...@dastardlyhq.com: > >>> > >>>> But wait, didn't she state that her algorithm was "perfect"? I > >>>> simply won't believe Bonita has more hubris and self delusion than > >>>> an angry mouse. > >>> > >>> And you don't check that Ralf's code does sth. completely different. > >> > >> I assume you don't mean to say, that I implemented your algorithm > >> incorrectly (if I'm wrong about that will you please care to elaborate?) > >> but that my algorithm is completely different from yours. Then, yes that > >> was my point. I don't understand why you use such a complicated > >> algorithm (compared to the very few lines I needed) if it doesn't > > > > You must be new here :) Complexity is Bonitas calling card. > If you want the code to be as short and as performant > as possible there's no way to program different. > A shuffle followed by taking the first elements of the vector isn't a particularly efficient way of generating a sequence of unique random numbers. But it's not all that ineffieicnt either, and there's often an advantage in writing something simply ans quickly from pre-existing components, rather than writing a tailor- made, customised solution.
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2023-01-17 16:49 +0100 |
| Message-ID | <tq6g0v$39t2c$1@dont-email.me> |
| In reply to | #88560 |
Am 17.01.2023 um 16:48 schrieb Malcolm McLean: > A shuffle followed by taking the first elements of the vector isn't a particularly > efficient way of generating a sequence of unique random numbers. But it's > not all that ineffieicnt either, and there's often an advantage in writing something > simply ans quickly from pre-existing components, rather than writing a tailor- > made, customised solution. You don't have real randomness by shuffling.
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2023-01-17 17:32 +0100 |
| Message-ID | <tq6ihm$3a9hr$1@dont-email.me> |
| In reply to | #88561 |
Am 17.01.2023 um 16:49 schrieb Bonita Montero: > Am 17.01.2023 um 16:48 schrieb Malcolm McLean: > >> A shuffle followed by taking the first elements of the vector isn't a >> particularly >> efficient way of generating a sequence of unique random numbers. But it's >> not all that ineffieicnt either, and there's often an advantage in >> writing something >> simply ans quickly from pre-existing components, rather than writing a >> tailor- >> made, customised solution. > > You don't have real randomness by shuffling. I found that you can randomly shuffle with random_shuffle or you provide a shuffling function-object since C++17. That would be nice but if you have a large number of values and chose only a small portion from that this would take a lot of memory.
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2023-01-17 19:24 +0100 |
| Message-ID | <tq6p3r$3beg2$1@dont-email.me> |
| In reply to | #88565 |
Am 17.01.2023 um 17:32 schrieb Bonita Montero:
> I found that you can randomly shuffle with random_shuffle or you provide
> a shuffling function-object since C++17. That would be nice but if you
> have a large number of values and chose only a small portion from that
> this would take a lot of memory.
>
I made a compromise between memory-consumption and performance. For
the following code if more than a tenth of the range is chosen for
the values I use a random-shuffle like operation. If less than a
tenth of the range is chosen I an unordered_set to check for col-
lisions. The decision is made depening on the PARTITIAL_THRESHOLD
variable.
#include <iostream>
#include <vector>
#include <charconv>
#include <random>
#include <concepts>
#include <unordered_set>
using namespace std;
int main( int argc, char **argv )
{
try
{
if( argc < 4 ) [[unlikely]]
return
cout << argv[0] << " n from to" << endl,
EXIT_FAILURE;
auto parse = []( char const *str, char const *err )
{
size_t value;
if( from_chars_result fcr = from_chars( str, str + strlen( str ),
value ); (bool)fcr.ec || *fcr.ptr ) [[unlikely]]
throw invalid_argument( err );
return value;
};
size_t n = parse( argv[1], "wrong number of values" );
if( !n ) [[unlikely]]
return EXIT_SUCCESS;
size_t
from = parse( argv[2], "wrong from-value" ),
to = parse( argv[3], "wrong to-value" );
if( from > to ) [[unlikely]]
swap( from, to );
size_t range = to - from;
if( n - 1 > range ) [[unlikely]]
return
cout << "n is too large" << endl,
EXIT_FAILURE;
vector<size_t> values;
mt19937_64 mt;
uniform_int_distribution<size_t> uidRange( 0, range );
constexpr size_t PARTITIAL_THRESHOLD = 10;
if( ++range && range / n >= PARTITIAL_THRESHOLD )
{
unordered_set<size_t> valuesSet;
valuesSet.reserve( n );
while( valuesSet.size() < n )
for( ; ; )
if( size_t value = uidRange( mt ); !valuesSet.contains( value ) )
{
valuesSet.emplace( value );
break;
}
values.resize( n );
auto itSetValue = valuesSet.cbegin();
for( size_t i = 0; i != n; )
values[i++] = *itSetValue++;
}
else
{
if( !range )
throw bad_alloc();
values.resize( range );
for( size_t i = from; size_t &v : values )
v = i++;
for( size_t i = 0; i != n; )
swap( values[i++], values[uidRange( mt )] );
values.resize( n );
}
for( size_t i = 0; i != n; ++i )
; //cout << values[i] << endl;
}
catch( exception const &exc )
{
return
cout << exc.what() << endl,
EXIT_FAILURE;
}
}
[toc] | [prev] | [next] | [standalone]
| From | Ralf Goertz <me@myprovider.invalid> |
|---|---|
| Date | 2023-01-17 17:31 +0100 |
| Message-ID | <tq6iht$39uah$1@dont-email.me> |
| In reply to | #88561 |
Am Tue, 17 Jan 2023 16:49:37 +0100 schrieb Bonita Montero <Bonita.Montero@gmail.com>: > Am 17.01.2023 um 16:48 schrieb Malcolm McLean: > > > A shuffle followed by taking the first elements of the vector isn't > > a particularly efficient way of generating a sequence of unique > > random numbers. But it's not all that ineffieicnt either, and > > there's often an advantage in writing something simply ans quickly > > from pre-existing components, rather than writing a tailor- made, > > customised solution. > > You don't have real randomness by shuffling. What makes you say that? Have a look at the first answer to that question: <https://cs.stackexchange.com/questions/47338/whats-a-uniform-shuffle>. It shows that a properly implemented shuffle makes every permutation equally probable. What more do you need for “real randomness”? While I haven't checked the implementation of my c++ library (libstdc++6-devel-gcc12-12.2.1+git537-1.2.x86_64) I have no doubt that the authors have created a suitable one.
[toc] | [prev] | [next] | [standalone]
| From | Muttley@dastardlyhq.com |
|---|---|
| Date | 2023-01-17 17:10 +0000 |
| Message-ID | <tq6kpf$1n24$1@gioia.aioe.org> |
| In reply to | #88566 |
On Tue, 17 Jan 2023 17:31:57 +0100 Ralf Goertz <me@myprovider.invalid> wrote: >Am Tue, 17 Jan 2023 16:49:37 +0100 >schrieb Bonita Montero <Bonita.Montero@gmail.com>: > >> Am 17.01.2023 um 16:48 schrieb Malcolm McLean: >>=20 >> > A shuffle followed by taking the first elements of the vector isn't >> > a particularly efficient way of generating a sequence of unique >> > random numbers. But it's not all that ineffieicnt either, and >> > there's often an advantage in writing something simply ans quickly >> > from pre-existing components, rather than writing a tailor- made, >> > customised solution. =20 >>=20 >> You don't have real randomness by shuffling. > >What makes you say that? Have a look at the first answer to that >question: ><https://cs.stackexchange.com/questions/47338/whats-a-uniform-shuffle>. >It shows that a properly implemented shuffle makes every permutation >equally probable. What more do you need for =E2=80=9Creal randomness=E2=80= >=9D? While I >haven't checked the implementation of my c++ library >(libstdc++6-devel-gcc12-12.2.1+git537-1.2.x86_64) I have no doubt that >the authors have created a suitable one. To be pedantic, there's no real randomness at all if its simply generated from a mathematical function because you only need to know the seed to reproduce the sequence. To be truly random you need a hardware source such as a white noise generator. Even generators based on whats going on in the OS from users, network input etc isn't truly random and can be biased.
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2023-01-17 18:18 +0100 |
| Message-ID | <tq6l7g$3ap58$1@dont-email.me> |
| In reply to | #88568 |
Am 17.01.2023 um 18:10 schrieb Muttley@dastardlyhq.com: > To be pedantic, there's no real randomness at all if its simply generated > from a mathematical function because you only need to know the seed to > reproduce the sequence. To be truly random you need a hardware source > such as a white noise generator. Even generators based on whats going > on in the OS from users, network input etc isn't truly random and can > be biased. You can initialize mt19937_64( (random_device())() ). That's enough randomness for this task.
[toc] | [prev] | [next] | [standalone]
| From | Muttley@dastardlyhq.com |
|---|---|
| Date | 2023-01-18 09:23 +0000 |
| Message-ID | <tq8dpr$c91$1@gioia.aioe.org> |
| In reply to | #88570 |
On Tue, 17 Jan 2023 18:18:25 +0100 Bonita Montero <Bonita.Montero@gmail.com> wrote: >Am 17.01.2023 um 18:10 schrieb Muttley@dastardlyhq.com: > >> To be pedantic, there's no real randomness at all if its simply generated >> from a mathematical function because you only need to know the seed to >> reproduce the sequence. To be truly random you need a hardware source >> such as a white noise generator. Even generators based on whats going >> on in the OS from users, network input etc isn't truly random and can >> be biased. > >You can initialize mt19937_64( (random_device())() ). >That's enough randomness for this task. So is random() then.
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2023-01-18 13:31 +0100 |
| Message-ID | <tq8op8$t160$1@dont-email.me> |
| In reply to | #88594 |
Am 18.01.2023 um 10:23 schrieb Muttley@dastardlyhq.com: > On Tue, 17 Jan 2023 18:18:25 +0100 > Bonita Montero <Bonita.Montero@gmail.com> wrote: >> Am 17.01.2023 um 18:10 schrieb Muttley@dastardlyhq.com: >> You can initialize mt19937_64( (random_device())() ). >> That's enough randomness for this task. > So is random() then. Of course not. Mersenne Twister is the best of all non-cryptogra- phical random number generators. It calculates a number of results as a whole block for the next value-requests and thereby gets's a unbeaten performance for this degree of randomness (mt19937_64 has a period of of 2 ^ 19937 !). It's designed in a way that genrating that block can easily optimized with vectoring instruction sets like SSE or AVX.
[toc] | [prev] | [next] | [standalone]
| From | Muttley@dastardlyhq.com |
|---|---|
| Date | 2023-01-18 16:16 +0000 |
| Message-ID | <tq9605$1mq6$1@gioia.aioe.org> |
| In reply to | #88598 |
On Wed, 18 Jan 2023 13:31:23 +0100 Bonita Montero <Bonita.Montero@gmail.com> wrote: >Am 18.01.2023 um 10:23 schrieb Muttley@dastardlyhq.com: > >> On Tue, 17 Jan 2023 18:18:25 +0100 > >> Bonita Montero <Bonita.Montero@gmail.com> wrote: > >>> Am 17.01.2023 um 18:10 schrieb Muttley@dastardlyhq.com: > >>> You can initialize mt19937_64( (random_device())() ). >>> That's enough randomness for this task. > >> So is random() then. > >Of course not. Mersenne Twister is the best of all non-cryptogra- >phical random number generators. It calculates a number of results >as a whole block for the next value-requests and thereby gets's a >unbeaten performance for this degree of randomness (mt19937_64 has >a period of of 2 ^ 19937 !). It's designed in a way that genrating >that block can easily optimized with vectoring instruction sets >like SSE or AVX. I'll say again - there is no such thing as random for formula generated "random" number sequences. Given the same start conditions the same sequence will be generated whether its 2^19937 or 2^infinity. You'd be better off using /dev/random, at least its entropy comes from nominally external sources so is unpredictable in a busy enviroment.
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2023-01-18 17:20 +0100 |
| Message-ID | <tq966l$v9v8$1@dont-email.me> |
| In reply to | #88604 |
Am 18.01.2023 um 17:16 schrieb Muttley@dastardlyhq.com: > I'll say again - there is no such thing as random for formula generated > "random" number sequences. ... I was talking about a non-cryptographical PRNG, and you talk about sth. different because you have a constant feeling of uncertainty and you think nothing is reliable in that sense.
[toc] | [prev] | [next] | [standalone]
| From | Muttley@dastardlyhq.com |
|---|---|
| Date | 2023-01-18 16:24 +0000 |
| Message-ID | <tq96f8$1upf$1@gioia.aioe.org> |
| In reply to | #88605 |
On Wed, 18 Jan 2023 17:20:23 +0100 Bonita Montero <Bonita.Montero@gmail.com> wrote: >Am 18.01.2023 um 17:16 schrieb Muttley@dastardlyhq.com: > >> I'll say again - there is no such thing as random for formula generated >> "random" number sequences. ... > >I was talking about a non-cryptographical PRNG, and you talk about sth. >different because you have a constant feeling of uncertainty and you >think nothing is reliable in that sense. Pop psychology now? Really? Stick to writing over complicated code then bragging about how perfect it is so someone else can prove you wrong. Again.
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2023-01-18 17:59 +0100 |
| Message-ID | <tq98fa$vli9$1@dont-email.me> |
| In reply to | #88606 |
Am 18.01.2023 um 17:24 schrieb Muttley@dastardlyhq.com: > Pop psychology now? Really? Stick to writing over complicated code then > bragging about how perfect it is so someone else can prove you wrong. Again. No one uses this perfect randomness you suggest but only as a seed for a cryptographic PRNG. And for the purpose here you even don't need this quality of randomness. Your personal issues aren't practically relevant.
[toc] | [prev] | [next] | [standalone]
| From | Muttley@dastardlyhq.com |
|---|---|
| Date | 2023-01-18 17:14 +0000 |
| Message-ID | <tq99d0$1ece$1@gioia.aioe.org> |
| In reply to | #88607 |
On Wed, 18 Jan 2023 17:59:08 +0100 Bonita Montero <Bonita.Montero@gmail.com> wrote: >Am 18.01.2023 um 17:24 schrieb Muttley@dastardlyhq.com: > >> Pop psychology now? Really? Stick to writing over complicated code then >> bragging about how perfect it is so someone else can prove you wrong. Again. > >No one uses this perfect randomness you suggest but only as a seed for >a cryptographic PRNG. And for the purpose here you even don't need this I was simply making a point that if you don't care about actual randomness then standard RPGs are fine. >quality of randomness. Your personal issues aren't practically relevant. I'm not the one with the issues in this discussion.
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2023-01-18 18:23 +0100 |
| Message-ID | <tq99tp$vtqp$1@dont-email.me> |
| In reply to | #88608 |
Am 18.01.2023 um 18:14 schrieb Muttley@dastardlyhq.com: > I was simply making a point that if you don't care about actual randomness > then standard RPGs are fine. With that ? | I'll say again - there is no such thing as random for formula generated | "random" number sequences. Given the same start conditions the same sequence | will be generated whether its 2^19937 or 2^infinity. You'd be better off using | /dev/random, at least its entropy comes from nominally external sources so | is unpredictable in a busy enviroment. Absolutely not.
[toc] | [prev] | [next] | [standalone]
| From | Muttley@dastardlyhq.com |
|---|---|
| Date | 2023-01-19 09:31 +0000 |
| Message-ID | <tqb2m7$1aqa$1@gioia.aioe.org> |
| In reply to | #88609 |
On Wed, 18 Jan 2023 18:23:55 +0100 Bonita Montero <Bonita.Montero@gmail.com> wrote: >Am 18.01.2023 um 18:14 schrieb Muttley@dastardlyhq.com: > >> I was simply making a point that if you don't care about actual randomness >> then standard RPGs are fine. > >With that ? > >| I'll say again - there is no such thing as random for formula generated >| "random" number sequences. Given the same start conditions the same >sequence >| will be generated whether its 2^19937 or 2^infinity. You'd be better >off using >| /dev/random, at least its entropy comes from nominally external sources so >| is unpredictable in a busy enviroment. > >Absolutely not. Really? How would go about predicting what packets will arrive on the network or when a user will press a key then?
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Date | 2023-01-17 12:48 -0800 |
| Message-ID | <tq71it$3cmni$4@dont-email.me> |
| In reply to | #88561 |
On 1/17/2023 7:49 AM, Bonita Montero wrote: > Am 17.01.2023 um 16:48 schrieb Malcolm McLean: > >> A shuffle followed by taking the first elements of the vector isn't a >> particularly >> efficient way of generating a sequence of unique random numbers. But it's >> not all that ineffieicnt either, and there's often an advantage in >> writing something >> simply ans quickly from pre-existing components, rather than writing a >> tailor- >> made, customised solution. > > You don't have real randomness by shuffling. > Are you saying that there is no real randomness wrt shuffling a deck of cards around seven times in a row?
[toc] | [prev] | [next] | [standalone]
| From | scott@slp53.sl.home (Scott Lurndal) |
|---|---|
| Date | 2023-01-17 21:21 +0000 |
| Message-ID | <7jExL.61569$5S78.19125@fx48.iad> |
| In reply to | #88575 |
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes: >On 1/17/2023 7:49 AM, Bonita Montero wrote: >> Am 17.01.2023 um 16:48 schrieb Malcolm McLean: >> >>> A shuffle followed by taking the first elements of the vector isn't a >>> particularly >>> efficient way of generating a sequence of unique random numbers. But it's >>> not all that ineffieicnt either, and there's often an advantage in >>> writing something >>> simply ans quickly from pre-existing components, rather than writing a >>> tailor- >>> made, customised solution. >> >> You don't have real randomness by shuffling. >> > >Are you saying that there is no real randomness wrt shuffling a deck of >cards around seven times in a row? That depends on how it is shuffled. https://en.wikipedia.org/wiki/Faro_shuffle
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Date | 2023-01-17 13:29 -0800 |
| Message-ID | <tq73us$3d414$3@dont-email.me> |
| In reply to | #88576 |
On 1/17/2023 1:21 PM, Scott Lurndal wrote: > "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes: >> On 1/17/2023 7:49 AM, Bonita Montero wrote: >>> Am 17.01.2023 um 16:48 schrieb Malcolm McLean: >>> >>>> A shuffle followed by taking the first elements of the vector isn't a >>>> particularly >>>> efficient way of generating a sequence of unique random numbers. But it's >>>> not all that ineffieicnt either, and there's often an advantage in >>>> writing something >>>> simply ans quickly from pre-existing components, rather than writing a >>>> tailor- >>>> made, customised solution. >>> >>> You don't have real randomness by shuffling. >>> >> >> Are you saying that there is no real randomness wrt shuffling a deck of >> cards around seven times in a row? > > That depends on how it is shuffled. > > https://en.wikipedia.org/wiki/Faro_shuffle Touche. How about riffle shuffles?
[toc] | [prev] | [next] | [standalone]
Page 3 of 4 — ← Prev page 1 2 [3] 4 Next page →
Back to top | Article view | comp.lang.c++
csiph-web