Review Request: Convenience KRandom methods

Ivan Cukic ivan.cukic at kde.org
Thu Aug 12 11:28:14 BST 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/4992/#review7007
-----------------------------------------------------------



trunk/KDE/kdelibs/kdecore/util/krandom.cpp
<http://reviewboard.kde.org/r/4992/#comment7025>

    If I'm not mistaken, this will make the probability of min and max to be 1/2 of the probability of other elements in the interval
    
    min = round(x), x in M1 = (min, min + 0.5)
    min + 1 = round(x), x in M2 = (min + 0.5, min + 1.5)
    
    ||M1|| = 0.5, ||M2|| = 1


- Ivan


On 2010-08-12 10:02:15, Sebastian Trueg wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/4992/
> -----------------------------------------------------------
> 
> (Updated 2010-08-12 10:02:15)
> 
> 
> Review request for kdelibs.
> 
> 
> Summary
> -------
> 
> The KRandom namespace is quite useful. However, applications need to be full of code snippets that calculate a random number in a range. IMHO it makes perfect sense to do this once in the library. Thus, I am proposing this patch to introduce two methods providing random numbers from a range.
> Feel free to improve the implementation. :)
> 
> 
> Diffs
> -----
> 
>   trunk/KDE/kdelibs/kdecore/util/krandom.h 1162164 
>   trunk/KDE/kdelibs/kdecore/util/krandom.cpp 1162164 
> 
> Diff: http://reviewboard.kde.org/r/4992/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Sebastian
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20100812/28ae8c59/attachment.htm>


More information about the kde-core-devel mailing list