|
What is the best method of generating a number with 256 random bits?
Does concatenating random bytes work?
byte[] data = new byte[32]; RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); rng.GetNonZeroBytes(data); // should include zero bytes...
Answer Snippets (Read the full thread at stackoverflow):
If the random byte generator is good, any method works concatenate random bytes....
EDIT: Not sure why you would need 256 bits to shuffle are equally likely, assuming use of a good RNG .
Yes, concatenating random bytes would work.
|
|
Like my question, i need to generate random numbers that have identical pairs between a range. i have tried to generate random numbers and stored in an array but the numbers are repeating more than twice. i have 16 random numbers to be generated in the...
Answer Snippets (Read the full thread at stackoverflow):
New ArrayList<Integer>(); Random randomizer = new Random(); for(int i = 0; i < 8; ) { int r.
|
|
Ok this is one of those trickier than it sounds questions so I'm turning to stack overflow because I can't think of a good answer. Here is what I want: I need Python to generate a simple a list of numbers from 0 to 1,000,000,000 in random order to be ...
Answer Snippets (Read the full thread at stackoverflow):
Examples
MySQL:
SELECT column FROM table ORDER BY RAND() LIMIT....
With some modular for a random unused number? Most databases support such a request.
And a seed like a timestamp + random number and it should do for almost any situation.
|
Ask your Facebook Friends
|
I'd like to generate uniformly distributed random integers over a given range. The interpreted language I'm using has a builtin fast random number generator that returns a floating point number in the range 0 (inclusive) to 1 (inclusive). Unfortunately...
Started by RobS on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
The resulting distribution of values will be identical to the distribution of the random numbers, so uniformity depends....
If the random number generator delivers a uniform distribution = highest + 1 .
I don't see why the + 1 is needed.
|
|
I was using the arc4random() function in order to generate a random group and sequence of numbers, but I was told that this was overkill and that I should use the random() function instead. However, the random() function gives me the same group and sequence...
Started by schwabrX on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
There is some additional uniformity gained by generating some amount of numbers and throwing them away, but unless you are looking for security level random number ....
No, you do not need to reseed the random number generator.
|
|
How I can generate a random new GUID inside of the Dephi IDE?
I am using Delphi 2007.
Started by Salvador on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
With enclosing square brackets - [] - , but once you've got the GUID in the text editor you can do ... .
It's formatted for use as an interface IID, i.e.
Just press Ctrl + Shift + G
Ctrl+Shift+G will place a new GUID at the current position in the editor .
|
|
How can I generate a random number within range 0 to n where n can be > RAND_MAX in c,c++?
Thanks.
Started by ebaccount on
, 10 posts
by 10 people.
Answer Snippets (Read the full thread at stackoverflow):
Generating random numbers is a solved problem in other librariesDo x random numbers (from 0 to RAND_MAX) and add them together, where
x = n % RAND_MAX
split at a decent random number library....
Complicated, inaccurate, or both.
|
|
I know how to generate a random number in PHP but lets say I want a random number between 1-10 but I want more 3,4,5's then 8,9,10's. How is this possible? I would post what I have tried but honestly, I don't even know where to start.
Started by kyct on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
For an efficient random number skewed consistently towards one end of the scale:
Choose a continuous ....
Pick a random number if it is.
Basically:
Sum the weights of all the numbers.
There's a pretty good tutorial for you.
From that.
|
|
Can you tell me any ways to generate non-uniform random numbers?
I am using Java but the code examples can be in whatever you want.
One way is to create a skewed distribution by adding two uniform random numbers together (i.e. rolling 2 dice).
Started by Robert Greiner on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
It includes classes for generating random numbers for Uniform, Gaussian, Poisson.
Try generating uniformly distributed random numbers, then applying your inverted non-uniform may be of interest.
|
|
I'm looking for tools for generating random but realistic text. I've implemented a Markov Chain text generator myself and while the results were promising, my attempts at improving them haven't yielded any great successes.
I'd be happy with tools that...
Started by Carl Summers on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Generating.
Extending your own Markov chain generator is probably your best bet, if you want "random" text.
|