Question: I am trying to generate a random number in c++ using a modern approach.However i get the same random number every time i call the function

```
int getRandomPixel() {
    std::random_device rd; // obtain a random number from hardware
    std::mt19937 eng(rd()); // seed the generator
    std::uniform_int_distribution<> distr(0, 255); // define the range
    return distr(eng);
}

```

Answer: 
**Step 1: Check PATH of MAVEN and JAVA**

```
mvn -v

```

In the output check if "Java version" is pointing to 1.9

```
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T13:28:13+05:30)
Maven home: /Maven/3.5.2
Java version: 9.0.4, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-9-oracle
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-119-generic", arch: "amd64", family: "unix"

```

**Step 2: Check JDK 9 is configured in IDE (eclipse / sts)**

* Go to Preferences > Java > Installed JREs :: [Check if Java 9 is available](https://i.stack.imgur.com/5R73D.png)
* If Java 9 is not available, then Click **Add**
* Choose JRE Type **Standard VM / JVM** and click **Next**
* **JRE Home** -- Java 9 Home path.
* **JRE name** will get auto-filled and **JRE system libraries** will show **jrt-fs.jar** was loaded.
* Hit **Finish**
* Now you should see JVM 8 and 9 both [showing up in the Installed JREs section](https://i.stack.imgur.com/XC66p.png)
* Hit **Apply and Close**

**Step 3: Update your Maven Project for Changes to Take affect**

* Follow the tip given by [Justin Albano](https://stackoverflow.com/users/2403253/justin-albano) and you are ready to work with your Maven Project using Java 9.
Sometimes the Maven source version (`1.9` is your particular case) and the Eclipse source version fall out of sync, especially if the source version in the `pom.xml` file is changed *after* the project has been created in Eclipse. To bring the two back into sync, perform the following:

1. Right click on the project
2. Mouseover `Maven`
3. Click `Update Project...`

You can also update the Maven configuration using `Alt` + `F5`. For more information, see [What causes imported Maven project in Eclipse to use Java 1.5 instead of Java 1.6 by default and how can I ensure it doesn't?](https://stackoverflow.com/questions/3539139/what-causes-imported-maven-project-in-eclipse-to-use-java-1-5-instead-of-java-1).