Questions tagged as 'random'

4
answers

Get random element from a ListT

I have List<int> numeros Is it possible to return a random element from this list?     
asked by 09.07.2014 / 16:12
3
answers

Generate random numbers in an Array of 10 up to 50

How can I generate an array of random numbers with a limit, must be numbers from 10 to 50. To generate random numbers from 0 to 50 I use: Random random = new Random(); int array[] = new int[5]; // 5 números serão ger...
asked by 25.08.2015 / 16:58
3
answers

Random numbers are always the same

Why is this code always displaying the same random number results as a given? // Figura 6.9: fig06_09.cpp // Lança um dado de seis lados 6.000.000 de vezes. #include <iostream> using std::cout; using std::endl; #include <iomanip>...
asked by 29.08.2017 / 16:44
1
answer

Select rows randomly

I'm developing a very complex system, where in some cases I need to select only a few fields, a friend who has more experience in the area gave me some tips, but he did not explain why. I have the following query that searches all users in r...
asked by 07.12.2017 / 03:56
1
answer

Error while using random

I set a random number to fill a dummy table and did so: foreach (var usuario in LstUsuarios) { htmlUsuarios.AppendLine("<tr>"); htmlUsuarios.AppendLine("<td>" + usuario.Nome + "</td>"); htmlUsu...
asked by 30.05.2014 / 16:18
1
answer

Random always returning the same number

I have a method whose function is to return 25 random numbers in a list: static List<int> criarList() { List<int> lista = new List<int>(); for (int i = 0; i < 25; i++) { lista.Add(new Random().Next(0, 1...
asked by 28.10.2017 / 21:06
7
answers

Randomize results with PHP

I have a structure like this (which I created): <div class="banners"> <?php echo do_shortcode("meubanner_1")?> <?php echo do_shortcode("meubanner_2")?> <?php echo do_shortcode("meubanner_3")?> </div>...
asked by 02.09.2014 / 15:18
2
answers

MySQL BD random record preventing consecutive equal records

I have a database where I want to get a random record. I can do this perfectly with: $query = "SELECT * FROM 'mytable' ORDER BY RAND() The problem is that the database contains the order of entry of the records of the jockeys in the competit...
asked by 27.02.2015 / 05:04
2
answers

How to make a random query in MySQL without repeating data?

I'm creating a Pinterest-type image-type site that, in addition to other things, needs to combine the following features: Infinite Scrool (I'm applying this code here: link ). A menu to choose in which order to display the images....
asked by 04.09.2018 / 03:16
4
answers

Generate random random string in PHP

How to use the PHP language to generate a string, preferably with configurable size, random enough to be used in routines that handle encryption and that for security reasons can not be not too random? If you propose more than one solutio...
asked by 15.02.2014 / 20:20