Рубрики
Без рубрики

случайный: Случайная библиотека, написанная в V

Случайные Все цели случайные библиотеки, написанные в V. Github Link … Помечено V, Showdev, Python, производительность.

Все цели случайные библиотеки, написанные в V.

Github Link.

Delta456/случайно

Все цели случайные библиотеки, написанные в V.

Все цели случайные библиотеки, написанные в V.

Функции

  • Все функции вариации возможно.
  • Генерировать случайные int и Строка с легкостью.
  • Функции диапазона для int и F32 Отказ
  • Массивные функции, такие как разврат , Выберите , образец и т.п.
  • Облегчает жизнь Sorta.
  • Многие больше функций приходят в ближайшее время!

Установка

  • Через Гит клон

    • Гит клон https://github.com/Delta456/random
  • Через v Установить

    • v Установите случайно
  • Через вскрытие

    • VPKG Установка случайных

Документы

// struct for `triangular()`
struct Triangular {
mut
        low  f32 = 1.0
        high f32 = 1.0
        mode int = 1
}
// struct for `int_range()`
struct IntRange {
        start int
        stop  int
        step  int = 1
}
// struct for `float_range()`
struct FloatRange {
        start f32
        stop  f32
        step  f32 = 1.0
}
// normal_variate is the normal distribution where mu is the 
// mean, and stigma is the standard deviation
fn normal_variate(mu, stigma f32) f32


// expo_variate is the expovariate distribution

Функции

  • Все функции вариации возможно.
  • Генерировать случайные int и Строка с легкостью.
  • Функции диапазона для int и F32 Отказ
  • Массивные функции, такие как разврат , Выберите , образец и т.п.
  • Облегчает жизнь Sorta.
  • Многие больше функций приходят в ближайшее время!

Установка

  • Через Гит клон

    • Гит клон https://github.com/Delta456/random
  • Через v Установить

    • v Установите случайно
  • Через вскрытие

    • VPKG Установка случайных

Документы

// struct for `triangular()`
struct Triangular {
mut:
        low  f32 = 1.0
        high f32 = 1.0
        mode int = 1
}

// struct for `int_range()`
struct IntRange {
        start int
        stop  int
        step  int = 1
}

// struct for `float_range()`
struct FloatRange {
        start f32
        stop  f32
        step  f32 = 1.0
}

// normal_variate is the normal distribution where mu is the 
// mean, and stigma is the standard deviation
fn normal_variate(mu, stigma f32) f32


// expo_variate is the expovariate distribution where lambda is // 1.0 divided by the desired mean. It should be nonzero. 
// return values range from 0 to positive infinity if lambda is // positive else negative
fn expo_variate(lambda f32) f32


// weibull distribution where alpha is the scale parameter and 
// beta is the shape parameter
fn weibull_variate(alpha, beta f32) f32

// lognorm_variate is the log nomral distribution If you take 
// the natural logarithm of this distribution, you'll get a 
// normal distribution with mean mu and standard deviation 
//sigma. mu can have any value, and sigma must be greater than
// zero
fn lognorm_variate(mu, stigma f32) f32

// gamma_distribution is the gamma distribution conditions on the parameters are alpha > 0 and beta > 0.
// conditions on the parameters are alpha > 0 and beta > 0.
//        The probability distribution function is:
//                   math.pow(x, (alpha - 1)) * math.exp(-x / beta)
//         pdf(x) =  --------------------------------------
//                     math.gamma(alpha) * math.pow(beta, alpha)
fn gamma_variate(alpha, beta f32) f32


// beta_variate is the beta distribution parameters alpha > 0 
// and beta > 0 return values range between 0 and 1
fn beta_variate(alpha, beta f32) f32


// pareto_variate is pareto distribution. alpha is the shape 
// paramter.
fn pareto_variate(alpha f32) f32

// vommeises_variate is the circular data distribution
// where mu is the mean angle, expressed in radians between 0 and 2*pi, and
// kappa is the concentration parameter, which must be greater than or
// equal to zero. If kappa is equal to zero, this distribution reduces
// to a uniform random angle over the range 0 to 2*pi
// mu: mean angle (in radians between 0 and 2*pi)
// kappa: concentration parameter kappa (>= 0)
// if kappa == 0 then generate uniform random angle
fn vommeises_variate(mu, kappa f32) f32

// triangular is the triangular distribution. continuous 
// distribution bounded by given lower and upper limits, and 
// having a given mode value in-between
fn triangular(mut tri Triangular) f32

// uniform returns a random number between the range [a, b) or 
// [a, b] depending on rounding
fn uniform(a, b f32) f32


// int_range returns a random int between the specified range
fn int_range(range IntRange) int


// float_range returns a random float upon the given range
fn float_range(range FloatRange) f32


// numeric returns a number with n digits long
fn numeric(n int) int


// bool returns a random bool
fn bool() bool


// shuffle returns the new shuffled array
fn shuffle(arr []T) []T


// choose returns a random element from the array
fn choose(arr []T) T

// string returns a random string of n length
fn string(n int) string


// string_alpha returns an alpha string of n length
fn string_alpha(n int) string

Применение

Посмотреть Математика , Случайные и Строка для использования.

Благодарность

Я благодарю Python Software Foundation за их работу на Случайные Библиотека, которая помогла мне портировать вариационные функции.

Лицензия

Лицензированные под MIT

Оригинал: “https://dev.to/delta456/random-a-random-library-written-in-v-44gg”