title: How do you set global variables that don't get re-evaluated between feature methods
body: <p>I have this example script that looks like this:</p>
  
  <pre><code>@Stepwise
  class RandomTest extends GebReportingSpec {
  
  
      @Shared
      Random random = new Random()
      def tag = random.nextInt(999)+1
  
      def setupSpec() {
          new File('/ProgramData/geb.properties').withInputStream {
              properties.load(it)
          }
      }
  
      def "Random Test"(){
          when:
          println("Random1: ${tag}")
          println("Random2: ${tag}")
          then:
          Thread.sleep(1000)
      }
  
      def "Random test2"(){
          when:
          println("Random3: ${tag}")
          then:
          Thread.sleep(1000)
      }
  }
  </code></pre>
  
  <p>In this example, Random1, and Random 2 print the same number, but Random 3 prints a different number.</p>
  
  <p>for example this is my output when I run the code:</p>
  
  <pre><code>Random1: 528
  Random2: 528
  Random3: 285
  </code></pre>
  
  <p>I assume that this is because the Shared variables are re-evaluated between feature methods. I have tried moving those variable declarations outside of the <code>@Shared</code> annotation, to no avail.</p>
  
  <p>I want it so that the random tag variable is generated at the beginning of the spec, and I want it to retain its value, but I am not sure how I would set up the global variables to do this. would I need to instantiate the variables inside of the setupSpec?</p>