Random sampling and randomization procedures

ISO 24153:2009 defines procedures for random sampling and randomization. Several methods are provided, including approaches based on mechanical devices, tables of random numbers, and portable computer algorithms.
ISO 24153:2009 is applicable whenever a regulation, contract, or other standard requires random sampling or randomization to be used. The methods are applicable to such situations as
a) acceptance sampling of discrete units presented for inspection in lots,
b) sampling for survey purposes,
c) auditing of quality management system results, and
d) selecting experimental units, allocating treatments to them, and determining evaluation order in the conduct of designed experiments.
Information is also included to facilitate auditing or other external review of random sampling or randomization results where this is required by quality management personnel or regulatory bodies.
ISO 24153:2009 does not provide guidance as to the appropriate random sampling or randomization procedures to be used for any particular experimental situation or give guidance with respect to possible sampling strategy selection or sample size determination. Other ISO International Standards (such as ISO 2859, ISO 3951, ISO 8422, ISO 8423, ISO 13448, ISO 14560, ISO 18414, ISO 21247 and ISO 11648) or authoritative references should be consulted for guidance in such areas.

Modes opératoires d'échantillonnage et de répartition aléatoires

Naključno vzorčenje in postopki za doseganje naključnosti

Ta mednarodni standard opredeljuje postopke naključnega vzorčenja in doseganja naključnosti. Na voljo je več metod, vključno s pristopi, osnovanimi na mehanskih napravah, preglednicah naključnih številk in prenosnih računalniških algoritmih. Ta mednarodni standard velja, kadar predpis, pogodba ali drug standard zahteva uporabo naključnega vzorčenja ali doseganja naključnosti. Te metode veljajo v situacijah, kot je a) prevzemno vzorčenje diskretnih enot, predstavljenih za kontrolo po partijah, b) vzorčenje za namene študije, c) revizija rezultatov sistema vodenja kakovosti ter d) izbiranje eksperimentalnih enot, razporejanje njihovih obdelav in določevanje vrste vrednotenja pri izvajanju zasnovanih eksperimentov. Vključene so tudi informacije, ki olajšajo revizijo ali drug zunanji pregled rezultatov naključnega vzorčenja oziroma doseganja naključnosti, kjer to zahteva osebje za vodenje kakovosti ali regulatorni organi. Ta mednarodni standard ne določa vodila glede primernega naključnega vzorčenja oziroma postopkov za doseganje naključnosti za uporabo v kakršni koli posebni eksperimentalni situaciji in ne podaja vodila v zvezi z možno izbiro strategije vzorčenja ali določevanjem velikosti vzorca. Pri drugih ISO standardih (kot tistih, ki so navedeni v uvodu) ali veljavnih sklicih se je potrebno posvetovati glede vodila na takšnih področjih.

General Information

Status
Published
Publication Date
07-Jun-2010
Technical Committee
Current Stage
6060 - National Implementation/Publication (Adopted Project)
Start Date
31-May-2010
Due Date
05-Aug-2010
Completion Date
08-Jun-2010
Standard
SIST ISO 24153:2010
English language
36 pages
sale 10% off
Preview
sale 10% off
Preview
e-Library read for
1 day
Standard
ISO 24153:2009 - Random sampling and randomization procedures
English language
31 pages
sale 15% off
Preview
sale 15% off
Preview

Standards Content (Sample)


SLOVENSKI STANDARD
01-julij-2010
1DNOMXþQRY]RUþHQMHLQSRVWRSNL]DGRVHJDQMHQDNOMXþQRVWL
Random sampling and randomization procedures
Modes opératoires d'échantillonnage et de répartition aléatoires
Ta slovenski standard je istoveten z: ISO 24153:2009
ICS:
03.120.30 8SRUDEDVWDWLVWLþQLKPHWRG Application of statistical
methods
2003-01.Slovenski inštitut za standardizacijo. Razmnoževanje celote ali delov tega standarda ni dovoljeno.

INTERNATIONAL ISO
STANDARD 24153
First edition
2009-12-01
Random sampling and randomization
procedures
Modes opératoires d'échantillonnage et de répartition aléatoires

Reference number
©
ISO 2009
PDF disclaimer
This PDF file may contain embedded typefaces. In accordance with Adobe's licensing policy, this file may be printed or viewed but
shall not be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In
downloading this file, parties accept therein the responsibility of not infringing Adobe's licensing policy. The ISO Central Secretariat
accepts no liability in this area.
Adobe is a trademark of Adobe Systems Incorporated.
Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation
parameters were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In
the unlikely event that a problem relating to it is found, please inform the Central Secretariat at the address given below.

©  ISO 2009
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means,
electronic or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or
ISO's member body in the country of the requester.
ISO copyright office
Case postale 56 • CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 749 09 47
E-mail copyright@iso.org
Web www.iso.org
Published in Switzerland
ii © ISO 2009 – All rights reserved

Contents Page
Foreword .iv
Introduction.v
1 Scope.1
2 Normative references.1
3 Terms, definitions, and symbols .1
4 General .5
5 Random sampling — Mechanical device methods.6
6 Pseudo-independent random sampling — Table method.7
7 Pseudo-independent random sampling — Computer method.7
8 Applications to common sampling situations .11
Annex A (normative) Random number tables.18
Annex B (informative) Random number generation algorithm computer code .22
Annex C (informative) Random sampling and randomization computer code .25
Bibliography.31

Foreword
ISO (the International Organization for Standardization) is a worldwide federation of national standards bodies
(ISO member bodies). The work of preparing International Standards is normally carried out through ISO
technical committees. Each member body interested in a subject for which a technical committee has been
established has the right to be represented on that committee. International organizations, governmental and
non-governmental, in liaison with ISO, also take part in the work. ISO collaborates closely with the
International Electrotechnical Commission (IEC) on all matters of electrotechnical standardization.
International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, Part 2.
The main task of technical committees is to prepare International Standards. Draft International Standards
adopted by the technical committees are circulated to the member bodies for voting. Publication as an
International Standard requires approval by at least 75 % of the member bodies casting a vote.
Attention is drawn to the possibility that some of the elements of this document may be the subject of patent
rights. ISO shall not be held responsible for identifying any or all such patent rights.
ISO 24153 was prepared by Technical Committee ISO/TC 69, Applications of statistical methods,
Subcommittee SC 5, Acceptance sampling.
iv © ISO 2009 – All rights reserved

Introduction
Random sampling and randomization procedures are the cornerstone to the validity of many statistical
methods used in experimentation, whether for industrial quality control and improvement purposes or for
designed experiments in the medical, biological, agricultural, or other scientific fields. Many statistical
standards address the conduct of such experimentation. In particular, all of the following acceptance-sampling
standards have been designed on the premise that random sampling is employed to select the required
sampling units for lot disposition purposes:
ISO 2859 (all parts), Sampling procedures for inspection by attributes
ISO 3951 (all parts), Sampling procedures for inspection by variables
ISO 8422, Sequential sampling plans for inspection by attributes
ISO 8423, Sequential sampling plans for inspection by variables for percent nonconforming (known
standard deviation)
ISO 13448 (all parts), Acceptance sampling procedures based on the allocation of priorities principle
(APP)
ISO 14560, Acceptance sampling procedures by attributes — Specified quality levels in nonconforming
items per million
ISO 18414, Acceptance sampling procedures by attributes — Accept-zero sampling system based on
credit principle for controlling outgoing quality
ISO 21247, Combined accept-zero sampling systems and process control procedures for product
acceptance
In addition, ISO 2859-3 and ISO 21247 include provisions for random sampling to be applied to determine
whether a lot should be inspected or not under skip-lot sampling procedures, and to decide which units require
inspection from a production process under continuous sampling plans, respectively. Consequently, it is of
great importance to the valid operation of all of the above standards that sampling be effectively random in its
application.
Although the principles of this International Standard are universally applicable where random sampling is
required and the sampling units can be clearly defined, preferably on the basis of discrete items, there are
many situations in which the material of interest does not lend itself to being quantified on a discrete-item
basis, as in the case of a bulk material. In such situations, the user is advised to consult the following ISO
International Standards for appropriate guidance:
ISO 11648 (all parts), Statistical aspects of sampling from bulk materials

INTERNATIONAL STANDARD ISO 24153:2009(E)

