Taking least significant bit of a byte in cloverETL

39 Views Asked by At

I'd like to generate a pseudo-random binary number in CloverETL from an integer, as a function that should be computable from outside of CloverETL.

My approach to do that was to : - salt my integer and hash it with md5 - taking the last bit of this number

But I cannot manage to do the second part with the weird "byte" data type :

md5("salt"+str($in.0.myinteger))    

gives me a byte, but how can I access the last element of this byte?

md5("salt"+str($in.0.myinteger))%2  

doesn't work, and

byteAt()  

is not available in my flavor of CloverETL (which is called CloudConnect).

How can I access the last significant bit of my md5-ed integer, or more generally of anything with the "byte" type ?

1

There are 1 best solutions below

0
On

Can you use

right(byte2str(md5("salt"+str($in.0.myinteger))), 1)

I dont understand the use case, so I guess randomBoolean() function is not enough.