User Tools

Site Tools


The Power of Random...

Humans are, on the whole, creatures of habit: they dwell within 'comfort zones' that tend not, by definition, to push any boundaries, take chances or give rise to the unexpected. For my own part, I know that when I worked in Sydney city in close proximity to a really good food hall that had an excellent Malaysian take away, I would eat Beef Rendang for lunch, day in and day out! I didn't need 'variety', because the 'monotony' was immensely tasty!

I am aware of this failing in my character: left to my own devices in pretty much any sphere of conduct, I will probably be boringly safe about things. It doesn't really matter what sphere of conduct we're talking about, either: I am a slave to routine!

In an effort to counter this, I have recently knocked together a shell script that will generate a random number between 1 and whatever number you supply as an input parameter when invoking the script:

# Generates a random number between 1 and an upper limit supplied as a run-time
# parameter. The upper limit is inclusive. That is, if you supply "100", then the
# random numbers can include '100' as an output, but 101 can never be output.
# Usage: rnum <upper limit>

RANDOM=$$			# seeds the Linux built-in random number variable, makes it more random!

echo "Your random number is: "$R

Save that (say, as, and you can generate a random number between 1 and 100 (say) by simply running the script with '100' as the run-time parameter. In my case, for example:

[[email protected] ~]$ /home/hjr/Scripts/ 100
Your random number is: 88

Not, in itself, particularly hard or particularly exciting, I agree! But if you associate some 'meaning' to a number, then the generation of a random number can mean the random generation of an instruction to go and do something!

For example: I recently threw together a list of about 750 English place names, creating 26 mini-lists of places ordered by the first letter in their name. I had to make a couple of special 'allowances' when doing this, of course: there aren't a lot of places beginning with 'X' or 'Z', so I decided that if a town had an X or a Z in its name anywhere, they'd be classed as an X or Z town, rather than their actual initial letter. Thus Ashby -de-la-Zouch and Devizes are both listed as 'Z' towns; similarly, Uxbridge and Exeter are both 'X' towns, rather than U or E ones. Those exceptions-to-the-usual-rules allowances made, I therefore ended up with this list of 'I' places, for example:

Ilford, Greater London 1
Ilfracombe, Devon 2
Ilkeston, Derbyshire 3
Ilkley, West Yorkshire 4
Ilminster, Somerset 5
Immingham, Lincolnshire 6
Ingleby Barwick, North Yorkshire 7
Ipswich, Suffolk 8
Irthlingborough, Northamptonshire 9
Ivybridge, Devon 10
St Ives, Cambridgeshire 11
St Ives, Cornwall 12

Note that each place has been assigned a number in ascending alphabetical order. There are equivalent lists of places throughout England for each of the other letters of the alphabet.

So all that's left to do now is to run my random number generator 26 times, one for each letter of the alphabet, supplying the maximum number of towns beginning with each letter as the run-time parameter. Whatever number comes up, that's the place we add to the 'must visit this year' list! So, for a random 'I' place to visit, I'd run this command:

[[email protected] ~]$ /home/hjr/Scripts/ 12
Your random number is: 5

…and now I know I'm off to Ilminster in Somerset sometime soon. Given the distance from my home town of Nottingham, that probably means an over-night stay in a (desperately!) cheap bed-and-breakfast some place; and a quick glance at Google Maps tells me I might want to plan side-trips to Yeovil and/or Lyme Regis. So that's one weekend of my life now organised -and one where I won't be sitting at home doing not very much!

Now, some towns are a lot less interesting than others! But the rules of this game are that once you've visited the randonly-selected place, you can de-camp to any other place of more interest that happens to be nearby. Thus, our first randomly-selected place was “Ashton Under Lyme”, which appears to consist of some canals, rather a lot of dog-poo and not a lot else: so we used that trip as an excuse to visit near-by Manchester, which was altogether more interesting!

Our 'B' trip was to Brightlingsea:

As you can see, Brightlingsea consisted largely of a road-sign (it has quite a nice sea-front, too, though!). So, Brightlingsea having been visited -and ticked off the list- we swiftly moved on to nearby Colchester and Ipswich, which were more engaging altogether.

Our 'C' trip was to Crediton, in Devon:

That turned out to have a wonderful old church, in which we attended a well-sung choral concert on the night of the 50th anniversary of the Moon landings. So that was worth visiting all on its own (though we also popped into nearby Exeter to see the Cathedral!)

We've since elaborated a couple of extra rules for this 'randomly visit somewhere' game: if the randomly-generated list sends you to town X on one visit and town Y on another, and X and Y are three miles apart from each other… you're not allowed to combine visits to the two of them into a single day out. Two places must result in two separate visits, in other words!

Another rule is that if you visit X on the randomly-generated list and it's so boring that you take side trips to towns Y and Z, you can't class those extra towns as places you've visited. Our side trip to Manchester when visiting Ashton under Lyme, for example, doesn't mean we've done an 'M' trip; similarly, our side trip to Exeter when doing the Crediton run doesn't mean we can tick-off an 'E' place (or even an 'X' one!). Side trips effectively never happen as far as 'the game' is concerned.

The only other 'rule' is that there's no time-limit on completing the list, provided you do all 26 visits within one calendar year: we currently have no plans to visit 'D'udley, for example, even though Crediton was nearly a fortnight ago! So long as we get to it sometime before September, I think we'll still be 'on target' :-)

