Skip to main content

I am creating some anonymized data for testing purposes and need to create a fake Land Registry Title Number (found in the UK). These are references such as CU556644 or LAN33445.

I can generate the random numbers for it but I need to generate random letters in either combination of 2 or 3 letters or both.

Has anyone come across a way of doing this?

Thanks

 

You could use python to achieve this. This function will return 2 or 3 random string characters.

import fme
import fmeobjects
import random
import string

def random_letters(feature):
    length = random.choice(Â2,3])
    feature.setAttribute('letters', ''.join(random.choice(string.ascii_uppercase) for _ in range(length)))
    pass

random_letters.fmw


@madwarren's suggestion is probably the easiest way, but if you want/need to avoid python, you can use a random number generator (1-26) followed by an attributeValueMapper to map the 26 numbers to A-Z.


You can also use a random number generator, with a min value of 97 and a max value of 122 followed by a a charactercodereplacer.

 

Or just the charactercodereplacer with @rand


Reply