# random

• ## How can I generate random variables with my own Probability Mass Function in MATLAB? 2018-09-04

This question already has an answer here: Weighted random numbers in MATLAB 4 answers I have to generate a random variable that ranges from 20 to 30, with 0.1 interval, and the pmf of it is given by 1x101 matrix (for x=20, 20.1, ... 29.9, 30). Now I

Tags: matlab, random
• ## Thread Breakpoint at an array assignment2018-08-05

im trying to make an array that is (n x n) large depending on what value you enter, and then populate that array with random integers. Could you guys please help me with two problems? Any values of n greater than 4 give "error at display" in the

Tags: arrays, random
• ## Random method for a quiz2018-07-10

Each method contain a question with multiple choice. When i call the method in the main, i need to shuffle it and make sure there are no repetition. public static void main(String[] args) { question_1(); question_2(); question_3(); question_4(); //co

Tags: java, arrays, random, methods
• ## What is causing my custom zsh script terminal command to hang?2018-06-11

I've created a custom zsh script for taking notes about my day and keeping track of time so I can fill out time sheets easier. It works fine most of the time but every now and again just hangs. It logs to the txt file even when it hangs but it doesn'

Tags: logging, arrays, random, time, zsh
• ## Ducky Script - Recurssive search2018-05-15

I'm creating a script for use with the Ducky USB stick from Hak5 for a college assessment. For anyone not familiar with Ducky, its a usb stick which runs a payload when you press the button on top of it. The script is meant to highlight the need for

Tags: random, recursion, dos
• ## Python My Random Numbers arent generating properly 2018-05-04

This question already has an answer here: Why does `a == b or c or d` always evaluate to True? [duplicate] 1 answer Heres the code diff = raw_input("Easy Medium or Hard: ") if diff == "Easy"or"easy"or"E"or"e&qu

Tags: python, random, python 2.7
• ## Split number in randomly-sized portions in Python2018-04-15

I have x = 10 and y = 100. Can I distribute y elements in randomly-sized portions among x 'element holders'? I want to create x categories each with a random number of items; however, the number of items created should be exactly y. I guess it's some

Tags: python, random, random sample
• ## Python: How to track "correct" answer in randomized multiple choice2018-03-23

I successfully built a function to prompt the user with a question, followed by randomly ordered answer choices. However, since the answer choices are now randomized, how will python recognize the user input (a number: 1, 2, 3, or 4) for the "correct

Tags: python, random, shuffle, python 2.7
• ## Random.nextBoolean() Always Returns True No Matter the Seed2017-11-21

When I run the following code, no matter what range I use for the for loop, the code always prints out true ten times. public static void main(String[] args) { Random bool = new Random(); for (int i = 0; i < 10; i++) { bool.setSeed(i); System.out.pri

Tags: loops, java, random, boolean
• ## How to create a Android random with an image2017-10-02

How do I generate a random with an image in android eclipse? I want to have an image randomly show up once one of the three buttons are clicked. So it's a guessing game and the user has to choose the correct button and keep going if its not that rand

Tags: java, random, eclipse, mobile, android
• ## Sampling in PostgreSQL2017-09-08

I am looking for possible ways of random sampling in PostgreSQL. I found a couple of methods to do that with different advantages and disadvantages. The naive way to do that is: select * from Table_Name order by random() limit 10; Another faster meth

Tags: random, postgresql, replace, sampling
• ## Random set of images using php2017-08-08

I have this code that I've been using to select one random image. Now I need to select four random images. I've tried to modify the code and it does work but I can't figure out a way to prevent the same images appearing twice. My knowledge of php is

Tags: php, random
• ## Random() constructor parameter2017-08-04

I am trying to understand the Random() constructor. I understand that if I have code like: Random rand = new Random(47); System.out.println(rand.nextInt(10)); Then rand.nextInt(10) will generate a random number between 0 and 9, but what does the 47 b

Tags: java, random, constructor, random seed
• ## how to generate inputs for benchmark programs when doing random testing2017-07-19

The benchmark programs used in papers about random testing usually takes numbers as input. It's easy to random generate numbers but the inputs of real-world programs are usually strings or files. How to generate complex inputs when doing random testi

Tags: testing, random
• ## How to properly align a 5x10 2-d array with random data in console?2017-05-18

First time poster here, but I have been using stackoverflow this entire quarter to help me along in my intro to C# class. Generally, I can find what I'm looking for if I look hard enough, but I have been unable to find anyone that has already answere

Tags: arrays, random
• ## Cakephp: record random once a day2016-11-28

how can I have random results that change only after 24 hours? \$random = \$this->Post->find('first',array( 'conditions' => array( 'Post.active'=>1, ), 'order' => 'rand()', )); \$this->view(\$random['Post']['id']); \$this->render('view');

Tags: random, cakephp
• ## Spawning a circle in a random spot on screen2016-11-25

I've been racking my brain and searching here and all over to try to find out how to generate a random position on screen to spawn a circle. I'm hoping someone here can help me because I'm completely stumped. Basically, I'm trying to create a shape t

Tags: random, ios, swift, arc4random
• ## Randomly choosing one outlet and setting others2016-11-18

I have a function that chooses a randomUIButton and sets its character to a certain emoji. I want to now set the remainingUIButtons to be random emojis. How would I determine whichUIButtons were not set from the random generator assigning one a value

• ## Generated 2D terrain with fixed seed across platforms2016-10-20

I'm using a 1D Perlin Noise to generate a 2D terrain for my game. I'm currently looking for the best method to generate terrain with a fixed seed that should look always the same across different platforms/hardware. Currently I'm using Mersenne Twist

Tags: random, cross platform, prng
• ## Generating a random number between a range with a weight/bias?2016-06-13

I am trying to generate a random number between 1 and a maximum. This I don't have a problem doing so and do so with the following: var max = 200; var randomNumber = Math.floor(Math.random() * max) + 1; However in an ideal situation I would like to g