30.11.2012 Views

Code and ciphers: Julius Caesar, the Enigma and the internet

Code and ciphers: Julius Caesar, the Enigma and the internet

Code and ciphers: Julius Caesar, the Enigma and the internet

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

96<br />

chapter 8<br />

<strong>the</strong> spin, <strong>the</strong> sequence may be biased. It is, in addition, a very slow way of<br />

producing a r<strong>and</strong>om sequence that would presumably only be used if no<br />

o<strong>the</strong>r method were available. It is said that a prisoner of war carried out<br />

such a procedure for many thous<strong>and</strong> spins, to keep himself occupied, <strong>and</strong><br />

analysed <strong>the</strong> resulting sequence with a variety of tests.<br />

Throwing dice<br />

A less laborious procedure can be based on throwing two dice. The dice<br />

must be distinguishable one from <strong>the</strong> o<strong>the</strong>r; let us assume that one is<br />

coloured red <strong>and</strong> <strong>the</strong> o<strong>the</strong>r is coloured blue. Throw both dice <strong>and</strong><br />

compute <strong>the</strong> number<br />

<strong>the</strong>n<br />

6�(number on <strong>the</strong> red die)�(number on <strong>the</strong> blue die)�7<br />

(i) reject <strong>the</strong> number if it exceeds 29,<br />

(ii) write down <strong>the</strong> remainder when <strong>the</strong> number is divided by 10.<br />

The resultant sequence of decimal digits should be r<strong>and</strong>om.<br />

The ra<strong>the</strong>r odd-looking rules are necessary because <strong>the</strong> faces of <strong>the</strong> dice<br />

are numbered 1 to 6 <strong>and</strong> not 0 to 5 <strong>and</strong> because <strong>the</strong>re are 36 combinations<br />

which can be produced. Consequently values from 0 to 35 inclusive for<br />

<strong>the</strong> number can be produced <strong>and</strong> so we must reject any number above 29,<br />

in order to ensure that all <strong>the</strong> digits from 0 to 9 have an equal chance of<br />

appearing.<br />

More than two dice may be used <strong>and</strong> <strong>the</strong>n more than one r<strong>and</strong>om digit<br />

can be generated at each throw. With four dice, for example, <strong>the</strong>re are<br />

1296 possible outcomes <strong>and</strong> if we colour <strong>the</strong> dice red, blue, green <strong>and</strong><br />

white <strong>and</strong> compute <strong>the</strong> number<br />

216�red�36�blue�6�green�white�259<br />

<strong>and</strong> reject any number above 999 we can take <strong>the</strong> three-digit number so<br />

obtained as <strong>the</strong> next three digits of <strong>the</strong> r<strong>and</strong>om decimal sequence.<br />

There are many possible variations on this type of approach; for<br />

example, <strong>the</strong> two dice could be replaced by a roulette wheel, which has 37<br />

sectors numbered 0 to 36. Sectors 30 to 36 would be ignored <strong>and</strong> <strong>the</strong><br />

second digit of <strong>the</strong> ‘winning’ sector would provide <strong>the</strong> next r<strong>and</strong>om<br />

decimal digit. This is obviously ra<strong>the</strong>r wasteful <strong>and</strong> a more efficient use in<br />

this case would be to ignore sectors 32 to 36 <strong>and</strong> convert <strong>the</strong> o<strong>the</strong>r

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!