Random sampling and randomization procedures
1 Scope
This International Standard defines procedures for random sampling and randomization. Several methods are
provided, including approaches based on mechanical devices, tables of random numbers, and portable
computer algorithms.
This International Standard is applicable whenever a regulation, contract, or other standard requires random
sampling or randomization to be used. The methods are applicable to such situations as
a) acceptance sampling of discrete units presented for inspection in lots,
b) sampling for survey purposes,
c) auditing of quality management system results, and
d) selecting experimental units, allocating treatments to them, and determining evaluation order in the
conduct of designed experiments.
Information is also included to facilitate auditing or other external review of random sampling or randomization
results where this is required by quality management personnel or regulatory bodies.
This International Standard does not provide guidance as to the appropriate random sampling or
randomization procedures to be used for any particular experimental situation or give guidance with respect to
possible sampling strategy selection or sample size determination. Other ISO standards (such as those listed
in the Introduction) or authoritative references should be consulted for guidance in such areas.
2 Normative references
The following referenced documents are indispensable for the application of this document. For dated
references, only the edition cited applies. For undated references, the latest edition of the referenced
document (including any amendments) applies.
ISO 3534-1, Statistics — Vocabulary and symbols — Part 1: General statistical terms and terms used in
probability
ISO 3534-2, Statistics — Vocabulary and symbols — Part 2: Applied statistics
ISO 3534-3, Statistics — Vocabulary and symbols — Part 3: Design of experiments
ISO 80000-2, Quantities and units — Part 2: Mathematical signs and symbols to be used in the natural
sciences and technology
3 Terms, definitions, and symbols
For the purposes of this document, the terms and definitions given in ISO 3534-1, ISO 3534-2, ISO 3534-3,
and the following apply.
3.1 Terms and definitions
3.1.1
cluster
part of a population (3.1.6) divided into mutually exclusive groups of sampling units (3.1.13) related in a
certain manner
[ISO 3534-2:2006, definition 1.2.28]
3.1.2
cluster sampling
sampling (3.1.12) in which a random sample (3.1.8) of clusters (3.1.1) is selected and all the sampling
units (3.1.13) which constitute the clusters are included in the sample (3.1.11)
[ISO 3534-2:2006, definition 1.3.9]
3.1.3
derangement
complete permutation
permutation of elements where no element remains in its original position in the set (e.g. {3, 1, 2} is a
derangement of {1, 2, 3})
3.1.4
lot
definite part of a population (3.1.6) constituted under essentially the same conditions as the population with
respect to the sampling (3.1.12) purpose
NOTE The sampling purpose can, for example, be to determine lot acceptability, or to estimate the mean value of a
particular characteristic.
[ISO 3534-2:2006, definition 1.2.4]
3.1.5
multistage sampling
sampling (3.1.12) in which the sample (3.1.11) is selected by stages, the sampling units (3.1.13) at each
stage being sampled from the larger sampling units chosen at the previous stage
NOTE Multistage sampling is different from multiple sampling. Multiple sampling is sampling by several criteria at the
same time.
[ISO 3534-2:2006, definition 1.3.10]
3.1.6
population
〈reference〉 totality of items under consideration
[ISO 3534-2:2006, definition 1.2.1]
3.1.7
pseudo-independent random sampling
sampling (3.1.12) where a sample (3.1.11) of n sampling units (3.1.13) is taken from a population (3.1.6)
in accordance with a table of random numbers or a computer algorithm designed such that each of the
possible combinations of n sampling units has a particular probability of being taken (see also 4.4)
3.1.8
random sample
sample (3.1.11) selected by random sampling (3.1.9)
[ISO 3534-2:2006, definition 1.2.25]
2 © ISO 2009 – All rights reserved

3.1.9
random sampling
sampling (3.1.12) where a sample (3.1.11) of n sampling units (3.1.13) is taken from a population (3.1.6)
in such a way that each of the possible combinations of n sampling units has a particular probability of being
taken
[ISO 3534-2:2006, definition 1.3.5]
3.1.10
randomization
process by which a set of items are set into a random order
NOTE If, from a population (3.1.6) consisting of the natural numbers 1 to n, numbers are drawn at random (i.e. in
such a way that all numbers have the same chance of being drawn), one by one, successively, without replacement, until
the population is exhausted, the numbers are said to be drawn "in random order".
If these n numbers have been associated in advance with n distinct units or n distinct treatments that are then re-arranged
in the order in which the numbers are drawn, the order of the units or treatments is said to be randomized.
3.1.11
sample
subset of a population (3.1.6) made up of one or more sampling units (3.1.13)
[ISO 3534-2:2006, definition 1.2.17]
3.1.12
sampling
act of drawing or constituting a sample (3.1.11)
[ISO 3534-2:2006, definition 1.3.1]
3.1.13
sampling unit
unit
one of the individual parts into which a population (3.1.6) is divided
NOTE 1 A sampling unit can contain one or more items, for example, a box of matches, but one test result will be
obtained for it.
NOTE 2 A sampling unit can consist of discrete items or a defined amount of bulk material.
[ISO 3534-2:2006, definition 1.2.14]
3.1.14
sampling with replacement
sampling (3.1.12) in which each sampling unit (3.1.13) taken and observed is returned to the population
(3.1.6) before the next sampling unit is taken
[ISO 3534-2:2006, definition 1.3.15]
3.1.15
sampling without replacement
sampling (3.1.12) in which each sampling unit (3.1.13) is taken from the population (3.1.6) once only
without being returned to the population
[ISO 3534-2:2006, definition 1.3.16]
3.1.16
seed
numerical value or set of values used to initialize a pseudo-independent random sampling (3.1.7) algorithm
or to establish a starting point in a table of random numbers
3.1.17
simple random sample
sample (3.1.11) selected by simple random sampling (3.1.18)
[ISO 3534-2:2006, definition 1.2.24]
3.1.18
simple random sampling
sampling (3.1.12) where a sample (3.1.11) of n sampling units (3.1.13) is taken from a population (3.1.6)
in such a way that all possible combinations of n sampling units have the same probability of being taken
[ISO 3534-2:2006, definition 1.3.4]
3.1.19
stratified sampling
sampling (3.1.12) such that portions of the sample (3.1.11) are drawn from the different strata (3.1.21) and
each stratum is sampled with at least one sampling unit (3.1.13)
[ISO 3534-2:2006, definition 1.3.6]
3.1.20
stratified simple random sampling
simple random sampling (3.1.18) from each stratum (3.1.21)
[ISO 3534-2:2006, definition 1.3.7]
3.1.21
stratum
mutually exclusive and exhaustive sub-population considered to be more homogeneous with respect to the
characteristics investigated than the total population (3.1.6)
[ISO 3534-2:2006, definition 1.2.29]
3.2 Symbols
For the purposes of this document, the mathematical signs and symbols given in ISO 80000-2 and the
following apply.
d the ith (least significant) digit, or face value of a coin or die
i
N lot size
n sample size
n the size of the ith sample
i
U uniformly-distributed random real variable on the open range (0, 1)
x the ith value of the variable x
i
j! factorial j
⎡z⎤ ceiling function of z (returns the smallest integer greater than or equal to real value z)
⎣z⎦ floor function of z (returns the integer portion of real value z)
4 © ISO 2009 – All rights reserved

4 General
4.1 Random sampling is a prerequisite to the correct application of most sampling plans in industrial use.
Similarly, randomization, which uses the principles of random sampling, is indispensable in the conduct of
designed experiments, as it increases the internal validity of an experiment, allowing statistical methods to be
used in the interpretation of an experiment's results. The goal of random sampling is to provide a means of
applying the results of probability theory to practical problems, while avoiding any form of bias. This goal is not
attainable using certain other types of sampling. For example, sampling based on such concepts as personal
intuition or judgment, haphazardness, or quota-achievement are inherently biased and consequently can lead
to serious errors in the decision-making process, with no provision to assess risks. Equi-probable random
sampling seeks to eliminate such bias by ensuring that each unit in a lot has the same probability of being
selected (sampling with replacement) or, alternatively, that every possible sample of a given size from the lot
has the same probability of being selected (sampling without replacement).
4.2 Under equi-probable random sampling with replacement, the probability that a specific unit in a lot of N
n
units is selected at any given draw is always 1/N. There are N possible ordered random samples of n units
from N units and, for completeness, there are (N + n − 1)! / [n! (N − 1)!] possible different unordered random
samples of n units from N units (see the note below).
Under simple random sampling without replacement, the probability that a unit in a lot is selected at a given
draw is 1/N for the first draw, 1/(N − 1) for the second draw, 1/(N − 2) for the third draw, and so on. If n units
are randomly selected from a lot of N units without replacement, then each combination of n units has the
same probability of selection as every other combination of N units taken n at a time. The number of possible
different unordered random samples of n units from a lot of N units is N! / [n! (N − n)!], which is the number of
combinations of N units taken n at a time. It is equally noteworthy that the number of possible ordered random
samples of n units taken without replacement from a lot of N units is N! / (N − n)!, which is equivalent to the
number of possible permutations of N units taken n at a time. It should be noted that random sampling without
replacement is the most common sampling strategy used in acceptance sampling applications.
NOTE Under sampling with replacement based on a sample of, say, 3 units from 5 units, the lists {1, 1, 2}, {1, 2, 1},
and {2, 1, 1} are different when order is considered (and technically referred to as multisets or bags), but the same when
order is not considered.
4.3 The goal of random sampling can only be achieved by adhering to rigorous procedures that have been
carefully designed to achieve the intent of the definition. Several methods are presented in this International
Standard to implement this goal. The mechanical device methods, in particular, assume that the coins and
dice are unbiased, having been designed such that each side has the same probability of occurring during a
toss or throw, and that the manner of tossing or throwing is being performed so as not to introduce bias.
Furthermore, due to numerous deficiencies in the intrinsic implementations of random sampling methods in
calculators and computer operating systems, programming languages, and software (see References [9], [10],
[12], and [13] for further information), this International Standard has adopted a portable, proven method for
generating random samples by computer. In addition, it should be noted that all of the methods below require
that each distinct unit in a lot has been associated in advance with a distinct number from 1 to N, so that the
sampling units identified as a result of the random sampling method can be unambiguously obtained from the
lot.
4.4 Finally, to reduce awkwardness in presentation, the adjective "pseudo-independent" will often be
dropped when referring to such a random sampling procedure or method (see Reference [8]). Furthermore,
the adjective “random” will be used frequently in the sense that the noun it modifies (often a number or
permutation) is the output of a process that randomly generates such a number or permutation. In addition,
when examples are provided, the sample sizes involved are artificially kept small with the goal of simply
illustrating the concepts involved.
5 Random sampling — Mechanical device methods
5.1 Urn method
5.1.1 Place N distinctly-numbered but otherwise physically-identical objects (e.g. tickets, chips, or balls) into
an urn to unambiguously represent each of the N units in the lot and thoroughly mix the objects.
5.1.2 For sampling without replacement, blindly select objects from the urn, one by one without returning
them to the urn and optionally re-mixing the objects between successive draws, until the desired number n of
sampling units is obtained.
NOTE This method is commonly used by lottery agencies.
5.1.3 For sampling with replacement, blindly select objects from the urn, one by one, returning each object
to the urn after each draw and thoroughly re-mixing the objects between successive draws, until the desired
number n of sampling units is obtained. Using this method, the same unit may occur more than once in the
sample.
5.2 Coin or die method
5.2.1 Determine the number m of coins or dice (or coin tosses or die throws) required, where N is the lot
size and k is the number of sides of the device being used, according to the following equation:
mN=⎡⎤log logk
ee
5.2.2 Where multiple coins or dice are used, clearly associate each coin or die with a specific position in the
interpretation sequence of digits d . Where a single coin or die is used, assign the result of the first toss or
i
throw to the most significant digit d , the second toss or throw to the next most significant digit d , and so
m m − 1
on.
5.2.3 Toss the coins or throw the dice and record the m ordered results d . Translate the results to decimal
i
integers through the following equation:
m
mi−
yd=+1( −1)k
∑ i
i=1
5.2.4 Repeat step 5.2.3, discarding all values that exceed N and, in the case of sampling without
replacement, all values that have already been selected, until the desired number n of sampling units is
obtained.
EXAMPLE 1 An inspector wishes to obtain a random sample of 4 units from a lot of 20 units and has a single coin
available. From step 5.2.1, it is determined that m = 5 coin tosses are required to obtain each random number. It is
decided in advance that a head will have a face value of 1 and a tail a face value of 2. The first sequence of tosses yields
4 3 2 1 0
the multiset {1, 2, 1, 2, 2}, which through step 5.2.3 equates to 1 + (0)2 + (1)2 + (0)2 + (1)2 + (1)2 = 12. The following
three sequences of tosses yield the multisets {1, 2, 2, 2, 1}, {1, 1, 2, 2, 1}, and {2, 2, 1, 2, 2}, which equate to 15, 7, and 28,
respectively. Since the value 28 exceeds the lot size, it needs to be discarded and additional sequences of tosses need to
be performed until one more valid number is obtained to complete the random sample.
EXAMPLE 2 A random sample of 4 units from a lot of 50 units is required and the inspector has access to several six-
sided dice of different colours. From step 5.2.1, it is determined that m = 3 dice are required to obtain each random
number. The inspector chooses a blue, a green, and a red die and ranks them from most significant to least significant in
that same order. However, it is evident upon examining the equation of 5.2.3 that numbers within the valid range from 1 to
50 will only result when the first die face is either 1 or 2. Consequently, some efficiency can be obtained by mapping the
higher face values of the blue die to either 1 or 2 without distorting the outcome probabilities. The inspector decides in
advance for odd face values on the blue die to be treated as 1 and even face values to be treated as 2. The first roll yields
2 1 0
the multiset {3, 3, 4}, which through step 5.2.3 equates to 1 + (2)6 + (2)6 + (3)6 = 88, which is too large but when
transformed to {1, 3, 4} equates to 16. Three more rolls yield {6, 1, 3}, (which transforms to {2, 1, 3}), {5, 6, 6}, (which
transforms to {1, 6, 6}), and {2, 5, 5}, which equate to 39, 36, and 65, respectively. Since the value 65 exceeds the lot size,
it needs to be discarded and additional throws need to be made until one more valid number is obtained to complete the
random sample.
6 © ISO 2009 – All rights reserved

EXAMPLE 3 The same scenario as in Example 2 exists but this time the inspector observes that three dice will
produce numbers ranging from 1 to 6 = 216, yet the lot size is only 50. The inspector decides in advance to map all
outcomes from 1 to 200 to the range from 1 to 50 and discard any outcome greater than 200 to avoid distorting the
outcome probabilities. The same four rolls from the previous example are evaluated under this mapping scheme. The
multisets {3, 3, 4}, {6, 1, 3}, {5, 6, 6}, and {2, 5, 5} equate to 88, 183, 180, and 65. Multiples of 50 are subtracted from
these numbers until each of them is within the range from 1 to 50 (if 0 is obtained, interpret it as N), resulting in the sample
values of 38, 33, 30, and 15, respectively. A sample size of 4 units has been obtained so no further throws are necessary.
Note that, mathematically, this mapping process is equivalent to applying the equation v = 1 + (v − 1) modulo N, where
2 1
v is the initial value and v is the value mapped into the desired range.
1 2
6 Pseudo-independent random sampling — Table method
6.1 Random number tables
Two tables of random numbers are provided in Annex A. The tables each consist of 3 600 random digits from
0 to 9, arranged in 60 rows by 60 columns. Their usage is briefly described below and in more detail in
Annex A.
NOTE The digits in the table are directly analogous to the face values of a 10-sided die repeatedly thrown and
recorded. The number of digits m required for a sampling application corresponds to the number of dice throws.
6.2 Basic method
6.2.1 Determine the number of digits m necessary to represent the lot size N. Where the lot size is an
integral power of 10, ignore the initial digit in the lot size and interpret that remaining zeroes as equal to the lot
size value (e.g. if N = 1 000, interpret the value 000 as 1 000).
6.2.2 Randomly select a starting point (i.e. row and column value) in the table using a method described in
A.2.2.
6.2.3 Read the resulting digit in conjunction with the m − 1 digits to the right as a single number and record
the value. Where the digits to the right would exceed the 60th column, treat columns 1, 2, and so on as
columns 61, 62, and so on, respectively.
6.2.4 Increase the row value by one, repeat step 6.2.3, and record the value. Where this row value would
exceed the 60th row, treat row 1 as the 61st row and increase the column values each by m digits.
6.2.5 Repeat step 6.2.4, discarding all values that exceed N and, in the case of sampling without
replacement, all values that have already been selected, until the desired number of sampling units n is
obtained.
EXAMPLE An auditor wishes to select a random sample of 5 units from a lot of 200 units. A random starting point is
determined by coin tosses to be row 57 and column 59 and it is decided to use Table A.1. Since N is small in comparison
to the maximum value capable of being represented by 3 digits (i.e. 1 000), the auditor decides to map the results of the
range from 1 to 1 000 onto the range from 1 to 200. The following five numbers result: 848, 670, 902, 034, and 518. The
translated sample values become 48, 70, 102, 34, and 118.
7 Pseudo-independent random sampling — Computer method
7.1 Overview
7.1.1 This International Standard adopts a specific system of algorithms developed in References [1], [7],
and [13]. The algorithms have been designed to possess the mathematical and statistical properties required
for random sampling as well as to be portable with respect to implementation in different programming
languages on different computer platforms and to facilitate verification and auditing of the selected sample
values, which might be required for regulatory purposes. An example implementation of the key program
segments is provided in Annex B using the C programming language.
7.1.2 The system of algorithms involves two major sub-systems:
a) an optional initialization algorithm that automatically generates a quasi-random seed integer based on
elapsed time from a reference date; and
b) a random number generator.
7.1.3 For verification or auditing purposes, the optional initialization algorithm mentioned in 7.1.2 a) and
described in 7.2 would be by-passed with a manually-entered seed value. This value needs to be within the
integer range from 1 and 2 147 483 398 inclusive. A copy of this input value is saved for records purposes
when required. However, in general usage for quality control and designed experiment applications, there
should be infrequent need to by-pass the option of automatic random seed generation, which should be the
default option in practice.
NOTE The presentations of the steps of the algorithms in this clause have been kept in a more mathematical format
to aid in programming. Programming code with clause references has been included in Annex B to supplement
implementation of this clause.
7.2 Initialization algorithm
7.2.1 The initialization algorithm consists of:
a) an elapsed time computation algorithm, referenced to a fixed past date and time; and
b) a random number generation algorithm based on the uniform distribution, called a random number of
times based on the output of item a) above, to obtain a random seed based on the time-based input.
7.2.2 The following algorithm determines the number of seconds that has elapsed since 2000-01-01
00:00:00 to the current date and time.
a) Capture the computer system's date and time to a string variable, save a copy of the variable for records
purposes, and then parse the string into its time components (i.e. year, month, day, hour, minute, and
second).
b) Compute the number of fully elapsed days d since the reference time point, using the current date's full
e
four-digit year y, month m , and day d numerical values processed as follows:
if m < 3, then let m = m + 12 and let y = y − 1
1 1 1
d = d + ⎣(153 m − 457) / 5⎦ + 365 y + ⎣y / 4⎦ − ⎣y / 100⎦ + ⎣y / 400⎦ − 730 426
e 1
NOTE The equation for d may be slightly simplified for calendar years up to and including 2099 by replacing the
e
terms following ⎣y / 4⎦ by “− 730 441”.
c) Compute the total number of seconds s elapsed since the reference date using the quantity obtained in
e
step b) and the time of day (in 24-hour “hh:mm:ss” format) captured in the string variable in step a) in
accordance with the following equation:
s = 86 400 d + 3 600 h + 60 m + s
e e 2
where h, m and s are the hours, minutes and seconds, respectively.
NOTE 1 Some programming languages have built-in functions to perform the calculation of s directly. Such intrinsic
e
functions should be validated before use, to ensure the effects of leap years and daylight saving time are properly handled.
NOTE 2 In 32-bit implementations of this algorithm, the value of s will increase over time to the point of causing
e
computational overflow. Care should be taken in programming to ensure its output value is always mapped on the range
from 1 to 2 147 483 398 inclusive.
8 © ISO 2009 – All rights reserved

