Lucky Skill

 

RNG Evaluation Report

 

 


1.     Operator

Lucky Skill Ltd.                                                URL: http://www.luckyskill.com

 

2.      Tester

iTech Labs Australia                                        URL: http://www.itechlabs.com.au

Suite 24, 40 Montclaire Ave                              e-mail: info@itechlabs.com.au

Glen Waverley

VIC 3150, Australia

 

3.      Item tested

Lucky Skill Random Number Generator (RNG) and scaling algorithm

Date Requested:                                             31 August, 2005

Date Completed:                                             10 October, 2005

 

 

4.      Technical Requirements

iTech Labs standards http://www.itechlabs.com.au/gaming/iTech_Labs_IGS_Standards.pdf

(includes Marsaglia’s ‘Diehard’ tests, Chi-squared tests and code review).

 

 

5.      Previous history of the system under test

No previous history of independent testing available.

 

6.      Evaluation details

Request for evaluation

Lucky Skill has requested iTech Labs perform the following:

1.        Test and certify their RNG.

2.        Make recommendations (if required) to improve randomness of their RNG.

 

Evaluation performed

iTech Labs has conducted evaluation of the Lucky Skill RNG as below:

1.         Source code was examined for the following:

i)        Identification of RNG algorithm;

ii)       Security of internal state, seeding and reseeding, thread safety, background cycling;

iii)     Scaling to 1-6 die values;

iv)     Code changes incorporating iTech Labs’ recommendations.

2.         Marsaglia’s “Diehard” test was applied to RNG output.

3.         Chi-squared test was applied to:

i)     Single die values obtained from the RNG;

ii)   Ordered pairs of die values obtained from the RNG.

 

 

7.Evaluation results

1.         Source code examination.

i)        RNG uses Mersenne Twister algorithm.  This RNG algorithm is well-known.

ii)       Security of internal state, seeding and reseeding, thread safety and background cycling are sufficient, but not ideal; seeding is derived from the system clock.

iii)     The scaling of RNG to produce Die numbers is statistically acceptable.

2.         The numbers generated by the RNG have passed Marsaglia's "diehard" tests for statistical randomness.

3.         Chi-squared test applied to a sample of die values obtained from the RNG indicated statistical randomness.

4.         Chi-squared test applied to a sample of pairs of die values (as used in backgammon) obtained from the RNG also indicated statistical randomness.

 

 

8.     Observations

1.         RNG Internal state

The RNG internal state is visible to other modules.  This implies a level of trust that other modules will not make use of internal RNG information.

iTech Labs recommends that the source code be modified to prevent other modules being able to see the RNG internal state.

2.         Thread safety

iTech Labs recommends that thread safety be turned on for the RNG module.

3.         Seeding

A time stamp is currently used for seeding.

iTech Labs recommends the use of either a previous (e.g. cycled) RNG value, or some less externally predictable value (e.g. thread timing) in addition to system time to seed the RNG.

4.         Cycling

Cycling the RNG (i.e. taking out some values in addition to those used by the games) ensures that the sequence of numbers delivered to games is not predictable, even if the last RNG value and the algorithm were known.  This provides a very high level of surety that the next number cannot be predicted.  (Note that using a single instance of the RNG shared by all games on the site has the same effect i.e. the next RNG number could go to any one of the many clients requesting an RNG number).

iTech Labs recommends that the RNG be cycled by a separate process several times per second.

5.         Scaling

Simple scaling is currently used (i.e. y =- rand % 6 + 1).

Although this is proved to be sufficiently random in our tests, iTech Labs recommends the use of the following perfectly weighted algorithm:

Calculate the maximum value within the RNG output range which is exactly divisible by the scaling range.  In this case the scaling range is 6, so this number should be (MAXINT % 6) * 6, where MAXINT is the largest number the RND can generate, and % means integer division;

When a random number is required, generate one, but if it is greater than the number above, get another random number instead.

The scaling rand % 6 + 1 is now perfectly weighted i.e. there is exactly the same change of generating a 1 as a 6.

The current simple scaling for a 16 bit RNG output has the numbers 1 to 4 appearing slightly more often by 1 in 16384, or about 0.0031% than for the perfectly weighted algorithm.  Similarly 5 and 6 appear about 0.0061% less often than for the perfectly weighted algorithm.

This difference was not significant in our statistical tests, but is recommended none the less.

 

 

9.     Recommendation

Date of Request: 31 August 2005                      Date of Recommendation: 21 October, 2005

System/Module: Lucky Skill RNG                       Total number of pages: 6

Operator: Lucky Skill                                        Software provider: Lucky Skill Ltd.

Recommendation for Certification:

iTech Labs certifies that Lucky Skill RNG provides suitable random numbers for use with die rolls for backgammon games.

 

Audit method:

iTech Labs holds a copy of Lucky Skill’s certified source code.  At any future time the source code used by Lucky Skill can be compared to the reference source code held by iTech Labs.

 

 

10.       Conditions of the Recommendation

1.         The source code provided to iTech Labs (as per Appendix-A) must be used for compilation of the RNG module.

2.         Any change to the RNG source code must be verified by iTech Labs.

 

11.       Conclusion

While it is not possible to test all possible scenarios in a laboratory environment, iTech Labs has conducted a level of testing appropriate for a submission of this type.

 

Accordingly, subject to the above comment, iTech Labs certifies that the item under test complies with industry standard requirements, unless otherwise stated.

 

 

 

 

 

Geoff Nicoll

Principal Consultant

 

iTech Labs Australia

 

Date: 21 October, 2005

 

 

 

Appendix-A

 

 

Md5sum of RNG source files

970cb5fedd64b9d6af7a997185992784 *random_generator.cpp

448a518759124d3cdcb9f58d6266950c *random_generator.h

 

Notes:

random_generator_21Oct05.zip file contains the following:

random_generator.cpp      (source code)

random_generator.h          (source code)

md5summer.exe   (program used to generate md5 sum of the above two source files)

random_generator.md5     (md5 sum of random_generator.cpp and random_generator.h)