Vim documentation: vital/Random/Extra/FixedData
main help file
vital/Random.Extra/FixedData.txt random number generator using fixed data
Maintainer: Tsuyoshi CHO <Tsuyoshi.CHO+develop@Gmail.com>
==============================================================================
CONTENTS Vital.Random.Extra.FixedData-contents
INTRODUCTION Vital.Random.Extra.FixedData-introduction
INTERFACE Vital.Random.Extra.FixedData-interface
FUNCTIONS Vital.Random.Extra.FixedData-functions
==============================================================================
INTRODUCTION Vital.Random.Extra.FixedData-introduction
Vital.Random.Extra.FixedData provides a Random Number Generator (RNG) at fixed data.
THAT IS CAN BE USING FOR DEBUGGING/TESTING.
If this generator set to Vital.Random and use
Vital.Random.generate_canonical() or Vital.Random.range(),It need two or more
different data in seed list.
Generate all 0x00 list
let seed = [0xFF, 0x00]
Generate all 0xFF list
let seed = [0x00, 0xFF]
Usage:
let s:V = vital#{plugin-name}#new()
let s:X = s:V.import("Random.Extra.FixedData")
call s:X.srand([0x00, 0xFF])
echo s:X.rand()
" 0x00
echo s:X.rand()
" 0xFF
call s:X.srand([0xAA])
echo s:X.rand()
" 0xAA
==============================================================================
INTERFACE Vital.Random.Extra.FixedData-interface
------------------------------------------------------------------------------
FUNCTIONS Vital.Random.Extra.FixedData-functions
srand([{seed}]) Vital.Random.Extra.FixedData.srand()
Initialize the global generator with the given {seed} that is int list.
Fixed Data provide in data from 0 to len-1(cyclic).
rand() Vital.Random.Extra.FixedData.rand()
Generate a random number from the global generator.
Note: A return value is possibly negative. This is because Vim script
doesn't have an unsigned integer type.
new_generator() Vital.Random.Extra.FixedData.new_generator()
Create a new Generator object(Vital.Random.Extra.FixedData-Generator).
==============================================================================
OBJECTS Vital.Random.Extra.FixedData-objects
------------------------------------------------------------------------------
Generator Object Vital.Random.Extra.FixedData-Generator
Generator.next() Vital.Random.Extra.FixedData-Generator.next()
Generate the next data. see Vital.Random.Extra.FixedData.rand().
Generator.min() Vital.Random.Extra.FixedData-Generator.min()
Get the smallest possible value in the output range.
Generator.max() Vital.Random.Extra.FixedData-Generator.max()
Get the largest possible value in the output range.
Generator.seed({seeds}) Vital.Random.Extra.FixedData-Generator.seed()
Initialze the generator with the given {seed} list.
see Vital.Random.Extra.FixedData.srand().
==============================================================================
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl:noet:fen:
top - main help file - tag index