Questions tagged as 'random'

1
answer

Error when using Random in JAVA

When I run this code: public class main { static boolean terminar = false; public static void main(String[] args) { long init = System.currentTimeMillis(); BruteForce(true, true, "a123", 10, 10000); lo...
asked by 07.07.2015 / 06:24
1
answer

Why does ORDER BY RAND () leave the query slow? Is there another alternative?

I had just asked questions about ordering random values through MYSQL . From there I began to notice an uncomfortable slowness in the system of friendships suggested here by the company. I use Laravel 3 . I went to do a check o...
asked by 17.09.2015 / 15:57
2
answers

Optimization, quickness in select, and PHP code

Following the reasoning of this question , I did this method, where I select multiple users from once to return only 1 in random order, that is, my query that is in the function makes a sweep in the whole table to return only one result, this i...
asked by 08.12.2017 / 20:38
1
answer

Random value in C ++

I was practicing a bit of C ++, I created that simple data-set exercise, so I came across a problem, how can I generate random values in C and C ++? Taking a look at the site ( c plus plus ) found an example using time as seed (seed), the p...
asked by 12.03.2017 / 07:15
1
answer

How to randomly shuffle an Array in Ruby?

I'd like to have the items in an array shuffled. Something like this: [1,2,3,4].scramble => [2,1,3,4] [1,2,3,4].scramble => [3,1,2,4] [1,2,3,4].scramble => [4,2,3,1] and so on, randomly. How to do?     
asked by 10.08.2014 / 04:28
2
answers

Random distribution in lists with python

I have a list: li = [0, 0, 2313, 1221, 0, 1333, 66, 0, 0, 0, 0] and another list of lists, where: The list of lists is called disciplines (below). The lists that are within disciplines, are specified below also: #essas são as listas...
asked by 19.06.2016 / 04:28
1
answer

Do not repeat letters (char) in an ASCII array

You had to create a 5x5 array by printing random characters from the ASCII table. public class ExercicioClass01g { static Scanner ler = new Scanner(System.in); public static char mat[][] = new char[5][5]; public static void gera(...
asked by 29.05.2016 / 01:09
1
answer

Randomizing images as textures in 3D solids

Well, I have 30 solids and I have a different image for each of them. I created an array for the images, and if I choose to use the same image at all (as I left here in the code, use bandeira [0] ) it runs and everything is fine! I now...
asked by 15.06.2016 / 23:03
1
answer

How to get really random numbers with 'rand ()' in C?

For school work, I need to create a game, for which I need to generate a random number to make it fair. In one case, as I'll post below, I need to designate a random number between 0 and 2 to modify in the string: int NUM, AUX; char PORTAS [0]...
asked by 21.11.2015 / 20:20
1
answer

Random site theme with change every 30 minutes

I need my site to change the theme randomly every 30 min. So the logic would be: User enters the site now and sees it in blue (which is standard), but if this same user comes back in 30 minutes he should see the site in one of the other two O...
asked by 31.08.2015 / 01:59