Generate a random payment ID sample codes

<?php
$payment_id = bin2hex(random_bytes(32));
echo($payment_id);
?>
private static String generatePaymentId() {
        def r = new Random()
        def result = (0..<64).collect { r.nextInt(16) }
                .collect { Integer.toString(it, 16) }
                .join()
        return result
    }