Skip to content

Linear feedback shift register based psuedo random number generator

License

Notifications You must be signed in to change notification settings

taylorza/go-lfsr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LFSR Build Status Coverage Status Go Report Card GoDoc

Linear feedback shift register (LFSR) based psuedo random number generator

Random numbers generated by the LFSR implemented in this package will produce a sequence that has a period covering the full range of bits for the chosen LFSR. A well designed n-bit LFSR will return the numbers in the range 1-2^n in a pseudo random order with no repeating numbers until the full range has been exhausted. In this package the following linear feedback registers are provided:

  • Lfsr8 - 8 bit LFSR with a period of 255
  • Lfsr16 - 16 bit LFSR with a period of 65,535
  • Lfsr32 - 32 bit LFSR with a period of 4,294,967,296
  • Lfsr64 - 64 bit LFSR with a period of 18,446,744,073,709,551,616

Installation

Use the 'go' command:

$go get github.com/taylorza/go-lfsr

Examples

    // Create a 64 bit LFSR with a time based seed
    l := lfsr.NewLfsr64(0)

    // Get the next random number in the sequence from the LFSR
    v, _ := l.Next();

See tests for more examples

Copyright

Copyright (C)2013-2019 by Chris Taylor (taylorza) See Licence

About

Linear feedback shift register based psuedo random number generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages