# Feeder - Not using random value

**URL:** <https://community.gatling.io/t/feeder-not-using-random-value/4191>\
**Category:** Gatling (Open-Source)\
**Created:** [February 20, 2018, 2:37pm UTC](https://community.gatling.io/t/feeder-not-using-random-value/4191 "2018-02-20T14:37:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gatling\_Learner](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@Gatling\_Learner](https://community.gatling.io/u/Gatling_Learner)\
**Post date:** [February 20, 2018, 2:37pm UTC](https://community.gatling.io/t/feeder-not-using-random-value/4191/1 "2018-02-20T14:37:37Z")

</div>

I have a script which needs to take random values from csv

Here is a sample code

`

val feeder = csv(“test.csv”).random;  
val scn = scenario(“Scenario Name”).feed(feeder).during(5 minutes){ // A scenario is a chain of requests and pauses  
exec(flushHttpCache).exec(flushCookieJar).exec(http(“request\_1”)  
.get(“/”))  
.pause(2)  
.exec { session =\>  
println(“This is the value =========================”+session(“number”).as[String])  
session  
}

`

The is the csv file

`

number  
1  
2  
3  
4  
5  
6  
7  
8  
9

`

And i get the output as follows

`

2018-02-20 19:59:29 5s elapsed  
---- Requests ------------------------------------------------------------------

> Global (OK=2 KO=0 )  
> request\_1 (OK=2 KO=0 )

---- Scenario Name -------------------------------------------------------------  
[-------------------------------------] 0%  
waiting: 1 / active: 1 / done:0

---

<div class="post-metadata">

**Author:** ![khaled.alrimawi7](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@khaled.alrimawi7](https://community.gatling.io/u/khaled.alrimawi7)\
**Post date:** [February 20, 2018, 3:48pm UTC](https://community.gatling.io/t/feeder-not-using-random-value/4191/2 "2018-02-20T15:48:24Z")

</div>

try to use the below :

```auto
val feeder = csv("credentials.csv").random;
val scn = scenario("Scenario Name").during(1 minutes) { // A scenario is a chain of requests and pauses
  feed(feeder).exec(flushHttpCache).exec(flushCookieJar).exec(http("request_1")
    .get("/"))
    .pause(2)
    .exec { session =>
      println("This is the value =========================" + session("param_customerId").as[String])
      session
    }
}

```

---

<div class="post-metadata">

**Author:** ![Gatling\_Learner](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@Gatling\_Learner](https://community.gatling.io/u/Gatling_Learner)\
**Post date:** [February 20, 2018, 6:09pm UTC](https://community.gatling.io/t/feeder-not-using-random-value/4191/3 "2018-02-20T18:09:01Z")

</div>

Thanks much Khaled . I understood and now it works when i move the feeder inside the during block.
