In Python, using the uniform function is the easiest way to get a random number between a float range.
Using uniform Method
The random.uniform(a, b) method returns a random floating point number N such that a
In Golang, using the crypto/aes package is the easiest way to encrypt a string using AES GCM 256.
In cryptography, Galois/Counter Mode (GCM) is a mode of operation for symmetric-key cryptographic block ciphers which is widely adopted for its performa...
In Python, there are 3 ways to generate random integers between 0 and 9.
Using randrange Method
The random.randrange(start, stop[, step]) method returns a randomly selected element from range(start, stop, step). For example,
#!/usr/bin/python3
...
In Golang, there are 4 ways to generate a uuid.
Using uuid Package
install
Use the following command to download the repository to the local file system.
install
go mod tidy
go get github.com/google/uuid
go install github.com...
In Python, there are 3 ways to randomly select a element from list.
Using random.choice Method
The random.choice() method returns a random element from the non-empty sequence seq. If seq is empty, raises IndexError. For example,
#!/usr/bin/pyth...
In Python, there are 3 ways to generate a random string.Using List Comprehension
List comprehensions provide a concise way to create lists. See the following example:
#!/usr/bin/python3
# -*- coding: utf8 -*-
# Import module
import random
impor...
Shuffling a Slice in Golang.Using rand.Shuffle Function
Shuffle pseudo-randomizes the order of elements using the default Source.
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
s := []string{"Japan", "Germany", "France"}
...
Secure hashes and message digests.Hash algorithms
The hashlib module implements a common interface to many different secure hash and message digest algorithms. Included are the FIPS secure hash algorithms SHA1, SHA224, SHA256, SHA384, and SHA512 (def...
Creating Random Strings of a fixed length in Go.
Using rand.Int63 Function
Int63 returns a non-negative pseudo-random 63-bit integer as an int64 from the default Source.
package main
import (
"fmt"
"math/rand"
"time"
)
const letters = "a...
Print the first 10 lines of each FILE to standard output.
head is a program on Unix and Unix-like operating systems used to display the beginning of a text file or piped data.
By default, head will print the first 10 lines of its input to the stand...
command line tool and library for transferring data with URLs.
cURL (pronounced 'curl') is a computer software project providing a library (libcurl) and command-line tool (curl) for transferring data using various network protocols. The name ...