d) The value resulting from step c) is the initializing seed for the random seed generator and is used to
obtain the final seed. A copy of this value is saved to a separate variable for records purposes when
required.
e) The number of times j that the subsequent random number generator is to be called is a random integer
between 1 and 100 inclusive, based on the two least significant digits of the value obtained in step c)
increased by 1, which may be expressed as follows:
j = s − 100 ⎣s / 100⎦ + 1
e e
7.2.3 The random number generator for the automatic seed generation (initialization function) algorithm
takes the form of the linear congruential recurrence relation:
a) x = 40 692 x mod 2 147 483 399,
i + 1 i
which can be implemented on computers capable of handling 32-bit integers via the following steps:
b) k = ⎣x / 52 774⎦;
i
c) x = 40 692 (x − 52 774 k) − 3 791 k;
i + 1 i
d) If x < 0, then let x = x + 2 147 483 399.
i + 1 i + 1 i + 1
7.2.4 Generate the seed to the random sampling algorithm by assigning the result from 7.2.2 c) to x and
i
then calling the formula in 7.2.3 j times per step 7.2.2 e), replacing x with x each time until the required
i i + 1
number of calls are made.
7.2.5 The final value of x resulting from step 7.2.4 is a random integer between 1 and 2 147 483 398
i + 1
inclusive and serves as the initial seed to the random sampling algorithm described in 7.3 [in particular, the
value y in step 7.3.6 b)]. A copy of this value is saved to a separate variable for records purposes when
i
required.
7.3 Random number generation algorithm
7.3.1 The random number generation algorithm consists of
a) a shuffling array that is populated by a uniform-distribution random number generation algorithm, and
b) a combination, uniform-distribution random number generation algorithm.
7.3.2 Create a 32-element array A to serve as a means of shuffling the output of the random sampling
algorithm.
7.3.3 The following random number generator is used to populate the shuffling array:
a) x = 40 014 x mod 2 147 483 563,
i + 1 i
which can be implemented on 32-bit computers via the following steps:
b) k = ⎣x / 53 668⎦;
i
c) x = 40 014 (x − 53 668 k) − 12 211 k;
i + 1 i
d) If x < 0, then let x = x + 2 147 483 563.
i + 1 i + 1 i + 1
7.3.4 Initialize the array A by assigning the result from 7.1.3 or 7.2.5 to x and then calling the generator
i
given in 7.3.3 a) 40 times, replacing x with x on each call, discarding the first 8 values, and then assigning
i i + 1
each of the remaining 32 output values of x to the array in reverse order (i.e. from element 32 down to
i + 1
element 1).
7.3.5 Set element 1 of array A (i.e. A[1]) as the initializing value k to the combination random number
generation algorithm.
7.3.6 The combination random number generator for random sample generation takes the form of the
following combination of linear congruential recurrence relations and array index determination steps:
a) x = 40 014 x mod 2 147 483 563;
i + 1 i
b) y = 40 692 y mod 2 147 483 399;
i + 1 i
c) J = ⎣32 k / 2 147 483 563⎦ + 1;
d) k = A[J] − y ;
i + 1
e) A[J] = x ;
i + 1
f) If k < 1, then let k = k + 2 147 483 562.
NOTE The two random number generators above are those described in 7.2.3 and 7.3.3 (refer to those subclauses if
32-bit equivalent implementations are required).
7.3.7 The algorithm in 7.3.6 is initialized by setting x to the final value of x from 7.3.4 and setting y to
i i + 1 i
the value referenced in 7.2.5. The values x and y serve as the subsequent values of x and y for all
i + 1 i + 1 i i
subsequent calls to the algorithm. A random index J to the shuffling array A is calculated using the value of k
(from 7.3.5 initially), and the difference between A[J] and y is assigned to k, while A[J] is updated with x
i + 1 i + 1.
Finally, the value of k is altered if necessary to produce a positive value.
7.3.8 The output of the random sampling algorithm is the value k, which is a random number between 1 and
2 147 483 562 inclusive, scaled as a standard uniformly-distributed real variable U over the range from 0 to 1,
exclusive of the endpoint values of this range, as follows: U = k / 2 147 483 563.
7.3.9 The output from 7.3.8 may be scaled as a uniformly-distributed integer variable L over the range from
1 to N, inclusive, as follows: L = ⎣N U⎦ + 1.
7.3.10 To generate a random sample, steps 7.3.6 to 7.3.9 are repeated until the desired number of random
values is obtained.
7.4 Audit records
When records are required to be maintained for audit purposes by a responsible authority or regulatory body,
record the lot size and the sample size.
In addition, with respect to the algorithms, record the manually entered seed per 7.1.3, or if the random seed
generator is used, record the
a) computer system's date and time used to compute this initial seed,
b) initial seed's value per 7.2.2 d), and
c) final seed's value per 7.2.5.
10 © ISO 2009 – All rights reserved

8 Applications to common sampling situations
8.1 General
8.1.1 This clause provides algorithms for several random sampling strategies to suit various practical
situations.
8.1.2 Throughout this clause, U is defined as a random real variable, uniformly-distributed in the range from
0 to 1, exclusive of the endpoint values of the range, such as provided by the algorithm in 7.3. If another
source is used for U and the output is known to include 1 but not 0 as the endpoint values of the range, set U
equal to 1 − U. If the alternate source of U includes 0 and 1 as endpoint values of its range, the value 1 needs
to be trapped and discarded.
8.2 Random integer in a range
A random integer K in the range from M to N inclusive may be generated according to the following algorithm.
a) Generate a random real value U.
b) Set K equal to M + ⎣U (N − M + 1)⎦.
8.3 Random permutation
For an array A with N distinct elements, a random permutation of N units taken n at a time may be generated
according to the following shuffling algorithm.
a) Assign the N distinct element index values in original order to A[1:N].
b) Set J equal to 1.
c) Generate a random integer K in the range from J to N inclusive.
d) Swap A[J] and A[K].
e) Increment J by 1.
f) If J is less than or equal to n, go to step c).
g) Obtain the random permutation from the first n values of array A.
8.4 Random derangement
For an array A with N distinct elements, a random derangement of N units may be generated according to the
following algorithm.
a) Assign the N distinct element index values in original order to A[1:N] and make a copy in array B[1:N].
b) Using array B, generate a random permutation of N units taken N (i.e. all) at a time, using the method
given in 8.3.
c) Compare the elements from 1 to N of arrays A and B for equality.
d) If any element of array B is equal to its counterpart in array A, cease the comparison and go to step b).
e) Obtain the random derangement from array B.
NOTE This algorithm can be made more efficient in steps b) and c) by comparing element A[J] with element B[J] as
soon as B[J] has been determined, rather than waiting for the full permutation of array B.
8.5 Random sampling with replacement
A single random sample of n units from a lot of N units may be generated with replacement according to the
following algorithm.
a) Generate a random integer K in the range from 1 to N inclusive.
b) Repeat step a) until n values of K are obtained.
NOTE This method may be applied repeatedly to obtain any number of samples, of any size. If the resulting values of
a single sample are not sorted, that sample may be used for sequential sampling inspection.
8.6 Random sampling without replacement
A single random sample of n distinct units from a lot of N units may be generated without replacement by
either of the following methods.
a) Method 1
1) Generate a random integer K in the range from 1 to N inclusive.
2) Verify that the value of K has not been previously generated; if it is distinct, store the value, otherwise
discard it.
3) Repeat steps 1) and 2) until n different values of K are obtained.
b) Method 2
1) Generate a random permutation of N units taken n at a time in accordance with 8.3.
2) Use the first n values in the output array A as the random sample.
NOTE Either of these methods may be used to obtain any number of samples of any size (for such purposes as
double or multiple sampling) by using the total n of the individual sample sizes n as the input value of n to the algorithm,
t i
leaving the values in original output order, then taking the first n resulting values as the first sample, the next n resulting
1 2
values as the second sample, and so forth. Furthermore, if the resulting values of a single sample are not sorted, that
sample may be used for sequential sampling inspection by inspecting each unit in the order selected.
8.7 Random sampling for continuous sampling plans (CSP)
A CSP-1 continuous sampling plan is designed for application to the quality control of a production line and
alternates between qualifying periods of 100 % inspection requiring i consecutively-accepted units before
being followed by periods of sampling inspection at probability f, with reversion to 100 % inspection upon
finding an unacceptable unit. During periods of sampling inspection, units from the production line may be
selected for inspection in accordance with either of the following methods.
a) Method 1
1) For each unit of production, generate a random real value U.
2) If U is less than or equal to f, choose the unit for sample inspection.
3) Repeat steps 1) and 2) until an unacceptable unit is obtained.
b) Method 2
1) For each production segment of n units, where n equals 1/f, generate a random integer K over the
range from 1 to n inclusive.
12 © ISO 2009 – All rights reserved

