Works great. Thanks.
Am Mittwoch, 25. November 2015 16:39:02 UTC+1 schrieb Peter Kristolaitis:
>
> Just realized my code is slightly wrong for you since you wanted hex
> values rather than alphanumeric string.
>
> The first line should be:
>
> <% range = [*'0'..'9',*'a'..'f'] -%>
>
>
>
> On 11/25
Just realized my code is slightly wrong for you since you wanted hex
values rather than alphanumeric string.
The first line should be:
<% range = [*'0'..'9',*'a'..'f'] -%>
On 11/25/2015 10:36 AM, Peter Kristolaitis wrote:
<% range = [*'0'..'9',*'A'..'Z',*'a'..'z'] -%>
<%= Array.new(7){range
<% range = [*'0'..'9',*'A'..'Z',*'a'..'z'] -%>
<%= Array.new(7){range.sample}.join + "-" +
Array.new(3){range.sample}.join %>
The "<% range ... -%>" can be anywhere in your template as long as it's
before where you generate the random value. I usually put stuff like
that near the top of the
I want to create a random hex string in the format
041f798-a5f
inclusive the dash in a XML file.
I have tried using a self written shell script which generates the string
with
<%= exec('/var/somedir/somescript') %>
in the template. That unfortunately didn't work.
I suspect I have to write a