Bug 62553

Summary: Random element might return same value even if property "Per thread user (User)" is set to TRUE
Product: JMeter - Now in Github Reporter: Nikhil B <ibenikhil>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: major CC: p.mouawad
Priority: P2 Keywords: FixedInTrunk
Version: 4.0   
Target Milestone: JMETER_5.0   
Hardware: PC   
OS: All   
Attachments: attachment of random variable configuration.

Description Nikhil B 2018-07-18 13:09:37 UTC
Created attachment 36041 [details]
attachment of random variable configuration.

I have created script with some session keys passing. 
In my script i need to have different session keys for each request.
I have configured a random variable in Jmeter and set the option for per thread user as TRUE(as per my readings/knowledge) if we set a this configuration as true then it should create different variables for each thread.

But out of my 50 threads 49 different variables have been created and one variable get repeadted.


I have been attaching the image of random variable configuration.

following are the random variables get created. Here thread 15 and thread 28 having same variables.

Thead1	,abcdefghijk41128404048       
Thead2	,abcdefghijk41230939629   
Thead3	,abcdefghijk41284804475
Thead4	,abcdefghijk41139561766
Thead5	,abcdefghijk41018558237
Thead6	,abcdefghijk41040681298
Thead7	,abcdefghijk41271915387
Thead8	,abcdefghijk41247099083
Thead9	,abcdefghijk41232863374
Thead10	,abcdefghijk41255755934
Thead11	,abcdefghijk41155528845
Thead12	,abcdefghijk41136483774
Thead13	,abcdefghijk41117631078
Thead14	,abcdefghijk41199582594
Thead15	,abcdefghijk41044336413
Thead16	,abcdefghijk41147641493
Thead17	,abcdefghijk41185346885
Thead18	,abcdefghijk41141677885
Thead19	,abcdefghijk41290960458
Thead20	,abcdefghijk41180345149
Thead21	,abcdefghijk41109551351
Thead22	,abcdefghijk41248060956
Thead23	,abcdefghijk41166494189
Thead24	,abcdefghijk41298847810
Thead25	,abcdefghijk41265759405
Thead26	,abcdefghijk41028561708
Thead27	,abcdefghijk41111667470
Thead28	,abcdefghijk41044336413
Thead29	,abcdefghijk41034717690
Thead30	,abcdefghijk41010863259
Thead31	,abcdefghijk41061457739
Thead32	,abcdefghijk41120901444
Thead33	,abcdefghijk41077424818
Thead34	,abcdefghijk41251716070
Thead35	,abcdefghijk41068190845
Thead36	,abcdefghijk41031447325
Thead37	,abcdefghijk41242097348
Thead38	,abcdefghijk41158414462
Thead39	,abcdefghijk41020866730
Thead40	,abcdefghijk41188617250
Thead41	,abcdefghijk41259795797
Thead42	,abcdefghijk41281726484
Thead43	,abcdefghijk41048376276
Thead44	,abcdefghijk41171688299
Thead45	,abcdefghijk41064535730
Thead46	,abcdefghijk41169572180
Thead47	,abcdefghijk41152450854
Thead48	,abcdefghijk41269029771
Thead49	,abcdefghijk41009324263
Thead50	,abcdefghijk41103395369
Comment 1 Philippe Mouawad 2018-07-18 19:06:03 UTC
I am not sure it's an issue.
As per documentation, since you didn't set a seed, System.currentTimeMillis is used, so if 2 threads start at same millis, you might get this behaviour.

@Team, should be use new Random() when seed is empty ?
Comment 2 Vladimir Sitnikov 2018-07-18 20:42:14 UTC
+1 for `new Random()` (== different seeds for each thread) when the seed is not set
Comment 3 Nikhil B 2018-07-19 05:58:25 UTC
Hi I have not given any seed configuration. 
So I am making change in my configuration for seed configuration i am giving ${__Random(MIN,MAX)} as value. Will it solve my problem. 

But my question is with default seed configurations it should work properly?
Comment 4 Nikhil B 2018-07-19 06:00:24 UTC
Thanks for your immediate assist. @Vladimir Sitnikov and @Philippe Mouawad.
Comment 5 Philippe Mouawad 2018-07-19 19:18:38 UTC
Author: pmouawad
Date: Thu Jul 19 19:17:36 2018
New Revision: 1836293

URL: http://svn.apache.org/viewvc?rev=1836293&view=rev
Log:
Bug 62553 - Random element might return same value even if property "Per thread user (User)" is set to TRUE
Bugzilla Id: 62553

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/config/RandomVariableConfig.java
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/component_reference.xml
Comment 6 The ASF infrastructure team 2022-09-24 20:38:14 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4827