2) Choose the unit corresponding to K as a sampling unit for inspection.
3) Repeat steps 1) and 2) until an unacceptable unit is obtained.
NOTE For CSP-1 plans, the value f is specified as the reciprocal of an integer.
8.8 Stratified random sampling
For a lot composed of two or more strata of size N , select a single random sample of size n from each
i i
stratum i using the methods given in 8.3 or 8.6 when sampling without replacement is required, or the method
given in 8.5 when sampling with replacement is required.
8.9 Single random sampling from an initially unknown lot size
A single random sample of n different units from a lot of initially unknown size, but at least equal to size n, may
be obtained according to the following method (adapted from Reference [11]).
a) Assign the first n units from the lot to the sample array A[1:n].
b) If another unit exists in the lot listing, set N equal to the count of the next unit; otherwise, go to step f).
c) Generate a random integer K
...


INTERNATIONAL ISO
STANDARD 24153
First edition
2009-12-01
Random sampling and randomization
procedures
Modes opératoires d'échantillonnage et de répartition aléatoires

Reference number
©
ISO 2009
PDF disclaimer
This PDF file may contain embedded typefaces. In accordance with Adobe's licensing policy, this file may be printed or viewed but
shall not be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In
downloading this file, parties accept therein the responsibility of not infringing Adobe's licensing policy. The ISO Central Secretariat
accepts no liability in this area.
Adobe is a trademark of Adobe Systems Incorporated.
Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation
parameters were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In
the unlikely event that a problem relating to it is found, please inform the Central Secretariat at the address given below.

©  ISO 2009
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means,
electronic or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or
ISO's member body in the country of the requester.
ISO copyright office
Case postale 56 • CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 749 09 47
E-mail copyright@iso.org
Web www.iso.org
Published in Switzerland
ii © ISO 2009 – All rights reserved

Contents Page
Foreword .iv
Introduction.v
1 Scope.1
2 Normative references.1
3 Terms, definitions, and symbols .1
4 General .5
5 Random sampling — Mechanical device methods.6
6 Pseudo-independent random sampling — Table method.7
7 Pseudo-independent random sampling — Computer method.7
8 Applications to common sampling situations .11
Annex A (normative) Random number tables.18
Annex B (informative) Random number generation algorithm computer code .22
Annex C (informative) Random sampling and randomization computer code .25
Bibliography.31

Foreword
ISO (the International Organization for Standardization) is a worldwide federation of national standards bodies
(ISO member bodies). The work of preparing International Standards is normally carried out through ISO
technical committees. Each member body interested in a subject for which a technical committee has been
established has the right to be represented on that committee. International organizations, governmental and
non-governmental, in liaison with ISO, also take part in the work. ISO collaborates closely with the
International Electrotechnical Commission (IEC) on all matters of electrotechnical standardization.
International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, Part 2.
The main task of technical committees is to prepare International Standards. Draft International Standards
adopted by the technical committees are circulated to the member bodies for voting. Publication as an
International Standard requires approval by at least 75 % of the member bodies casting a vote.
Attention is drawn to the possibility that some of the elements of this document may be the subject of patent
rights. ISO shall not be held responsible for identifying any or all such patent rights.
ISO 24153 was prepared by Technical Committee ISO/TC 69, Applications of statistical methods,
Subcommittee SC 5, Acceptance sampling.
iv © ISO 2009 – All rights reserved

Introduction
Random sampling and randomization procedures are the cornerstone to the validity of many statistical
methods used in experimentation, whether for industrial quality control and improvement purposes or for
designed experiments in the medical, biological, agricultural, or other scientific fields. Many statistical
standards address the conduct of such experimentation. In particular, all of the following acceptance-sampling
standards have been designed on the premise that random sampling is employed to select the required
sampling units for lot disposition purposes:
ISO 2859 (all parts), Sampling procedures for inspection by attributes
ISO 3951 (all parts), Sampling procedures for inspection by variables
ISO 8422, Sequential sampling plans for inspection by attributes
ISO 8423, Sequential sampling plans for inspection by variables for percent nonconforming (known
standard deviation)
ISO 13448 (all parts), Acceptance sampling procedures based on the allocation of priorities principle
(APP)
ISO 14560, Acceptance sampling procedures by attributes — Specified quality levels in nonconforming
items per million
ISO 18414, Acceptance sampling procedures by attributes — Accept-zero sampling system based on
credit principle for controlling outgoing quality
ISO 21247, Combined accept-zero sampling systems and process control procedures for product
acceptance
In addition, ISO 2859-3 and ISO 21247 include provisions for random sampling to be applied to determine
whether a lot should be inspected or not under skip-lot sampling procedures, and to decide which units require
inspection from a production process under continuous sampling plans, respectively. Consequently, it is of
great importance to the valid operation of all of the above standards that sampling be effectively random in its
application.
Although the principles of this International Standard are universally applicable where random sampling is
required and the sampling units can be clearly defined, preferably on the basis of discrete items, there are
many situations in which the material of interest does not lend itself to being quantified on a discrete-item
basis, as in the case of a bulk material. In such situations, the user is advised to consult the following ISO
International Standards for appropriate guidance:
ISO 11648 (all parts), Statistical aspects of sampling from bulk materials

INTERNATIONAL STANDARD ISO 24153:2009(E)

Random sampling and randomization procedures
1 Scope
This International Standard defines procedures for random sampling and randomization. Several methods are
provided, including approaches based on mechanical devices, tables of random numbers, and portable
computer algorithms.
This International Standard is applicable whenever a regulation, contract, or other standard requires random
sampling or randomization to be used. The methods are applicable to such situations as
a) acceptance sampling of discrete units presented for inspection in lots,
b) sampling for survey purposes,
c) auditing of quality management system results, and
d) selecting experimental units, allocating treatments to them, and determining evaluation order in the
conduct of designed experiments.
Information is also included to facilitate auditing or other external review of random sampling or randomization
results where this is required by quality management personnel or regulatory bodies.
This International Standard does not provide guidance as to the appropriate random sampling or
randomization procedures to be used for any particular experimental situation or give guidance with respect to
possible sampling strategy selection or sample size determination. Other ISO standards (such as those listed
in the Introduction) or authoritative references should be consulted for guidance in such areas.
2 Normative references
The following referenced documents are indispensable for the application of this document. For dated
references, only the edition cited applies. For undated references, the latest edition of the referenced
document (including any amendments) applies.
ISO 3534-1, Statistics — Vocabulary and symbols — Part 1: General statistical terms and terms used in
probability
ISO 3534-2, Statistics — Vocabulary and symbols — Part 2: Applied statistics
ISO 3534-3, Statistics — Vocabulary and symbols — Part 3: Design of experiments
ISO 80000-2, Quantities and units — Part 2: Mathematical signs and symbols to be used in the natural
sciences and technology
3 Terms, definitions, and symbols
For the purposes of this document, the terms and definitions given in ISO 3534-1, ISO 3534-2, ISO 3534-3,
and the following apply.
3.1 Terms and definitions
3.1.1
cluster
part of a population (3.1.6) divided into mutually exclusive groups of sampling units (3.1.13) related in a
certain manner
[ISO 3534-2:2006, definition 1.2.28]
3.1.2
cluster sampling
sampling (3.1.12) in which a random sample (3.1.8) of clusters (3.1.1) is selected and all the sampling
units (3.1.13) which constitute the clusters are included in the sample (3.1.11)
[ISO 3534-2:2006, definition 1.3.9]
3.1.3
derangement
complete permutation
permutation of elements where no element remains in its original position in the set (e.g. {3, 1, 2} is a
derangement of {1, 2, 3})
3.1.4
lot
definite part of a population (3.1.6) constituted under essentially the same conditions as the population with
respect to the sampling (3.1.12) purpose
NOTE The sampling purpose can, for example, be to determine lot acceptability, or to estimate the mean value of a
particular characteristic.
[ISO 3534-2:2006, definition 1.2.4]
3.1.5
multistage sampling
sampling (3.1.12) in which the sample (3.1.11) is selected by stages, the sampling units (3.1.13) at each
stage being sampled from the larger sampling units chosen at the previous stage
NOTE Multistage sampling is different from multiple sampling. Multiple sampling is sampling by several criteria at the
same time.
[ISO 3534-2:2006, definition 1.3.10]
3.1.6
population
〈reference〉 totality of items under consideration
[ISO 3534-2:2006, definition 1.2.1]
3.1.7
pseudo-independent random sampling
sampling (3.1.12) where a sample (3.1.11) of n sampling units (3.1.13) is taken from a population (3.1.6)
in accordance with a table of random numbers or a computer algorithm designed such that each of the
possible combinations of n sampling units has a particular probability of being taken (see also 4.4)
3.1.8
random sample
sample (3.1.11) selected by random sampling (3.1.9)
[ISO 3534-2:2006, definition 1.2.25]
2 © ISO 2009 – All rights reserved

