The [Linear Congruential Generator (LCG)](https://en.wikipedia.org/wiki/Linear_congruential_generator) is one of the oldest pseudo random number generator functions.

The algorithm is as follows:

## Xn+1=(aXn + c) mod m
where:
* `a`/`A` is the multiplier (we'll be using `2`)
* `c`/`C` is the increment (we'll be using `3`)
* `m`/`M` is the modulus (we'll be using `10`)

X0 is the seed.

# Your task

Define a method `random`/`Random` in the class `LCG` that provides the next random number based on a seed. You never return the initial seed value.

Similar to [random](https://docs.python.org/3/library/random.html#random.random) return the result as a floating point number in the range `[0.0, 1.0)`

# Example

```python
# initialize the generator with seed = 5
LCG(5)

# first random number (seed = 5)
LCG.random() = 0.3      # (2 * 5 + 3) mod 10 = 3 --> return 0.3

# next random number (seed = 3)
LCG.random() = 0.9      # (2 * 3 + 3) mod 10 = 9 --> return 0.9

# next random number (seed = 9)
LCG.random() = 0.1

# next random number (seed = 1)
LCG.random() = 0.5
```

Difficulty: introductory

Starter code:

def __init__(self, seed):
	

Solutions:
class LCG(object):
  def __init__(self, x):
      self._seed = x
  def random(self):
      self._seed = (2 * self._seed + 3) % 10
      return self._seed / 10

class LCG(object):
  a = 2
  c = 3
  m = 10
  
  def __init__(self, seed):
      self.seed = seed
      self.x = self.seed
  
  def g(self):
      while True:
          self.x = (self.a*self.x + self.c) % self.m
          yield self.x
          
  def random(self):
      return next(self.g())/10

class LCG(object):
  a = 2
  c = 3
  m = 10    
  
  def __init__(self, seed):
      self.x_n = seed
  
  def random(self):      
      # Update x_n with calculated x_n1
      self.x_n = (self.a * self.x_n + self.c) % self.m
      return self.x_n / 10

class LCG:
    a, c, m = 2, 3, 10

    def __init__(self, seed):
        self.seed = seed

    def random(self):
        self.seed = (self.a * self.seed + self.c) % self.m
        return self.seed / self.m

class LCG(object):
  a, c, m = 2, 3, 10
  
  def __init__(self, seed):
      self.seed = seed        # Store the seed for further use if needed one day
      self.x = seed
  
  def random(self):
      self.x = (self.a * self.x + self.c) % self.m
      return self.x / self.m

class LCG:
  a = 2
  c = 3
  m = 10
  
  def __init__(self, seed):
      self.x = seed
  
  def random(self):
      self.x = (self.a * self.x + self.c) % self.m
      return 1.0 * self.x / self.m

class LCG:
  m=10
  a=2
  c=3
  def __init__(self,seed):
    self.x=seed
  def random(self):
    self.x=(self.a*self.x+self.c)%self.m
    return self.x/10

class LCG(object):
    a = 2
    c = 3
    m = 10
  
    def __init__(self, seed):
        self.seed = seed
  
    def random(self):
        result = (self.a * self.seed + self.c) % self.m
        self.seed = result
        return result / 10.0

class LCG:
    def __init__(self, n):
        self.n = n
        
    def random(self):
        self.n = (self.n * 2 + 3) % 10
        return self.n / 10

# Linear Congruential Generator (a pseudo random number generator)
class LCG(object):
  a = 2
  c = 3
  m = 10
  
  def __init__(self, seed):
      self.seed = seed
  
  def random(self):
      next_random_num = self.a * self.seed + self.c
      next_random_num = next_random_num % self.m
      self.seed = next_random_num
      return next_random_num / 10

class LCG(object):
  a, c, m = 2, 3, 10
  
  def __init__(self, seed):
      self.seed = seed
  
  def random(self):
      self.seed = (self.a*self.seed + self.c)%self.m
      return self.seed/10

class LCG(object):
  
  
    def __init__(self, seed):
        self.seed = seed
        self.multiplier = 2
        self.increment = 3
        self.modulus = 10
  
    def random(self):
        self.seed = (self.multiplier * self.seed + self.increment) % self.modulus
        return self.seed / self.modulus

class LCG(object):
  a, c, m = 2, 3, 10
  
  def __init__(self, seed):
      self.current = seed
  
  def random(self):
      self.current = (self.a * self.current + self.c) % self.m
      return self.current / self.m

class LCG(object):
  a = 2
  c = 3
  m = 10
  
  def __init__(self, seed):
      self.seed = seed
  
  def random(self):
      self.seed = (self.seed * self.a + self.c) % self.m
      return self.seed / 10

class LCG(object):
  a = 2
  c = 3
  m = 10
  
  def __init__(self, seed):
      self.curr = seed
  
  def random(self):
      self.curr = (LCG.a * self.curr + LCG.c) % LCG.m
      return self.curr / LCG.m

class LCG(object):

    def __init__(self, seed):
        self.seed = seed
        self.a = 2
        self.c = 3
        self.m = 10

    def random(self):
        self.seed = (self.a * self.seed + self.c) % self.m
        return self.seed / 10

class LCG(object):
  def __init__(self, seed):
      self.seed = seed
  
  def random(self):
      a, c, m = 2, 3, 10
      self.seed = (a * self.seed + c) % m
      return self.seed / 10.0

class LCG(object):
  nonlocal a, c, m
  a = 2
  c = 3
  m = 10
  
  def __init__(self, seed):
      self.seed = seed
  
  def random(self):
      self.seed = (a * self.seed + 3) % m
      return self.seed / 10

class LCG(object):
  a = 2
  c = 3
  m = 10
  
  def __init__(self, seed):
      self.seed = seed
  
  def random(self):
        a = ((LCG.a*self.seed + LCG.c)%LCG.m)
        self.seed = a
        return a/10

class LCG(object):
  a = 2
  c = 3
  m = 10
  
  def __init__(self, seed):
      self.seed = seed
  
  def random(self):
      self.seed = (LCG.a*self.seed+LCG.c) % LCG.m
      return self.seed / LCG.m