Skip to content

Documentation v0.1

IwraStudios edited this page Oct 6, 2016 · 2 revisions

Documentation

If you want more documentation on something please leave an issue at the Github Issues describing what you want documentation on.

Contents:

Random Generator

byte[] GetRandomBytes(uint)

Output(s):

  • array of random bytes

Argument(s):

  • Uint(32) for the amount of random bytes it should return

Info

  • Might have a slight overhead compared for certain tasks (See last Array.Resize in the function)

string GetRandomString(uint, Encoding)

Output(s):

  • string with the selected options

Argument(s):

  • Uint(32) for the amount of characters
  • System.Text.Encoding type

Info

  • Supported Encodings(by default): UTF-8, Unicode(UTF-16, LittleEndian/BigEndian)
  • Uses "GetRandomBytes" and converts it to the selected Encoding

Random Utils

byte[] Combinebyte(byte[][])

Output(s):

  • byte array containing all values of the input

Argument(s):

  • byte-array array or a 2-dimensional array

Info

  • Mostly used internally

int ByteArrayToInt(byte[4])

Output(s):

  • Int32 from 4 bytes

Argument(s):

  • (as of writing) the function only accepts a byte-array containing 4 bytes

Info

  • Used more as a demo than an actual function

string ByteArrayToHex(byte[])

Output(s):

  • string using mask 0-9|a-f

Argument(s):

  • byte array any length, string-length equals byte-array-length

Info

  • Used in specific situations like color spaces
  • Not internally used, more as a demo

string ByteArrayToString(byte[])

Output(s):

  • string using encoding utf-8

Argument(s):

  • byte array any length, string-length equals byte-array-length

Info

  • Used for simple mindless conversion of bytes
  • used as a shortcut on GetRandomString(uint, Encoding)
    • does not use GetRandomString

Task<int> InefficientRandomInt(int = int.MinValue, int = int.MaxValue)

Output(s):

  • Task in which the in the is an random int generated by our time based algorithm
  • WARNING: because this is a task it might need time to generate(that's why its inefficient)
  • Usage: Task<int> inef = new RandomUtils().InefficientRandomInt([options]); int i = inef.result;

Argument(s):

  • int for Minimal value of the random int
  • int for Maximal value of the random int

Info

  • use `Task {object_name}; {object_name}.result;
  • only use in single int's as it is inefficient and might not work out in a fast paced system

int EfficientRandomInt(int = int.MinValue, int = int.MaxValue)

Output(s):

  • Int32 Random Int

Argument(s):

  • int for Minimal value of the random int
  • int for Maximal value of the random int

Info

  • at time of writing this function may not output a different number if you do it fast after each other

Random Cosntants

###Coming soon...