Category "random"

How to generate pseudo-random number in dart

I'm currently trying to pick up a random item in a list in dart. For this, I would like to generate a pseudo-random number (my seed) which will be the index whe

How to choose a weighted random array element in Javascript?

For example: There are four items in an array. I want to get one randomly, like this: array items = [ "bike" //40% chance to select "car" //30%

How to generate a cryptographically secure random integer within a range?

I have to generate a uniform, secure random integer within a given range for a program that generates passwords. Right now I use this : RNGCryptoServiceProvide

Generating easy to remember numbers

Is it possible to generate random numbers between say 1000000 and 9999999 that are easy to remember? I know the term easy to remember is relative but I'd beli

random number generator function returns a nested tuple in haskell

I am trying to understand why my haskell function returns a nested tuple, and I cannot seem to wrap my head around the problem. I have this function that genera

Why is %random% in Windows time based and how to get a real random number?

I use the following script: set /a num=%random% %%1000 +3000 timeout /T %num% taskkill /F /IM chrome.exe I trigger it using Windows task scheduler on multipl

Is there a way to seed a cryptographically secure RNG engine in rust using a [u8; 64] array?

ORIGINAL QUESTION: I am currently trying to write a library in rust - to be compiled to WASM - for converting a bip39 mnemonic passphrase into an Arweave JWK. I

How to randomly generate names for each file in folder in batch file?

I want to rename all files in folder to random name but it wants to rename all the files to the same name: ren "c:\Test\*.txt" %Random%.txt pause Output: C:\Us

TI-84 Plus Random Number Generator Algorithm

Edit: my main question is that I want to replicate the TI-84 plus RNG algorithm on my computer, so I can write it in a language like Javascript or Lua, to test

How to generate random binary numbers 0 or 1 with length of N and with option to control the probability of having 0 or 1?

I want to generate random binary numbers (0 or 1) having N length size. The tricky part is that, It should be able to control the probability of having either m

ElasticSearch random score combined with boost?

I am building a iOS app with Firebase, and using ElasticSearch as a search engine to get more advanced queries. I am trying to achieve a system where I can get

How to set a seed for the generating random numbers in Excel? [duplicate]

I am running a experiment in excel using NORM.S.INV(RAND()) Is there a way to set the seed for the random function?

How to shuffle strings in arrays in golang?

So I created a program to help me decide which game to play. Before I start my problem let me show you my code: package main import ( "fmt" "strconv"

Why is my rock/paper/scissors game getting the same random number for multiple function calls?

I have made a functioning (if possibly extremely verbose) game of rock/paper/scissors. If I run the game by calling the function once over and over the 'compute

full width responsive image with image tag in Rails 4 app

Im using the code below to make header images appear randomly in a app I´m making. I want the images to span the whole width of the screen but somehow it

How to get the remaining sample after using random.sample() in Python?

I have a large list of elements (in this example I'll assume it's filled with numbers). For example: l = [1,2,3,4,5,6,7,8,9,10] Now I want to take 2 samples fr

JOptionPane with switch cases

Well, this code actually run but ended up with wrong output (specifically in "Randoms" cases) Note: it has a random generator for a random result or output I

Ensure the gensim generate the same Word2Vec model for different runs on the same data

In LDA model generates different topics everytime i train on the same corpus , by setting the np.random.seed(0), the LDA model will always be initialized and tr

How to get a random string of 32 hexadecimal digits through command line?

I'd like to put together a command that will print out a string of 32 hexadecimal digits. I've got a Python script that works: python -c 'import random ; print

Generate a two-digit positive random number in JavaScript [closed]

How can I implement a simple function in JavaScript that generates a random positive number that consists of only two digits?