mardi 26 décembre 2017

How to generate random 64-digit hexadecimal number in R?

To apply in a blockchain application, I needed to generate random 64-digit hexadecimal numbers in R.

I thought that due to the capacity of computers, obtaining such an 64-digit hexadecimal number at once is rather cumbersome, perhaps impossible.

So, I thought that I should produce random hexadecimal numbers with rather low digits, and bring (concatenate) them together to obtain random 64-digit hexadecimal number.

I am near solution:

.dec.to.hex(abs(ceiling(rnorm(1) * 1e6)))

produces random hexadecimal numbers. The problem is that in some of the instances, I get 6-digit hexadecimal number, in some instances I get 7-digit hexadecimal number. Hence, fixing this became priority first.

Any idea?




Aucun commentaire:

Enregistrer un commentaire