Module cgl_rs::utils

source ·
Expand description

This module contains CGL utility functions, as well some miscellaneous functions.

Functions

  • Arguments
  • Appends a string to a file.
  • Converts a slice of u8 values from big-endian byte order to the system’s native byte order.
  • Calculates the CRC32 checksum of the given data.
  • The C implementation is based on linux’s crc64 implementation.
  • Generates a fast random number.
  • Sets the seed for the fast random number generator.
  • Returns the size of a file in bytes.
  • Returns a random index from the given slice of probabilities, where the probability of each index being chosen is proportional to its value in the slice.
  • Returns the time in seconds since the program started.
  • Returns a string representing the current timestamp.
  • Returns a boolean indicating whether the system is little-endian or not.
  • Linearly interpolates between two values.
  • Converts a slice of u8 values from little-endian byte order to the system’s native byte order.
  • Maps a value from one range to another.
  • Generates a random number using the rand31 algorithm.
  • Generates a random floating-point number between 0 and 1.
  • Generates a random floating-point number within the given range.
  • Generates a random integer within the given range.
  • Reads the contents of a file and returns it as a vector of bytes.
  • Reads the contents of a file and returns it as a string.
  • Reverses the order of bytes in the given slice of u8 values.
  • Applies the ROT13 substitution cipher to the given string.
  • Suspends the current thread for the specified amount of time.
  • Sets the seed for the rand31 random number generator.
  • Calculates the SuperFastHash of the given data.
  • Arguments
  • Writes a string to a file.
  • Generates a fast random number using the xorshf96 algorithm.