goutils

package module
v0.0.0-...-0e6ccbb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2022 License: LGPL-3.0 Imports: 6 Imported by: 0

README

goutils

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomIntn

func RandomIntn(n int, max int, seed uint64) []int

RandomIntn returns n random integer between 0 and max - 1

func RandomU

func RandomU(n int, seed uint64) []float32

RandomU returns n random numbers between 0 and 1.

func ReadCSV

func ReadCSV(fname string) (dataframe [][]string, err error)

ReadFromCSV reads a .csv file and returns it as a [][]string

func ReadFloats

func ReadFloats(s *bufio.Scanner) ([]float64, error)

ReadFloats reads float64 numbers from text input, return as []float64 Example: to read floats from standard input

xs, err := ReadFloats(bufio.NewScanner(os.Stdin))

func ReadLines

func ReadLines(s *bufio.Scanner) ([]string, error)

ReadLines reads lines from text input, returns as a []string. Example:

xs, err := ReadLines(bufio.NewScanner(os.Stdin))

func ReadWords

func ReadWords(s *bufio.Scanner) ([]string, error)

ReadWords reads words (split at whitespaces) from a text input, returns a []string Example:

xs, err := ReadWords(bufio.NewScanner(os.Stdin))

func WriteCSV

func WriteCSV(table [][]string, fname string) error

WriteCSV takes a [][]string as saves it in a text file. Comma is the field delimiter.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL