<project>
<tempfile property="temp.dir"/>
<mkdir dir="${temp.dir}"/>
</project>
Jan
>-----Ursprüngliche Nachricht-----
>Von: Mario Madunic [mailto:[EMAIL PROTECTED]
>Gesendet: Samstag, 21. Juli 2007 16:25
>An: Ant Users List
>Betreff: Re: random number generator
>
>Thank you Gilbert,
>
>it works like a charm.
>
>Mario
>
>Quoting Gilbert Rebhan <[EMAIL PROTECTED]>:
>
>> Hi,
>>
>> Mario Madunic wrote:
>> > Hi,
>> >
>> > I'm trying to generate a random number to be used as a
>temporary directory
>> name
>> > through a multi step xslt process. I'm using Ant 1.6.5 and
>Java 1.6.0-b105
>>
>> > I receive the following error
>> >
>> > [random] Jul 20, 2007 9:11:27 PM org.apache.bsf.BSFManager exec
>> > [random] SEVERE: Exception :
>> > [random] java.security.PrivilegedActionException:
>> > org.apache.bsf.BSFException: JavaScript Error: Internal Error:
>> > org.mozilla.javascript.EcmaError: ReferenceError: "self"
>is not defined.
>>
>>
>> if you're already use BSF with <script> task i would recommend
>> JRuby, get the JRuby.jar from =
>>
>> http://dist.codehaus.org/jruby/jruby-complete-1.0.jar
>>
>> so it's a simple as =
>>
>> <target name="depends">
>> <script language="ruby">
>> <![CDATA[
>> $project.setProperty "myrand", rand(4711).to_s
>> ]]>
>> </script>
>> </target>
>>
>> <target name="main" depends="depends">
>> <echo>
>> $${myrand} == ${myrand}
>> </echo>
>> </target>
>>
>> main:
>> [echo] ${myrand} == 718
>> BUILD SUCCESSFUL
>> Total time: 1 second
>>
>> Just put an integer to the Kernel#rand method.
>> If you want a floating point number, just use
>> rand without (integer) =
>>
>> <script language="ruby">
>> <![CDATA[
>> $project.setProperty "myrand", rand.to_s
>> ]]>
>> </script>
>>
>>
>> Regards, Gilbert
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]