3.1.9
random sampling
sampling (3.1.12) where a sample (3.1.11) of n sampling units (3.1.13) is taken from a population (3.1.6)
in such a way that each of the possible combinations of n sampling units has a particular probability of being
taken
[ISO 3534-2:2006, definition 1.3.5]
3.1.10
randomization
process by which a set of items are set into a random order
NOTE If, from a population (3.1.6) consisting of the natural numbers 1 to n, numbers are drawn at random (i.e. in
such a way that all numbers have the same chance of being drawn), one by one, successively, without replacement, until
the population is exhausted, the numbers are said to be drawn "in random order".
If these n numbers have been associated in advance with n distinct units or n distinct treatments that are then re-arranged
in the order in which the numbers are drawn, the order of the units or treatments is said to be randomized.
3.1.11
sample
subset of a population (3.1.6) made up of one or more sampling units (3.1.13)
[ISO 3534-2:2006, definition 1.2.17]
3.1.12
sampling
act of drawing or constituting a sample (3.1.11)
[ISO 3534-2:2006, definition 1.3.1]
3.1.13
sampling unit
unit
one of the individual parts into which a population (3.1.6) is divided
NOTE 1 A sampling unit can contain one or more items, for example, a box of matches, but one test result will be
obtained for it.
NOTE 2 A sampling unit can consist of discrete items or a defined amount of bulk material.
[ISO 3534-2:2006, definition 1.2.14]
3.1.14
sampling with replacement
sampling (3.1.12) in which each sampling unit (3.1.13) taken and observed is returned to the population
(3.1.6) before the next sampling unit is taken
[ISO 3534-2:2006, definition 1.3.15]
3.1.15
sampling without replacement
sampling (3.1.12) in which each sampling unit (3.1.13) is taken from the population (3.1.6) once only
without being returned to the population
[ISO 3534-2:2006, definition 1.3.16]
3.1.16
seed
numerical value or set of values used to initialize a pseudo-independent random sampling (3.1.7) algorithm
or to establish a starting point in a table of random numbers
3.1.17
simple random sample
sample (3.1.11) selected by simple random sampling (3.1.18)
[ISO 3534-2:2006, definition 1.2.24]
3.1.18
simple random sampling
sampling (3.1.12) where a sample (3.1.11) of n sampling units (3.1.13) is taken from a population (3.1.6)
in such a way that all possible combinations of n sampling units have the same probability of being taken
[ISO 3534-2:2006, definition 1.3.4]
3.1.19
stratified sampling
sampling (3.1.12) such that portions of the sample (3.1.11) are drawn from the different strata (3.1.21) and
each stratum is sampled with at least one sampling unit (3.1.13)
[ISO 3534-2:2006, definition 1.3.6]
3.1.20
stratified simple random sampling
simple random sampling (3.1.18) from each stratum (3.1.21)
[ISO 3534-2:2006, definition 1.3.7]
3.1.21
stratum
mutually exclusive and exhaustive sub-population considered to be more homogeneous with respect to the
characteristics investigated than the total population (3.1.6)
[ISO 3534-2:2006, definition 1.2.29]
3.2 Symbols
For the purposes of this document, the mathematical signs and symbols given in ISO 80000-2 and the
following apply.
d the ith (least significant) digit, or face value of a coin or die
i
N lot size
n sample size
n the size of the ith sample
i
U uniformly-distributed random real variable on the open range (0, 1)
x the ith value of the variable x
i
j! factorial j
⎡z⎤ ceiling function of z (returns the smallest integer greater than or equal to real value z)
⎣z⎦ floor function of z (returns the integer portion of real value z)
4 © ISO 2009 – All rights reserved

4 General
4.1 Random sampling is a prerequisite to the correct application of most sampling plans in industrial use.
Similarly, randomization, which uses the principles of random sampling, is indispensable in the conduct of
designed experiments, as it increases the internal validity of an experiment, allowing statistical methods to be
used in the interpretation of an experiment's results. The goal of random sampling is to provide a means of
applying the results of probability theory to practical problems, while avoiding any form of bias. This goal is not
attainable using certain other types of sampling. For example, sampling based on such concepts as personal
intuition or judgment, haphazardness, or quota-achievement are inherently biased and consequently can lead
to serious errors in the decision-making process, with no provision to assess risks. Equi-probable random
sampling seeks to eliminate such bias by ensuring that each unit in a lot has the same probability of being
selected (sampling with replacement) or, alternatively, that every possible sample of a given size from the lot
has the same probability of being selected (sampling without replacement).
4.2 Under equi-probable random sampling with replacement, the probability that a specific unit in a lot of N
n
units is selected at any given draw is always 1/N. There are N possible ordered random samples of n units
from N units and, for completeness, there are (N + n − 1)! / [n! (N − 1)!] possible different unordered random
samples of n units from N units (see the note below).
Under simple random sampling without replacement, the probability that a unit in a lot is selected at a given
draw is 1/N for the first draw, 1/(N − 1) for the second draw, 1/(N − 2) for the third draw, and so on. If n units
are randomly selected from a lot of N units without replacement, then each combination of n units has the
same probability of selection as every other combination of N units taken n at a time. The number of possible
different unordered random samples of n units from a lot of N units is N! / [n! (N − n)!], which is the number of
combinations of N units taken n at a time. It is equally noteworthy that the number of possible ordered random
samples of n units taken without replacement from a lot of N units is N! / (N − n)!, which is equivalent to the
number of possible permutations of N units taken n at a time. It should be noted that random sampling without
replacement is the most common sampling strategy used in acceptance sampling applications.
NOTE Under sampling with replacement based on a sample of, say, 3 units from 5 units, the lists {1, 1, 2}, {1, 2, 1},
and {2, 1, 1} are different when order is considered (and technically referred to as multisets or bags), but the same when
order is not considered.
4.3 The goal of random sampling can only be achieved by adhering to rigorous procedures that have been
carefully designed to achieve the intent of the definition. Several methods are presented in this International
Standard to implement this goal. The mechanical device methods, in particular, assume that the coins and
dice are unbiased, having been designed such that each side has the same probability of occurring during a
toss or throw, and that the manner of tossing or throwing is being performed so as not to introduce bias.
Furthermore, due to numerous deficiencies in the intrinsic implementations of random sampling methods in
calculators and computer operating systems, programming languages, and software (see References [9], [10],
[12], and [13] for further information), this International Standard has adopted a portable, proven method for
generating random samples by computer. In addition, it should be noted that all of the methods below require
that each distinct unit in a lot has been associated in advance with a distinct number from 1 to N, so that the
sampling units identified as a result of the random sampling method can be unambiguously obtained from the
lot.
4.4 Finally, to reduce awkwardness in presentation, the adjective "pseudo-independent" will often be
dropped when referring to such a random sampling procedure or method (see Reference [8]). Furthermore,
the adjective “random” will be used frequently in the sense that the noun it modifies (often a number or
permutation) is the output of a process that randomly generates such a number or permutation. In addition,
when examples are provided, the sample sizes involved are artificially kept small with the goal of simply
illustrating the concepts involved.
5 Random sampling — Mechanical device methods
5.1 Urn method
5.1.1 Place N distinctly-numbered but otherwise physically-identical objects (e.g. tickets, chips, or balls) into
an urn to unambiguously represent each of the N units in the lot and thoroughly mix the objects.
5.1.2 For sampling without replacement, blindly select objects from the urn, one by one without returning
them to the urn and optionally re-mixing the objects between successive draws, until the desired number n of
sampling units is obtained.
NOTE This method is commonly used by lottery agencies.
5.1.3 For sampling with replacement, blindly select objects from the urn, one by one, returning each object
to the urn after each draw and thoroughly re-mixing the objects between successive draws, until the desired
number n of sampling units is obtained. Using this method, the same unit may occur more than once in the
sample.
5.2 Coin or die method
5.2.1 Determine the number m of coins or dice (or coin tosses or die throws) required, where N is the lot
size and k is the number of sides of the device being used, according to the following equation:
mN=⎡⎤log logk
ee
5.2.2 Where multiple coins or dice are used, clearly associate each coin or die with a specific position in the
interpretation sequence of digits d . Where a single coin or die is used, assign the result of the first toss or
i
throw to the most significant digit d , the second toss or throw to the next most significant digit d , and so
m m − 1
on.
5.2.3 Toss the coins or throw the dice and record the m ordered results d . Translate the results to decimal
i
integers through the following equation:
m
mi−
yd=+1( −1)k
∑ i
i=1
5.2.4 Repeat step 5.2.3, discarding all values that exceed N and, in the case of sampling without
replacement, all values that have already been selected, until the desired number n of sampling units is
obtained.
EXAMPLE 1 An inspector wishes to obtain a random sample of 4 units from a lot of 20 units and has a single coin
available. From step 5.2.1, it is determined that m = 5 coin tosses are required to obtain each random number. It is
decided in advance that a head will have a face value of 1 and a tail a face value of 2. The first sequence of tosses yields
4 3 2 1 0
the multiset {1, 2, 1, 2, 2}, which through step 5.2.3 equates to 1 + (0)2 + (1)2 + (0)2 + (1)2 + (1)2 = 12. The following
three sequences of tosses yield the multisets {1, 2, 2, 2, 1}, {1, 1, 2, 2, 1}, and {2, 2, 1, 2, 2}, which equate to 15, 7, and 28,
respectively. Since the value 28 exceeds the lot size, it needs to be discarded and additional sequences of tosses need to
be performed until one more valid number is obtained to complete the random sample.
EXAMPLE 2 A random sample of 4 units from a lot of 50 units is required and the inspector has access to several six-
sided dice of different colours. From step 5.2.1, it is determined that m = 3 dice are required to obtain each random
number. The inspector chooses a blue, a green, and a red die and ranks them from most significant to least significant in
that same order. However, it is evident upon examining the equation of 5.2.3 that numbers within the valid range from 1 to
50 will only result when the first die face is either 1 or 2. Consequently, some efficiency can be obtained by mapping the
higher face values of the blue die to either 1 or 2 without distorting the outcome probabilities. The inspector decides in
advance for odd face values on the blue die to be treated as 1 and even face values to be treated as 2. The first roll yields
2 1 0
the multiset {3, 3, 4}, which through step 5.2.3 equates to 1 + (2)6 + (2)6 + (3)6 = 88, which is too large but when
transformed to {1, 3, 4} equates to 16. Three more rolls yield {6, 1, 3}, (which transforms to {2, 1, 3}), {5, 6, 6}, (which
transforms to {1, 6, 6}), and {2, 5, 5}, which equate to 39, 36, and 65, respectively. Since the value 65 exceeds the lot size,
it needs to be discarded and additional throws need to be made until one more valid number is obtained to complete the
random sample.
6 © ISO 2009 – All rights reserved

