9 Topics

Member Avatar for
Member Avatar for adrianrayce

Hello everyone, so i am basically new to C++ coding and i am trying to write the randNum function in a way that it will give me these ranges The range for this row is: 1 to 10: 5 4 10 2 7 9 1 8 9 6 The range …

Member Avatar for Avishek_1
0
314
Member Avatar for nishad_forums

Hi, I have googled but found nothing about this. I am trying to generate a random number from a given array. But how do i do it? **Suppose:** I have an array `int arr[]={3,89,99,4,55};` and i want to generate a random number among these numbers. thanks in advance.

Member Avatar for nishad_forums
0
309
Member Avatar for ineedsomehelp:3

Ok, I need to make a program that randomly generates 4 random letters from 12 random letter and it cannot reapeat the same letter. for example you can only pick from a,b,c,d,e,f,g,h,i,j,k,l and the program can randomly generate a,b,c,d or b,c,d,e but should not generate a,a,b,b or something that repeats.Another …

Member Avatar for ineedsomehelp:3
0
378
Member Avatar for jackmaverick1

Hi, I've been looking for a while for things that would give me random numbers under a value that I can specify (for me it's 5). I've seen [ICODE]rand();[/ICODE] and [ICODE]srand();[/ICODE]. I also know that[ICODE]srand()[/ICODE] is the seed and [ICODE]rand()[/ICODE] is the random number itself. Even the example programs don't …

Member Avatar for pseudorandom21
0
337
Member Avatar for VP2

Hello! I've got a little problem... I want to make a program which puts 10 random character, but the characters should NOT be digits. [CODE]#include <ctime> #include <stdio> #include <iostream> using namespace std; int main() { time_t t; time(&t); srand(t); int i,c; char ch; printf("Generating 10 random characters...\n"); for(i=1;i<=10;i++) { …

Member Avatar for WaltP
0
150
Member Avatar for crapgarden

[B]QUESTION 1[/B] In this line of code, I get that it's using the date/time to seed the code for a more random number each time, I'm just wondering what the < > operators are doing? [CODE]srand(static_cast<unsigned int>(time(0))); [/CODE] I realize, they're making time into an unsigned int, but why not …

Member Avatar for pseudorandom21
0
449
Member Avatar for skorm909

Basically what I'm trying to do is simple. My main problem is the random numbers, but in the comments i have some other issues... if you know how to fix them that would be great the other two main ones im having trouble with are: the do loop until the …

Member Avatar for jonsca
0
143
Member Avatar for naseerhaider

Hello Every one ! This program is producing some strange output as it is only generating x = 6 :(,can some through some light that why is it behaving like this ? [code] #include <iostream> #include <stdlib.h> using namespace std ; main () { // Random Number Program int num,x …

Member Avatar for naseerhaider
0
163
Member Avatar for corby

hey does anyone know if i am using the srand() fucntion correctly to randomly choose if a persons letter is X or O? [CODE]#include <iostream> #include <cstdlib> using namespace std; int main() { srand(time(0)); int playerTurn = rand() % 2; char initPname; if (playerTurn == 1) { initPname= 'X'; playerTurn++; …

Member Avatar for corby
0
136

The End.