It's maybe a silly game to play, but we're finding it's making us go out and appreciate places we would otherwise never have bothered visiting. All thanks to the power of a random number generator!

So pleased have I been with the results in us getting out and about to weird and whacky corners of the realm we wouldn't have chosen to visit ourselves, I've recently decided to apply the 'Power of Random' to my music, too.

My list of around 400 composers, whose music forms most of my classical music collection, has therefore recently been sorted alphabetically and numbered sequentially on a spreadsheet. A quick trip to my random number generator later and I now have my instructions to listen to a particular composer for around the next fortnight or so -and, in the process, to research their life and work a little more deeply than I would if I were 'just listening' to whatever I happened to click on when running my computer's music player.

The first random number selected for this purpose happened to be 304: that turns out to map to Michel-Richard de Lalande, which means I'll be listening to his Grands Motets and rather less grand Symphonies for the King's Supper for the next couple of weeks. I won't be listening to that fare exclusively, of course, as that would likely get boring very quickly, if not with Lalande specifically, then at least with some of the other composers who are likely to pop up on my random list in the future! But, as in the case of the randomly-inspired Town visits which permit 'side-trips' if the main town of interest turns out to be not very interesting after all, I'm allowed to listen to (lots of!) other music all the while… provided only that I definitely make time for Lalande (or whoever the composer-of-the-fortnight turns out to be in the future) at some point.

I'm hoping this will cure my 'long tail' problem, neatly illustrated by these screenshots:

So that looks pretty good: I've listened to around 559 different “artists” since 2008 (where “artist” really means “composer”, in my case!), and 139,038 different pieces by those different composers. I won't say it's an extraordinary set of statistics, but it does (I think) indicate a fairly wide and varied familiarity with the total body of 'classical' music. Except… except…

This screenshot now tells you that just the top 10 composers in my list of 'listened to' composers account for 78,086 of the 139,038 bits of music I've listened to since 2008. Or put slightly differently, that 56% of my listening is accounted for by just 10 composers! The other 549 composers all together amount to only 44% of my listening :-( That is not so good and is the audio equivalent of my Beef Rendang dietary fixation: there are a handful of composers I listen to a lot, but most hardly ever get a look-in.

Random numbers to the rescue, therefore: I'm hoping my new-found, random propensity to listen to things I've collected but seldom listen to through choice will hopefully improve this rather top-heavy approach to my listening habits! That long tail of seldom-listened-to composers should, with luck, get a lot shorter over time.

I recommend random number generators to you all as ways to make your life a little less predictable, therefore!

blog/the_power_of_random.txt · Last modified: 2019/08/02 16:36 by dizwell