EXAMPLE 3 The same scenario as in Example 2 exists but this time the inspector observes that three dice will
produce numbers ranging from 1 to 6 = 216, yet the lot size is only 50. The inspector decides in advance to map all
outcomes from 1 to 200 to the range from 1 to 50 and discard any outcome greater than 200 to avoid distorting the
outcome probabilities. The same four rolls from the previous example are evaluated under this mapping scheme. The
multisets {3, 3, 4}, {6, 1, 3}, {5, 6, 6}, and {2, 5, 5} equate to 88, 183, 180, and 65. Multiples of 50 are subtracted from
these numbers until each of them is within the range from 1 to 50 (if 0 is obtained, interpret it as N), resulting in the sample
values of 38, 33, 30, and 15, respectively. A sample size of 4 units has been obtained so no further throws are necessary.
Note that, mathematically, this mapping process is equivalent to applying the equation v = 1 + (v − 1) modulo N, where
2 1
v is the initial value and v is the value mapped into the desired range.
1 2
6 Pseudo-independent random sampling — Table method
6.1 Random number tables
Two tables of random numbers are provided in Annex A. The tables each consist of 3 600 random digits from
0 to 9, arranged in 60 rows by 60 columns. Their usage is briefly described below and in more detail in
Annex A.
NOTE The digits in the table are directly analogous to the face values of a 10-sided die repeatedly thrown and
recorded. The number of digits m required for a sampling application corresponds to the number of dice throws.
6.2 Basic method
6.2.1 Determine the number of digits m necessary to represent the lot size N. Where the lot size is an
integral power of 10, ignore the initial digit in the lot size and interpret that remaining zeroes as equal to the lot
size value (e.g. if N = 1 000, interpret the value 000 as 1 000).
6.2.2 Randomly select a starting point (i.e. row and column value) in the table using a method described in
A.2.2.
6.2.3 Read the resulting digit in conjunction with the m − 1 digits to the right as a single number and record
the value. Where the digits to the right would exceed the 60th column, treat columns 1, 2, and so on as
columns 61, 62, and so on, respectively.
6.2.4 Increase the row value by one, repeat step 6.2.3, and record the value. Where this row value would
exceed the 60th row, treat row 1 as the 61st row and increase the column values each by m digits.
6.2.5 Repeat step 6.2.4, discarding all values that exceed N and, in the case of sampling without
replacement, all values that have already been selected, until the desired number of sampling units n is
obtained.
EXAMPLE An auditor wishes to select a random sample of 5 units from a lot of 200 units. A random starting point is
determined by coin tosses to be row 57 and column 59 and it is decided to use Table A.1. Since N is small in comparison
to the maximum value capable of being represented by 3 digits (i.e. 1 000), the auditor decides to map the results of the
range from 1 to 1 000 onto the range from 1 to 200. The following five numbers result: 848, 670, 902, 034, and 518. The
translated sample values become 48, 70, 102, 34, and 118.
7 Pseudo-independent random sampling — Computer method
7.1 Overview
7.1.1 This International Standard adopts a specific system of algorithms developed in References [1], [7],
and [13]. The algorithms have been designed to possess the mathematical and statistical properties required
for random sampling as well as to be portable with respect to implementation in different programming
languages on different computer platforms and to facilitate verification and auditing of the selected sample
values, which might be required for regulatory purposes. An example implementation of the key program
segments is provided in Annex B using the C programming language.
7.1.2 The system of algorithms involves two major sub-systems:
a) an optional initialization algorithm that automatically generates a quasi-random seed integer based on
elapsed time from a reference date; and
b) a random number generator.
7.1.3 For verification or auditing purposes, the optional initialization algorithm mentioned in 7.1.2 a) and
described in 7.2 would be by-passed with a manually-entered seed value. This value needs to be within the
integer range from 1 and 2 147 483 398 inclusive. A copy of this input value is saved for records purposes
when required. However, in general usage for quality control and designed experiment applications, there
should be infrequent need to by-pass the option of automatic random seed generation, which should be the
default option in practice.
NOTE The presentations of the steps of the algorithms in this clause have been kept in a more mathematical format
to aid in programming. Programming code with clause references has been included in Annex B to supplement
implementation of this clause.
7.2 Initialization algorithm
7.2.1 The initialization algorithm consists of:
a) an elapsed time computation algorithm, referenced to a fixed past date and time; and
b) a random number generation algorithm based on the uniform distribution, called a random number of
times based on the output of item a) above, to obtain a random seed based on the time-based input.
7.2.2 The following algorithm determines the number of seconds that has elapsed since 2000-01-01
00:00:00 to the current date and time.
a) Capture the computer system's date and time to a string variable, save a copy of the variable for records
purposes, and then parse the string into its time components (i.e. year, month, day, hour, minute, and
second).
b) Compute the number of fully elapsed days d since the reference time point, using the current date's full
e
four-digit year y, month m , and day d numerical values processed as follows:
if m < 3, then let m = m + 12 and let y = y − 1
1 1 1
d = d + ⎣(153 m − 457) / 5⎦ + 365 y + ⎣y / 4⎦ − ⎣y / 100⎦ + ⎣y / 400⎦ − 730 426
e 1
NOTE The equation for d may be slightly simplified for calendar years up to and including 2099 by replacing the
e
terms following ⎣y / 4⎦ by “− 730 441”.
c) Compute the total number of seconds s elapsed since the reference date using the quantity obtained in
e
step b) and the time of day (in 24-hour “hh:mm:ss” format) captured in the string variable in step a) in
accordance with the following equation:
s = 86 400 d + 3 600 h + 60 m + s
e e 2
where h, m and s are the hours, minutes and seconds, respectively.
NOTE 1 Some programming languages have built-in functions to perform the calculation of s directly. Such intrinsic
e
functions should be validated before use, to ensure the effects of leap years and daylight saving time are properly handled.
NOTE 2 In 32-bit implementations of this algorithm, the value of s will increase over time to the point of causing
e
computational overflow. Care should be taken in programming to ensure its output value is always mapped on the range
from 1 to 2 147 483 398 inclusive.
8 © ISO 2009 – All rights reserved

