Re: Deprecate KRandomSequence ?

2020-07-04 Thread Albert Astals Cid
El dilluns, 29 de juny de 2020, a les 22:27:44 CEST, Albert Astals Cid va 
escriure:
> QRandomGenerator is very similar in which you can give it a seed and get 
> randomness out of it.
> 
> Things that QRandomGenerator doesn't have:
>  * getBool(); -> should be easy enough to port to bounded(2) == 1
>  * randomize(QList) -> We could add namespace function in KRandom

https://invent.kde.org/frameworks/kcoreaddons/-/merge_requests/7

Here the first step of adding a randomize to KRandom.

Cheers,
  Albert

>  * modulate() -> Couldn't find any user, so no worries if we drop it
> 
> Benefits of deprecation:
>  * Less manintaince
> 
> Problems of deprecation:
>  * Moving from KRadomSequence(FIXED_SEED) to QRandomGenerator(FIXED_SEED) 
> will probably generate a different sequence, so if you need to 100% generate 
> the same sequence for all your app versions (e.g. for a game or something) 
> moving may not be "possible"
> 
> Ideas? Comments?
> 
> Cheers,
>   Albert
> 
> 
> 






Re: Deprecate KRandomSequence ?

2020-06-30 Thread Albert Astals Cid
El dimarts, 30 de juny de 2020, a les 22:17:56 CEST, Johan Ouwerkerk va 
escriure:
> On Tue, Jun 30, 2020 at 7:32 PM Albert Astals Cid  wrote:
> >
> > >
> > > If an application was relying on the random application sequence, it
> > > probably has bigger problems.
> >
> > Why? It's exactly what KRandomSequence (and QRandomGenerator) promise to do.
> >
> > And at least on KPat this is really useful.
> >
> > You can directly seed the random generator from the "Create new game" UI, 
> > so if there's a bug found in say game 1232145345, you can tell me that and 
> > then everyone can reproduce that bug since starting game 1232145345 gives 
> > everyone the same random numbers.
> >
> > Cheers,
> >   Albert
> >
> 
> As I read it, the only thing that could change is that KRandomSequence
> and QRandomGenerator will produce different outputs for the same seed
> value because the underlying PRNG may be different. So that might
> introduce a backwards incompatible change if you rely on the output of
> the sequence remaining stable between two versions of KPat. However,
> seeding it with a fixed value and then consuming the sequence should
> remain fully reproducible between two instances of the *same* KPat
> version.

Correct :)

Cheers,
  Albert

> 
> Regards,
> 
> - Johan
> 






Re: Deprecate KRandomSequence ?

2020-06-30 Thread Johan Ouwerkerk
On Tue, Jun 30, 2020 at 7:32 PM Albert Astals Cid  wrote:
>
> >
> > If an application was relying on the random application sequence, it
> > probably has bigger problems.
>
> Why? It's exactly what KRandomSequence (and QRandomGenerator) promise to do.
>
> And at least on KPat this is really useful.
>
> You can directly seed the random generator from the "Create new game" UI, so 
> if there's a bug found in say game 1232145345, you can tell me that and then 
> everyone can reproduce that bug since starting game 1232145345 gives everyone 
> the same random numbers.
>
> Cheers,
>   Albert
>

As I read it, the only thing that could change is that KRandomSequence
and QRandomGenerator will produce different outputs for the same seed
value because the underlying PRNG may be different. So that might
introduce a backwards incompatible change if you rely on the output of
the sequence remaining stable between two versions of KPat. However,
seeding it with a fixed value and then consuming the sequence should
remain fully reproducible between two instances of the *same* KPat
version.

Regards,

- Johan


Re: Deprecate KRandomSequence ?

2020-06-30 Thread Albert Astals Cid
El dimarts, 30 de juny de 2020, a les 1:21:48 CEST, Aleix Pol va escriure:
> On Mon, Jun 29, 2020 at 10:27 PM Albert Astals Cid  wrote:
> >
> > QRandomGenerator is very similar in which you can give it a seed and get 
> > randomness out of it.
> >
> > Things that QRandomGenerator doesn't have:
> >  * getBool(); -> should be easy enough to port to bounded(2) == 1
> >  * randomize(QList) -> We could add namespace function in KRandom
> >  * modulate() -> Couldn't find any user, so no worries if we drop it
> >
> > Benefits of deprecation:
> >  * Less manintaince
> >
> > Problems of deprecation:
> >  * Moving from KRadomSequence(FIXED_SEED) to QRandomGenerator(FIXED_SEED) 
> > will probably generate a different sequence, so if you need to 100% 
> > generate the same sequence for all your app versions (e.g. for a game or 
> > something) moving may not be "possible"
> >
> > Ideas? Comments?
> 
> +1 makes sense to me.
> 
> If an application was relying on the random application sequence, it
> probably has bigger problems. 

Why? It's exactly what KRandomSequence (and QRandomGenerator) promise to do.

And at least on KPat this is really useful.

You can directly seed the random generator from the "Create new game" UI, so if 
there's a bug found in say game 1232145345, you can tell me that and then 
everyone can reproduce that bug since starting game 1232145345 gives everyone 
the same random numbers.

Cheers,
  Albert

> It can always be hardcoded into the
> application too.
> 
> Aleix
> 






Re: Deprecate KRandomSequence ?

2020-06-29 Thread Aleix Pol
On Mon, Jun 29, 2020 at 10:27 PM Albert Astals Cid  wrote:
>
> QRandomGenerator is very similar in which you can give it a seed and get 
> randomness out of it.
>
> Things that QRandomGenerator doesn't have:
>  * getBool(); -> should be easy enough to port to bounded(2) == 1
>  * randomize(QList) -> We could add namespace function in KRandom
>  * modulate() -> Couldn't find any user, so no worries if we drop it
>
> Benefits of deprecation:
>  * Less manintaince
>
> Problems of deprecation:
>  * Moving from KRadomSequence(FIXED_SEED) to QRandomGenerator(FIXED_SEED) 
> will probably generate a different sequence, so if you need to 100% generate 
> the same sequence for all your app versions (e.g. for a game or something) 
> moving may not be "possible"
>
> Ideas? Comments?

+1 makes sense to me.

If an application was relying on the random application sequence, it
probably has bigger problems. It can always be hardcoded into the
application too.

Aleix