title: Filling array on GPU
body: <p>I want to fill my array on GPU. Order to do that i wrote generateVetor function</p>
  
  <pre><code>int rand_from_0_to_100_gen(void) {
      return rand() % 100;
  }
  
  __device__ void generateVector(int * hData,int count) {
  
      for (int i = 0; i &lt; count; i++) {
          hData[i] = rand_from_0_to_100_gen();
      }
  }
  </code></pre>
  
  <p>In main i dynamically allocate memory for the array A</p>
  
  <pre><code>int *A = NULL;
  err = cudaMalloc((void **) &amp;A, numOfData);
  
  generateVector(A,numOfData);
  </code></pre>
  
  <p>But function gives the error that: Calling a <strong>host</strong> function from <strong>device</strong> is not allowed. Why? What i get this error? </p>