Coming from the C++ world here, thus the nature of the question...
I want to use a single SecureRandom generator in a Java application, but I need several instances of a class to store a reference to it in the constructor, rather than copies.
So,
public class MyClass {
private SecureRandom random;
public MyClass(SecureRandom _...
Hey guys, i have trouble generating unique random numbers using js. Can someone lend me a hand?
...
I'm creating a bot in Shell Script:
# Array with expressions
expressions=("Ploink Poink" "I Need Oil" "Some Bytes are Missing!" "Poink Poink" "Piiiip Beeeep!!" "Hello" "Whoops! I'm out of memmory!")
# Seed random generator
RANDOM=$$$(date +%s)
# Loop loop loop loop loop loop ...
while [ 1 ]
do
# Get random expression...
select...
I have a case where I need to select a random item, but I don't know the total number of items and I don't want to build a huge array then pick an item out. For example, this is what I have right now:
List<string> items;
while (true)
{
string item = GetNextItem();
if (item == null)
break;
}
int index = random.GetNext(0, ...
I need to run a MonteCarlo simulations in parallel on different machines. The code is in c++, but the program is set up and launched with a python script that set a lot of things, in particular the random seed. The function setseed thake a 4 bytes unsigned integer
Using a simple
import time
setseed(int(time.time()))
is not very good ...
I'm sick of waiting for my developers to fix this, so I decided to ask you guys. I'm trying to modify what they've already given me, so sorry if the setup doesn't make a whole lot of sense. I could probably change it but want to keep as much of the existing table setup as possible.
I've got a MySQL table with a bunch of entries in it, a...
Hello!
I am taking a course on programming, and we're using C++.
We had an assignment where, at some point, we needed to code a function that would return a random number in an [upper, lower] interval. I used the following:
lower + (int) (upper * (rand() / (RAND_MAX + 1.0)));
I did not forget to change srand by using srand((unsigned ...
I'm creating a game where players can make an alloy. To make it less predictable and more interesting, I thought that the durability and hardness of an alloy should not be calculated by a simple formula, because it will be extremely easy to find extrema, where alloy have best statistics.
So the questions is, is there any formula for a f...
Ok right , i asked how to create a random number from 1-100 for android and i came to this
TextView tv = new TextView(this);
int random = (int)Math.ceil(Math.random()*101);
tv.setText("Your Number Is..."+ random );
What this does is create the default kinda "hello world" style text view and says "Your Number Is.... [Th...
Dear All:
I need to generate a series of N random binary variables with a given correlation function. Let x = {xi} be a series of binary variables (taking the value 0 or 1, i running from 1 to N). The marginal probability is given Pr(xi = 1) = p, and the variables should be correlated in the following way:
Corr[ xi xj ] = const |ij| (...
hi everybody
Is there any possible code for getting output in php(all possible word from word dictionary)
for example....for word "werflo"
flower
fowler
reflow
wolfer
...
Is it possible to print a random number in C++ from a set of numbers with ONE SINGLE statement?
let's say the set is 2, 5, 22, 55, 332
i looked up rand, but I double it's possible to do in a single statement
...
Hi, I want to generate some test data so for each row in a table I want to insert 10 random rows in another, see below:
INSERT INTO CarFeatures
(carID, featureID)
SELECT C.ID, F.ID
FROM dbo.Cars AS C
OUTER APPLY (
SELECT TOP 10 ID
FROM dbo.Features
ORDER BY NEWID()
) AS F
Only trouble is this returns the same value...
I work with a lot of random numbers to create constantly shifting textures. I'm getting tired of doing things like:
((rand() % 1000) / 10) + 100
when I really want something like
[randomUtils randomNumberBetween:100 and:200]
Additonally, I'd like to be able to manipulate weights of the randomization, so that, for example, my val...
srand(time(NULL));
for(i = 0; i < n; i++){
for(j = 0; j < (n-1); j++){
a[i][j] = rand();
}
}
I try to generate random numbers, but they are the same...
What should i do?
Array declaration:
int** a;
int i;
printf("Enter array size: ");
scanf("%d", &n);
a = (int**)calloc(n, sizeof(...
I understand how standard random number generators work. But when working with crytpography, the random numbers really have to be random.
I know there are instruments that read cosmic white noise to help generate secure hashes, but your standard PC doesn't have this.
How does a cryptographically secure random number generator get it...
Hello i have a question on picking random entries from a database. I have 4 tables, products, bids and autobids, and users.
Products
-------
id 20,21,22,23,24(prime_key)
price...........
etc...........
users
-------
id(prim_key)
name user1,user2,user3
etc
bids
-------
product_id
user_id
created
autobids
--------
u...
I'm trying to take the output of arc4sin and put it into a label.
(EDIT: You can ignore this and just post sample code, if this is too irrelevant.)
I've tried:
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
NSString *number = [[NSString...
i want to create a quiz application. the questions should be randomly selected from a word/text file(which contains some 20 questions). the application is in c#. syntax plz...
...
I would like to randomly iterate through a range. Each value will be visited only once and all values will eventually be visited. For example:
class Array
def shuffle
ret = dup
j = length
i = 0
while j > 1
r = i + rand(j)
ret[i], ret[r] = ret[r], ret[i]
i += 1
...