Krita PRNG (minor nit)

Matthew Woehlke mw_triad at users.sourceforge.net
Wed Mar 4 00:24:39 CET 2009


Cyrille Berger wrote:
> On Tuesday 03 March 2009, Matthew Woehlke wrote:
>> I'm curious where the current algorithm came from? (Also if there is any
>> reason for not using my latest suggestion other than that it does more
>> operations per pixel?)
>
> it does less operations :)

...yet those seem to be important. (More in my other post, currently 
stuck in the moderation queue.)

Actually, comparing again, by the time you improve the initial shuffle, 
the total number of operations looks to be about the same.

Mine is roughly two phases:
- initial shuffle
- call permutePart on each byte

Yours is similar to just the second step; your permutePart is rather 
different but looks like it probably does a similar number of total 
operations.

For grins, I may add timing code to my test program :-).

> I also get confused by your use of the generator in the noise filter, which 
> doesn't fit with what is currently done. So I wasn't sure if your algorithm 
> would fit the filter.

Sorry, I don't follow (I'm not sure what you mean by "generator" here, 
unless you mean that I feed the prng output directly into a pixel 
buffer). If you take a look at the most recent code I posted (once it's 
out of moderation) you'll see that "myRandom" is basically a drop-in for 
KisRandomGenerator::randomAt. So I don't see what's to stop taking mine 
and plunking it straight into KisRandomGenerator with the teensy change 
to refer to "d->seed" (member) instead of "seed" (parameter).

Btw, did you run statistical sampling on what's currently in svn? I also 
noticed that the min/max values are close to a linear function of the 
seed, which may not be a problem but is still a bit surprising. What 
probably *is* an issue is that your *mean* - over (0-1024)x(0-1024), 
anyway - is systemically high (seems to be always greater than 0x80..0).

-- 
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
-- 
"Still not King." -- Aragorn
(as quoted in The Very Secret Diaries by Cassandra Claire)
http://www.ealasaid.com/misc/vsd/



More information about the kimageshop mailing list