Questions tagged as 'random'

2
answers

How to Randomize an Array in C ++

There is a lot of stuff here about array ordering methods (quicksort, bubblesort, etc.), but I was wondering if there is a method of "cluttering" arrays, that is, shuffling the array elements. > * There are even questions here on this topic, b...
asked by 15.05.2018 / 00:05
1
answer

Print pre-defined phrases, randomly in C

Hello, I'm a beginner in programming and am learning to program in C. I want to make a program that has some already defined phrases. Ex with vectors: char vet1[100] = {"Hello World!"}; char vet2[100] = {"segunda frase"}; ... and wit...
asked by 05.06.2017 / 15:25
1
answer

Is it possible to generate a random number between two numbers in Java? [duplicate]

How do you generate a random number in the specified java between min and max? Because with the nextInt function of the Random class you can only specify the max.     
asked by 30.09.2016 / 00:37
2
answers

Pass random values to Matrix

I have a matrix with 30 fixed values, I wanted to know how to generate these same 30 values, however random, if possible with value limit between (2400, 400). How the array is currently: private int[][] coordenadas = { { 238...
asked by 20.10.2015 / 13:49
2
answers

Get random value mysql

I would like to know some way to get some random value from MySQL without repeating, I am using this line: $query = mysql_query("SELECT * FROM users ORDER BY RAND()");     
asked by 28.10.2015 / 21:10
1
answer

Generate a random combination on each line

I did a number generator that looked like this: import random import math for i in range(10): c1 = (random.choice([1, 2, 3, 4, 5, 6, 7, 8, 9])) c2 = (random.choice([1, 2, 3, 4, 5, 6, 7, 8, 9])) c3 = (random.choice([1, 2, 3, 4, 5,...
asked by 17.11.2018 / 14:22
1
answer

How to generate random numbers but with some restrictions in python?

import random v=[1,7,15] x=random.choice(v) How do I generate more "1" numbers than "15"? In 10000 times, choose 1 number and at the end: Number 1 should have gone approximately 40%. Number 7 must have gone approximately 30%. Number 1...
asked by 02.01.2019 / 13:05
2
answers

Make a random of a dataset with pandas

I'm trying to extract 15O lines from a 500-line dataset. So I would like to do it at random. My Data objeto,cor,label cachorro,branco,animal manga,laranja,fruta calça,preta,roupa My script import pandas import pandas as pd df = pd...
asked by 23.08.2018 / 23:12
3
answers

How to Generate random numbers without repetition in Random? [duplicate]

So far I have been able to generate the random numbers and store them, but I have no idea how not to generate repetition. So far, it looks like this: package curso1; import java.util.Random; public class Curso7 { public static void mai...
asked by 04.05.2018 / 05:53
1
answer

How to invoke countdown timer with each click on the button?

I want to develop something simple, but that's making me frustrated. I will try to express myself in the best way possible. To make things simpler here, I'm just bringing as a example a randomized Photo Gallery, which, by clicking on the "...
asked by 21.03.2017 / 23:16