What's the shortest way to generate a random IP address in Ruby?
Just like the title says, wanted for testing purposes. Thanks! ...
Just like the title says, wanted for testing purposes. Thanks! ...
I can't figure out how to fetch n random rows from a criteria instance: Criteria criteria = session.createCriteria(Table.class); criteria.add(Restrictions.eq('fieldVariable', anyValue)); ... Then what? I can't find any doc with Criteria API Does it mean I should use HQL instead? Thanx! EDIT: I get the number of rows by: int max =...
hey everyone, I'm making a little quiz-style application but I've got a few issues. I random the questions from a NSMutableArray using arc4random(), then I populate the view with 3 buttons, one which includes a correct answer and the other 2 include two wrong answers what I need to do is to randomize the X coordinate (position) of the...
I already wrote a random generator which take arguments a and b, where a is minimun and b is maximum value, like this randomGenerator(int a, int b) What I want to do next is: Using a loop, then generate unique number from a to b. Example: I want to have 8 unique numbers, int a = 1; int b = 10; int value; If I do the loop, there is a ...
Hi, I am currently running JDK 6 on Windows 7 and have installed the Unlimited Strength Policy Files. I wrote a Java app some time ago which used to work but now fails, giving an error message indicating that the SHA1PRNG SecureRandom is not available. I have tried printing a list of cryptographic providers available on the platform and ...
I want the Random to return the same values each time. So I tried giving it a const seed. But it still returns random values. How can I stop this? EDIT: I use the same Random object all over my code, The first time I tested my program I got the following values from the random: 13, 9, 10, 12, 14, 11, 15, 10, 8, 6, 12, 9, 7, 7, 6, 1, 0,...
private final int NUM_SOUND_FILES = 4; private Random rnd = new Random(4); private int mfile[] = new mfile[NUM_SOUND_FILES]; //the second mfile //reports error everytime mfile[0] = R.raw.sound1; mfile[1] = R.raw.sound2; mfile[2] = R.raw.sound3; mfile[3] = R.raw.sound4; int s...
when I add a picture I want it to create a new random name because if you add a picture with the same name it will just overwrite ...
How can one generate say 1000 random points with a distribution like that of towns and cities in e.g. Ohio ? I'm afraid I can't define "distributed like cities" precisely; uniformly distributed centres + small Gaussian clouds are easy but ad hoc. Added: There must be a family of 2d distributions with a clustering parameter that can be va...
I get this error when trying to take an integer and prepend "b" to it, converting it into a string: File "program.py", line 19, in getname name = "b" + num TypeError: Can't convert 'int' object to str implicitly That's related to this function: num = random.randint(1,25) name = "b" + num ...
Is there a way to generate random letters in Python (like random.randint but for letters)? The range functionality of random.randint would be nice but having a generator that just outputs a random letter would be better than nothing. ...
Having troubles finding a good way to get a string from a text file (separated by line breaks) randomly. I want to do a setStringValue:@"random string from file here"; pretty much. Thanks in advance. ...
Hello, So not to reinvent the wheel, I would like to know what has already been done about generating random statements from a context-free language (like those produced by yacc, etc.). These grammars are primarily for parsing, but maybe someone has done some generation for testing the parsers? Thanks ...
I'd like to use the 'include' keyword in php to randomly select a file from a folder and output the contents. How would I do this? Thanks. ...
What is the correct way of generating random numbers in an ASP.NET MVC application if I need exactly one number per request? According to MSDN, in order to get randomness of sufficient quality, it is necessary to generate multiple numbers using a single System.Random object, created once. Since a new instance of a controller class is cre...
I write a piece of software that runs inside banner ads which generates millions of session IDs every day. For a long time I've known that the random number generator in Flash is't random enough to generate sufficiently unique IDs, so I've employed a number of tricks to get even more random numbers. However, in ActionScript 2.0 it's not ...
How do I randomly add buttons to a Tkinter GUI? I need it to be able to create a button, then put it anywhere on the window, is this possible? I am using Python 2.6 on Windows. ...
I know how to generate a random number between 0 and 1 using the NextDouble method of the pseudo-random number generator. var rng1 = new System.Random(); var random1 = rng1.NextDouble(); // generates a random double between 0 and 1.0 And I know how to fill a random byte array using the cryptographically secure random number generator....
Hello people. I'd like to know if the absence of element ordering of the Python's built-in set structure is "random enough". For instance, taking the iterator of a set, can it be considered a shuffled view of its elements? (If it matters, I'm running Python 2.6.5 on a Windows host.) ...
I've got a large set of captured data (potentially hundreds of thousands of records), and I need to be able to break it down so I can both classify it and also produce "typical" data myself. Let me explain further... If I have the following strings of data: 132T339G1P112S 164T897F5A498S 144T989B9B223T 155T928X9Z554T ... you might sta...