# Is xoshiro128** pseudorandom number generator reversible?

Advertisements This answer mentions the xoshiro128** algorithm and provides a JavaScript implementation. Question: Is it possible to derive the seed if you know the first random number produced by this generator? >Solution : No, it’s not possible to derive a seed given a single value. There is also no guarantee that you can derive a… Read More Is xoshiro128** pseudorandom number generator reversible?

# Variable with x number of strings from list in Python

Advertisements Say that I had a list containing 5 strings, and I wanted to print a random number of randomly generated strings from this list. Is there a simple way to do this? I know multiple ways to print a single random string from this list, and multiple ways to print a set number of… Read More Variable with x number of strings from list in Python

# nested strings for random.choice python

Advertisements I have 4 lists and want to choose a random list and then choose a random item of it. this is my code but it doesn’t work properly. can you help please? import random w=[‘*’, ‘&’ ,’^’, ‘%’ ,’\$’ ,’#’, ‘@’ ,’!’] w1=[‘w’,’a’,’s’,’r’,’i’,’t’,’e’,’n’,’d’,’c’] w2=[‘W’,’A’,’S’,’R’,’I’,’T’,’E’,’N’,’D’,’C’,] w3=[‘1′,’2’] p=” j=8 while j: e=random.choice([‘w’,’w1′,’w2′,’w3′]) q=random.choice(f'{f"{e}"}’) p+=q j-=1 print(p)… Read More nested strings for random.choice python

# Is it necessary to call rand.Seed manually?

Advertisements I want to know do we have to call rand.Seed(n) manually in Go? I have a code that looks like this: import ( "fmt" "math/rand" ) func main() { fmt.Println(rand.Intn(100)) fmt.Println(rand.Intn(100)) fmt.Println(rand.Intn(100)) } Everytime I run this code, each line prints different numbers than the others. So do I need to call rand.Seed(n) each… Read More Is it necessary to call rand.Seed manually?

# PHP Trying to return random number 1-5. 1 often, 5 least often

Advertisements I am trying to set up a random number picker 1 through 5, with each number showing up on a predefined percentage value; 1 showing up often and 5 showing up the least often. So for example, the chances if these 5 numbers showing up might be as follows: 1 – 45%, 2 –… Read More PHP Trying to return random number 1-5. 1 often, 5 least often

# How to pick a random number for a list in MySQL

Advertisements I want to pick a random number from a list of integers in a MySQL Stored Procedure. This list is generated from another function using some calculations. Example: [41,69,9,31,10,33,13,73,20,62,21,58,22,39] I tried the RAND() function but they are dependent on constant min, max, and step values it seems. Any help would be great. Note: This… Read More How to pick a random number for a list in MySQL

# Replace NA with random weighted value by group

Advertisements I want to replace the NAs in a variable with a weighted random sample of the values within a given group. Rough sample data: A tibble: 16 × 3 letter number code <chr> <int> <chr> 1 a 1 w1 2 a 1 w1 3 a 1 w2 4 a 1 NA 5 a 2… Read More Replace NA with random weighted value by group

# How can I generate cryptographically strong random strings with a given length

Advertisements I need to generate cryptographically strong random alphanumeric strings with a specified length, only using the following characters. A-Z a-z 0-9 Is there a way to accomplish this in C#? >Solution : You can use class RandomNumberGenerator to generate cryptographically-secure random numbers to do this, for example: string allowed = "ABCDEFGHIJKLMONOPQRSTUVWXYZabcdefghijklmonopqrstuvwxyz0123456789"; int strlen =… Read More How can I generate cryptographically strong random strings with a given length

# Trying to exclude an elements in an array if it overlaps with another array in Python

Advertisements I am writing code that pseudorandomises positions from an array: centre_pos = [‘A’,’B’,’C’,’D’,’E’] corner_pos = [‘1′,’2′,’3′,’4’] def position_generator(): #for centre, corner in zip(centre_pos, corner_pos): random_centre = random.choice(centre_pos) random_corner = random.choice(corner_pos) #if random_centre and random_corner in exclusion: #else: return random_centre, random_corner However, I want to exclude certain combinations of centre_pos and corner_pos. For example if… Read More Trying to exclude an elements in an array if it overlaps with another array in Python