OGCATS randomization notes

future of OGCATS
33481218050282424732010044081128699987812287782893023053970080888682140917516
package main

import (
"fmt"
"math/rand"
"os"
"strconv"
"time"
)

//https://dashboard.tenderly.co/tx/polygon/0xde5e65da5017c7cb852ab7e21aaad54ee638f2cae7d68c4cc1697c59f141cc2b/logs
const chainlinkRandomNumber = "33481218050282424732010044081128699987812287782893023053970080888682140917516"

//max int64 -> random number from chainlink will be cut to 18 digits
//9223372036854775807 -> this is max int64 in go, as max value for 'seed'
func main() {
fmt.Printf("running script at @ unix nano %d\n", time.Now().UnixNano())

//chainlinkRandomNumber is too big, get the first 18 digits
seedStr := chainlinkRandomNumber[0:18]
seed, err := strconv.ParseInt(seedStr, 10, 64)
if err != nil {
panic(err)
}

rand.Seed(seed)

var nftIDs []int
for i := 1; i <= 1000; i++ {
nftIDs = append(nftIDs, i)
}

rand.Shuffle(len(nftIDs), func(i, j int) {
nftIDs[i], nftIDs[j] = nftIDs[j], nftIDs[i]
})

printToFile("shuffled.txt", nftIDs)
fmt.Println(nftIDs)
}

func printToFile(filePath string, values []int) {
f, err := os.Create(filePath)
if err != nil {
panic(err)
}
defer f.Close()
for _, value := range values {
fmt.Fprintln(f, value) // print values to f, one per line
}
}

Crypto / Security… mostly

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Deploying Angular 9 ivy packages

RelayHooks vs. RelayContainers

Using the async-hooks API to integrate Envoy with our RPC library — Part I

How to use firebase with react app

Architect a Blockchain Supply Chain Solution Part B Project FAQ — Udacity Blockchain

Install Bulma into React.js

Install Bulma into React.js

AURDINO PROJECT

Comparing 5 Node.js Logging Libraries for You To Make the Optimal Choice

Wood logs

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Xyz Zyx

Xyz Zyx

Crypto / Security… mostly

More from Medium

NFT (ERC721) with Physical Asset Delivery and Secondary Royalties (ERC2981)

Deploying an IPFS-backed NFT

Interaction between Smart Contracts

Deploying a Smart Contract and Selling NFTs