d) The value resulting from step c) is the initializing seed for the random seed generator and is used to
obtain the final seed. A copy of this value is saved to a separate variable for records purposes when
required.
e) The number of times j that the subsequent random number generator is to be called is a random integer
between 1 and 100 inclusive, based on the two least significant digits of the value obtained in step c)
increased by 1, which may be expressed as follows:
j = s − 100 ⎣s / 100⎦ + 1
e e
7.2.3 The random number generator for the automatic seed generation (initialization function) algorithm
takes the form of the linear congruential recurrence relation:
a) x = 40 692 x mod 2 147 483 399,
i + 1 i
which can be implemented on computers capable of handling 32-bit integers via the following steps:
b) k = ⎣x / 52 774⎦;
i
c) x = 40 692 (x − 52 774 k) − 3 791 k;
i + 1 i
d) If x < 0, then let x = x + 2 147 483 399.
i + 1 i + 1 i + 1
7.2.4 Generate the seed to the random sampling algorithm by assigning the result from 7.2.2 c) to x and
i
then calling the formula in 7.2.3 j times per step 7.2.2 e), replacing x with x each time until the required
i i + 1
number of calls are made.
7.2.5 The final value of x resulting from step 7.2.4 is a random integer between 1 and 2 147 483 398
i + 1
inclusive and serves as the initial seed to the random sampling algorithm described in 7.3 [in particular, the
value y in step 7.3.6 b)]. A copy of this value is saved to a separate variable for records purposes when
i
required.
7.3 Random number generation algorithm
7.3.1 The random number generation algorithm consists of
a) a shuffling array that is populated by a uniform-distribution random number generation algorithm, and
b) a combination, uniform-distribution random number generation algorithm.
7.3.2 Create a 32-element array A to serve as a means of shuffling the output of the random sampling
algorithm.
7.3.3 The following random number generator is used to populate the shuffling array:
a) x = 40 014 x mod 2 147 483 563,
i + 1 i
which can be implemented on 32-bit computers via the following steps:
b) k = ⎣x / 53 668⎦;
i
c) x = 40 014 (x − 53 668 k) − 12 211 k;
i + 1 i
d) If x < 0, then let x = x + 2 147 483 563.
i + 1 i + 1 i + 1
7.3.4 Initialize the array A by assigning the result from 7.1.3 or 7.2.5 to x and then calling the generator
i
given in 7.3.3 a) 40 times, replacing x with x on each call, discarding the first 8 values, and then assigning
i i + 1
each of the remaining 32 output values of x to the array in reverse order (i.e. from element 32 down to
i + 1
element 1).
7.3.5 Set element 1 of array A (i.e. A[1]) as the initializing value k to the combination random number
generation algorithm.
7.3.6 The combination random number generator for random sample generation takes the form of the
following combination of linear congruential recurrence relations and array index determination steps:
a) x = 40 014 x mod 2 147 483 563;
i + 1 i
b) y = 40 692 y mod 2 147 483 399;
i + 1 i
c) J = ⎣32 k / 2 147 483 563⎦ + 1;
d) k = A[J] − y ;
i + 1
e) A[J] = x ;
i + 1
f) If k < 1, then let k = k + 2 147 483 562.
NOTE The two random number generators above are those described in 7.2.3 and 7.3.3 (refer to those subclauses if
32-bit equivalent implementations are required).
7.3.7 The algorithm in 7.3.6 is initialized by setting x to the final value of x from 7.3.4 and setting y to
i i + 1 i
the value referenced in 7.2.5. The values x and y serve as the subsequent values of x and y for all
i + 1 i + 1 i i
subsequent calls to the algorithm. A random index J to the shuffling array A is calculated using the value of k
(from 7.3.5 initially), and the difference between A[J] and y is assigned to k, while A[J] is updated with x
i + 1 i + 1.
Finally, the value of k is altered if necessary to produce a positive value.
7.3.8 The output of the random sampling algorithm is the value k, which is a random number between 1 and
2 147 483 562 inclusive, scaled as a standard uniformly-distributed real variable U over the range from 0 to 1,
exclusive of the endpoint values of this range, as follows: U = k / 2 147 483 563.
7.3.9 The output from 7.3.8 may be scaled as a uniformly-distributed integer variable L over the range from
1 to N, inclusive, as follows: L = ⎣N U⎦ + 1.
7.3.10 To generate a random sample, steps 7.3.6 to 7.3.9 are repeated until the desired number of random
values is obtained.
7.4 Audit records
When records are required to be maintained for audit purposes by a responsible authority or regulatory body,
record the lot size and the sample size.
In addition, with respect to the algorithms, record the manually entered seed per 7.1.3, or if the random seed
generator is used, record the
a) computer system's date and time used to compute this initial seed,
b) initial seed's value per 7.2.2 d), and
c) final seed's value per 7.2.5.
10 © ISO 2009 – All rights reserved

8 Applications to common sampling situations
8.1 General
8.1.1 This clause provides algorithms for several random sampling strategies to suit various practical
situations.
8.1.2 Throughout this clause, U is defined as a random real variable, uniformly-distributed in the range from
0 to 1, exclusive of the endpoint values of the range, such as provided by the algorithm in 7.3. If another
source is used for U and the output is known to include 1 but not 0 as the endpoint values of the range, set U
equal to 1 − U. If the alternate source of U includes 0 and 1 as endpoint values of its range, the value 1 needs
to be trapped and discarded.
8.2 Random integer in a range
A random integer K in the range from M to N inclusive may be generated according to the following algorithm.
a) Generate a random real value U.
b) Set K equal to M + ⎣U (N − M + 1)⎦.
8.3 Random permutation
For an array A with N distinct elements, a random permutation of N units taken n at a time may be generated
according to the following shuffling algorithm.
a) Assign the N distinct element index values in original order to A[1:N].
b) Set J equal to 1.
c) Generate a random integer K in the range from J to N inclusive.
d) Swap A[J] and A[K].
e) Increment J by 1.
f) If J is less than or equal to n, go to step c).
g) Obtain the random permutation from the first n values of array A.
8.4 Random derangement
For an array A with N distinct elements, a random derangement of N units may be generated according to the
following algorithm.
a) Assign the N distinct element index values in original order to A[1:N] and make a copy in array B[1:N].
b) Using array B, generate a random permutation of N units taken N (i.e. all) at a time, using the method
given in 8.3.
c) Compare the elements from 1 to N of arrays A and B for equality.
d) If any element of array B is equal to its counterpart in array A, cease the comparison and go to step b).
e) Obtain the random derangement from array B.
NOTE This algorithm can be made more efficient in steps b) and c) by comparing element A[J] with element B[J] as
soon as B[J] has been determined, rather than waiting for the full permutation of array B.
8.5 Random sampling with replacement
A single random sample of n units from a lot of N units may be generated with replacement according to the
following algorithm.
a) Generate a random integer K in the range from 1 to N inclusive.
b) Repeat step a) until n values of K are obtained.
NOTE This method may be applied repeatedly to obtain any number of samples, of any size. If the resulting values of
a single sample are not sorted, that sample may be used for sequential sampling inspection.
8.6 Random sampling without replacement
A single random sample of n distinct units from a lot of N units may be generated without replacement by
either of the following methods.
a) Method 1
1) Generate a random integer K in the range from 1 to N inclusive.
2) Verify that the value of K has not been previously generated; if it is distinct, store the value, otherwise
discard it.
3) Repeat steps 1) and 2) until n different values of K are obtained.
b) Method 2
1) Generate a random permutation of N units taken n at a time in accordance with 8.3.
2) Use the first n values in the output array A as the random sample.
NOTE Either of these methods may be used to obtain any number of samples of any size (for such purposes as
double or multiple sampling) by using the total n of the individual sample sizes n as the input value of n to the algorithm,
t i
leaving the values in original output order, then taking the first n resulting values as the first sample, the next n resulting
1 2
values as the second sample, and so forth. Furthermore, if the resulting values of a single sample are not sorted, that
sample may be used for sequential sampling inspection by inspecting each unit in the order selected.
8.7 Random sampling for continuous sampling plans (CSP)
A CSP-1 continuous sampling plan is designed for application to the quality control of a production line and
alternates between qualifying periods of 100 % inspection requiring i consecutively-accepted units before
being followed by periods of sampling inspection at probability f, with reversion to 100 % inspection upon
finding an unacceptable unit. During periods of sampling inspection, units from the production line may be
selected for inspection in accordance with either of the following methods.
a) Method 1
1) For each unit of production, generate a random real value U.
2) If U is less than or equal to f, choose the unit for sample inspection.
3) Repeat steps 1) and 2) until an unacceptable unit is obtained.
b) Method 2
1) For each production segment of n units, where n equals 1/f, generate a random integer K over the
range from 1 to n inclusive.
12 © ISO 2009 – All rights reserved

2) Choose the unit corresponding to K as a sampling unit for inspection.
3) Repeat steps 1) and 2) until an unacceptable unit is obtained.
NOTE For CSP-1 plans, the value f is specified as the reciprocal of an integer.
8.8 Stratified random sampling
For a lot composed of two or more strata of size N , select a single random sample of size n from each
i i
stratum i using the methods given in 8.3 or 8.6 when sampling without replacement is required, or the method
given in 8.5 when sampling with replacement is required.
8.9 Single random sampling from an initially unknown lot size
A single random sample of n different units from a lot of initially unknown size, but at least equal to size n, may
be obtained according to the following method (adapted from Reference [11]).
a) Assign the first n units from the lot to the sample array A[1:n].
b) If another unit exists in the lot listing, set N equal to the count of the next unit; otherwise, go to step f).
c) Generate a random integer K in the range from 1 to N inclusive.
d) If K is less than or equal to n, set A[K] equal to N.
e) Go to step b),
f) Obtain the random sample from array A and the lot size from the value N.
NOTE This method may also be used if the lot size is known.
8.10 Ordered single random sampling without replacement
A single random sample of n distinct units from a lot of N units may be generated directly in ascending order
with either of the following methods.
a) Method 1 (adapted from Reference [2])
1) Initialize the following variables:
i) create array A[1:n];
ii) set L equal to N, K equal to N − n, and J equal to 0.
2) Increment J by 1.
3) If J is greater than n, go to step 8).
4) Generate a random real value U and set P equal to 1.
5) Set P equal to P K / N.
6) If P is less than or equal to U:
i) set A[J] equal to N − L + 1 then decrement L by 1;
ii) go to step 2).
7) If P is greater than U:
i) decrement L by 1 and K by 1;
ii) go to step 5).
8) Obtain the random
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.

Loading comments...