random Questions

7

Solved

How can I declare an array like variable with two or three values and get them randomly during execution? a := [1, 2, 5] -- sample sake select random(a) -- returns random value Any suggestion w...
Hagiographer asked 12/1, 2013 at 23:27

10

Solved

I am trying to use the Bash variable $RANDOM to create a random string that consists of 8 characters from a variable that contains integer and alphanumeric digits, e.g., var="abcd1234ABCD&quot...
Ayres asked 9/9, 2015 at 16:11

5

Solved

I have to generate a uniform, secure random integer within a given range for a program that generates passwords. Right now I use this: RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();...
Hydrokinetics asked 23/2, 2017 at 21:22

9

I am trying to generate random points on the surface of the sphere using numpy. I have reviewed the post that explains uniform distribution here. However, need ideas on how to generate the points o...
Coincident asked 28/11, 2015 at 22:1

2

Solved

I was going through a book that explained the xorshift algorithm (I know, basic stuff). Then, while searching a little bit more on the Internet, I found that all the basic examples seem to shift th...
Polyhydroxy asked 18/3, 2022 at 5:29

8

Any ideas how to pick an item/record randomly from a DynamoDB table? I don't believe there are any provisions for this in the API. I thought about maintaining a table of NumericId|MyOtherKey ("Num...
Survance asked 19/5, 2012 at 15:9

18

Solved

I want to create exact 5 random characters string with least possibility of getting duplicated. What would be the best way to do it? Thanks.
Foin asked 25/3, 2011 at 22:26

5

is there a way to let the program select a random number between say 1 and 1,000 without importing random?
Polk asked 9/4, 2014 at 0:36

25

Solved

How can I create an array with 40 elements, with random values from 0 to 39 ? Like [4, 23, 7, 39, 19, 0, 9, 14, ...] I tried using solutions from here: http://freewebdesigntutorials.com/javaScr...
Taw asked 29/4, 2011 at 20:5

7

Okay, I'm still fairly new to Java. We've been given an assisgnment to create a game where you have to guess a random integer that the computer had generated. The problem is that our lecturer is in...
Flagrant asked 4/10, 2011 at 2:17

6

I want to create a random string (token) which can be used to identify a user whilst avoiding any potential conflicts with any other users' tokens. What I was thinking of was an MD5 hash of naviga...
Betts asked 16/12, 2011 at 9:50

8

Solved

I have to generate numbers in range [-100; +2000] in c++. How can I do this with rand if there is only positive numbers available? Are there any fast ways?
Horne asked 30/9, 2010 at 12:56

8

Solved

What is an efficient way of generating N unique numbers within a given range using C#? For example, generate 6 unique numbers between 1 and 50. A lazy way would be to simply use Random.Next() in a ...
Kuopio asked 28/11, 2010 at 21:19

7

Solved

I am looking for a pseudo random number generator which would be specialized to work fast when it is given a seed before generating each number. Most generators I have seen so far assume you set se...
Contingency asked 3/10, 2008 at 16:25

6

Solved

I want to generate a random number of type short exactly like there is a function for integer type called Random.nextInt(134116). How can I achieve it?
Concepcionconcept asked 17/4, 2012 at 9:55

28

How to generate a random number within a range in Bash?
Anguine asked 28/7, 2009 at 15:23

33

Solved

I am trying to generate a random password in php. However I am getting all 'a's and the return type is of type array and I would like it to be a string. Any ideas on how to correct the code? Tha...
Brandeebranden asked 23/5, 2011 at 19:29

16

Solved

Suppose I have two arrays: a = [1, 2, 3, 4] b = [5, 6, 7, 8, 9] I want to interleave these two arrays to a variable 'c' (note 'a' and 'b' aren't necessarily of equal length) but I don't want the...
Corticosteroid asked 17/5, 2012 at 23:42

16

Solved

How do I generate random floats in C++? I thought I could take the integer rand and divide it by something, would that be adequate enough?
Auberge asked 26/3, 2009 at 15:49

4

Solved

first time here at Stackoverflow. I hope someone can help me with my search of an algorithm. I need to generate N random numbers in given Ranges that sum up to a given sum! For example: Generatar...
Kerk asked 9/11, 2013 at 14:23

14

I am VERY new to Python and I have to create a game that simulates flipping a coin and ask the user to enter the number of times that a coin should be tossed. Based on that response the program has...
Palaeontology asked 14/2, 2013 at 19:27

9

In a Bash script, I want to pick out N random lines from input file and output to another file. How can this be done?
Seften asked 12/2, 2012 at 1:27

23

Solved

I'd like to generate unique random numbers between 0 and 1000 that never repeat (i.e. 6 doesn't show up twice), but that doesn't resort to something like an O(N) search of previous values to do it....
Geny asked 12/10, 2008 at 20:34

11

Solved

I'm looking for some succinct, modern C# code to generate a random date between Jan 1 1995 and the current date. I'm thinking some solution that utilizes Enumerable.Range somehow may make this mor...
Colan asked 12/10, 2008 at 0:1

5

I would like to be able to generate random numbers with a probability density function that comes from a drawn curve. These two below have the same area under the curve but should produce lists of ...
Oleneolenka asked 15/1, 2017 at 4:3

© 2022 - 2024 — McMap. All rights reserved.