# Random value from csv in a repeat statement

**URL:** <https://community.gatling.io/t/random-value-from-csv-in-a-repeat-statement/3283>\
**Category:** Gatling (Open-Source)\
**Created:** [September 24, 2016, 8:54am UTC](https://community.gatling.io/t/random-value-from-csv-in-a-repeat-statement/3283 "2016-09-24T08:54:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajat\_Singh](https://avatars.discourse-cdn.com/v4/letter/r/cab0a1/32.png) [@Rajat\_Singh](https://community.gatling.io/u/Rajat_Singh)\
**Post date:** [September 24, 2016, 8:54am UTC](https://community.gatling.io/t/random-value-from-csv-in-a-repeat-statement/3283/1 "2016-09-24T08:54:06Z")

</div>

Hi folks,

I want to choose random value for every iteration for csv file

.repeat(3){ // repeating the iteration 3 times and everytime i want that new value it takes from the csv file  
feed(search)// Here i am putting the csv file  
exec(http(“Search”)

.get("/en/search/searchkey?text=${product}")// product is name of the column in csv file  
.headers(headers\_1)

.check(regex(""“productURL”:"/ralphlauren/en/mens/(.+?)"""").findAll.saveAs(“test1”)))

.exec( session =\> {  
val listB=session( “test1” ).as[List[String]]// converting the session variable test1 into list  
val size = listB.size// size of the list  
val OrderRef = r.nextInt(size);  
val test12=listB(OrderRef)

println( “Size of list is” )  
println( test12 )  
println(size)  
println(OrderRef)  
session  
})

.pause(1)  
.exec( session =\> {  
println( “product:” )  
println( session( “product” ).as[String] )// Using session variable i am printing the value which is fetched from csv file  
session  
})  
}
