You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by andreea raluca <ma...@yahoo.com> on 2011/11/16 15:42:16 UTC
generate random value in hex
Hello,
I have to generate in JMeter a randomized variable that have this form: id=4eeb87da1cdf8812. In the code it’s described like this :
'&id=' . substr(md5(microtime() . uniqid('')), 0, 16)
Can anyone help me?
Thank you
Re: generate random value in hex
Posted by sebb <se...@gmail.com>.
On 23 November 2011 20:25, Philippe Mouawad <ph...@gmail.com> wrote:
> microtime:
> http://www.php.net/manual/en/function.microtime.php
>
> uniqid
> http://www.php.net/manual/en/function.uniqid.php
>
> md5:
> http://www.php.net/manual/en/function.md5.php
>
> Since a substring of 0,16 is done on it, it could just be a random and
> RandomString might do it.
Good point.
> Otherwise you will have to use BeanShell.
... or one of the other scripting languages supported by JMeter.
> You may also develop an MD5 function and contribute it.
JMeter already includes Commons Codec, which has some useful MD5
methods in DigestUtils.
These could be used in any of the scripting functions - or indeed used
to create an independent MD5 function.
> Regards
> Philippe
> http://www.ubik-ingenierie.com
>
> On Wed, Nov 23, 2011 at 8:44 PM, sebb <se...@gmail.com> wrote:
>
>> On 16 November 2011 14:42, andreea raluca <ma...@yahoo.com> wrote:
>> > Hello,
>> > I have to generate in JMeter a randomized variable that have this form:
>> id=4eeb87da1cdf8812. In the code it’s described like this :
>> > '&id=' . substr(md5(microtime() . uniqid('')), 0, 16)
>> > Can anyone help me?
>>
>> There are various script functions that might perhaps be of use; have a
>> look at:
>>
>> http://jmeter.apache.org/usermanual/functions.html
>>
>> But without knowing what microtime() and uniqid() do it's impossible
>> to say if they would be suitable or not.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> For additional commands, e-mail: user-help@jmeter.apache.org
>>
>>
>
>
> --
> Cordialement.
> Philippe Mouawad.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: generate random value in hex
Posted by Philippe Mouawad <ph...@gmail.com>.
microtime:
http://www.php.net/manual/en/function.microtime.php
uniqid
http://www.php.net/manual/en/function.uniqid.php
md5:
http://www.php.net/manual/en/function.md5.php
Since a substring of 0,16 is done on it, it could just be a random and
RandomString might do it.
Otherwise you will have to use BeanShell.
You may also develop an MD5 function and contribute it.
Regards
Philippe
http://www.ubik-ingenierie.com
On Wed, Nov 23, 2011 at 8:44 PM, sebb <se...@gmail.com> wrote:
> On 16 November 2011 14:42, andreea raluca <ma...@yahoo.com> wrote:
> > Hello,
> > I have to generate in JMeter a randomized variable that have this form:
> id=4eeb87da1cdf8812. In the code it’s described like this :
> > '&id=' . substr(md5(microtime() . uniqid('')), 0, 16)
> > Can anyone help me?
>
> There are various script functions that might perhaps be of use; have a
> look at:
>
> http://jmeter.apache.org/usermanual/functions.html
>
> But without knowing what microtime() and uniqid() do it's impossible
> to say if they would be suitable or not.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>
--
Cordialement.
Philippe Mouawad.
Re: generate random value in hex
Posted by sebb <se...@gmail.com>.
On 16 November 2011 14:42, andreea raluca <ma...@yahoo.com> wrote:
> Hello,
> I have to generate in JMeter a randomized variable that have this form: id=4eeb87da1cdf8812. In the code it’s described like this :
> '&id=' . substr(md5(microtime() . uniqid('')), 0, 16)
> Can anyone help me?
There are various script functions that might perhaps be of use; have a look at:
http://jmeter.apache.org/usermanual/functions.html
But without knowing what microtime() and uniqid() do it's impossible
to say if they would be suitable or not.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org