1. ## mathematical random distribution

I'm looking for an example about constructing data to be random (I know about the rand() function) but the data should be distributed in different ways (evenly, accelerating)- thanks for helping...and excuse my english

2. your english is fine : )

Hope this helps, i rlly don't kno much bout randomness:

Code:
/*

// Name: Code Example - generating random numbers

// Description:Today in class we went over a few different concepts. I wrote my own

examples of these C++ concepts.

// By: Jared Bruni

//

//

// Inputs:None

//

// Returns:None

//

//Assumes:None

//

//Side Effects:None

//This code is copyrighted and has limited warranties.

*/

/* random number example

written by Jared Bruni

*/

#include<iostream>

#include<time.h>

using namespace std;

int main()

{

srand(time(NULL)); // seed randomization

// now generate and display 10 random numbers 0-10

for(int i = 0; i < 500; i++)

{

cout << "random number: " << rand()%10 << endl;

}

return system("pause");

}

3. This is a simple function that gives good distribution:
Code:
int nrand ( int n )
{
if ( n <= 0 || n > RAND_MAX )
throw domain_error ( "Argument to nrand is out of range" );

const int bucket_size = RAND_MAX / n;
int r;

do {
r = rand() / bucket_size;
} while ( r >= n );

return r;
}
-Prelude