Seed, Rnd()

Returns a Random number between 0 and 255. LunaAVR's Pseudo Random Number Generatoris based on a Linear feedback shift register (LFSR). You must initialize the generator with Seed prior to your first call to Rnd(). A sporadic call to Seed increases the probability of a random number. There is a chance of returning a zero value when the LFSR jumps to the idle state. It is therefore recommended to vary the position and Seed starting values in your code until you get a constant and evenenly spread random value.

Syntax: Seed Expression

Syntax: result = Rnd()


  ' Load the Random Generator with a zuerst Zufallszahlengenerator mit einem arbitrary starting value
  Seed 11845
  ' permanently output random numbers
    print str(Rnd())
    waitms 200