あなたの質問はひどく不適切です。ブラウン運動を適切に実装するには、コーディングに着手する前に、問題領域の非常に洗練された仕様と分析が必要であるとインストラクターが指摘したはずなので、これはほとんど間違いなくあなたのせいではありません。
ブラウン運動の正確な定義は、測定理論の関連コースを受講していない限り、おそらくわかりにくいでしょう。ただし、ネット上には、伊藤プロセス (ブラウン運動がその例です) について適切に説明しているリソースがたくさんあります。
このようなプロセスをコーディングすることに興味がある場合は、ここに適切なヒントがあります。ある段階で、乱数を生成する必要があります。ほぼ確実に、正規分布からドローを生成することに興味を持つでしょう。ありがたいことに、C++ プログラマーが利用できる、これを行う優れた方法がいくつかあります。私のお気に入りは、Boost.Random ライブラリ (または C++11 の関連ライブラリ) を使用することです。最も賢明な戦略は、おそらく variate_generator を使用して、関数オブジェクトを使用して確率変量を生成することです。
#include <iostream>
#include <vector>
using namespace std;
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/normal_distribution.hpp>
#include <boost/random/variate_generator.hpp>
int main()
{
// Some typedefs to help keep the code clean
// Always a good idea when using Boost!
typedef boost::mt19937 T_base_prng;
typedef boost::normal_distribution<> T_norm_varg;
typedef boost::variate_generator<T_base_prng&, T_norm_dist> T_norm_varg;
unsigned int base_seed = 42; // Seed for the base pseudo-random number generator
double mean = 0.0; // Mean of the normal distribution
double stdev = 1.0; // Standard deviation of the normal distribution
T_base_prng base_prng(base_seed); // Base PRNG
T_norm_dist norm_dist(mean, stdev); // Normal distribution
T_norm_varg norm_varg(base_prng, norm_dist); // Variate generator
// Generate 1000 draws from a standard normal distribution
vector<double> drawVec(1000);
for (vector<double>::iterator iter = drawVec.begin();
iter != drawVec.end(); ++iter)
{
*iter = norm_varg();
}
// More stuff...
return 0;
}
ブラウン運動が何であるかを理解したら、Boost.Random の機能を使用していくつかの例を作成するのは簡単です。