Click here to Skip to main content
15,887,596 members
Articles / Programming Languages / C++

A Normal / Exponential Random Generator and Histogram Class

Rate me:
Please Sign up or sign in to vote.
4.73/5 (11 votes)
2 Dec 20024 min read 276.4K   8.1K   55  
A fast random generator with normal or exponential distribution + a histogram class
In this article, you will find a fast generator for Random Variable, namely normal and exponential distributions. It is based on George Marsaglia's and Wai Wan Tsang's work.
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by C:\Documents and Settings\jdehalle\My Documents\Projects\pglmfclib\PGL\PGL.rc
//
#define IDD_PGL_PROPPAGE_MAP_VECTORFIELD 106
#define IDB_PGL_BITMAP_MAP_GRID         130
#define IDR_PGL_MENU_VIEW               135
#define IDC_PGL_BUTTON_CHANGE_COLOR     1000
#define IDC_PGL_CHECK_SELECTED          1001
#define IDC_PGL_CHECK_VISIBLE           1002
#define IDC_PGL_EDIT_NAME               1003
#define IDC_PGL_EDIT_ALPHA              1006
#define IDC_PGL_EDIT_LINE_WIDTH         1007
#define IDC_PGL_RADIO_LINE_CONT         1008
#define IDC_PGL_RADIO_LINE_BARBAR       1009
#define IDC_PGL_RADIO_LINE_BARPOINT     1010
#define IDC_PGL_RADIO_LINE_NONE         1011
#define IDC_PGL_RADIO_INTERPOLATION_LINEAR 1012
#define IDC_PGL_RADIO_INTERPOLATION_NURBS 1013
#define IDC_PGL_EDIT_POINT_WIDTH        1014
#define IDC_PGL_RADIO_POINT_NONE        1015
#define IDC_PGL_RADIO_POINT_SIMPLE      1016
#define IDC_PGL_RADIO_POINT_CONTOUR     1017
#define IDC_PGL_RADIO_POINT_TRIANGLE    1018
#define IDC_PGL_RADIO_POINT_SQUARE      1019
#define IDC_PGL_RADIO_LINE_POINTPOINT   1020
#define IDC_PGL_RADIO_INTERPOLATION_STEP 1021
#define IDC_PGL_EDIT_NPOINTS            1035
#define IDC_PGL_EDIT_NY                 1036
#define IDC_PGL_EDIT_NX                 1037
#define IDC_PGL_COMBO_COLORMAP          1038
#define IDC_PGL_EDIT_DX                 1038
#define IDC_PGL_EDIT_DY                 1039
#define IDC_PGL_BUTTON_CHOOSE_FONT      1040
#define IDC_PGL_EDIT_NXTIMSNY           1040
#define IDC_PGL_EDIT_STRIN_TEXT         1041
#define IDC_PGL_CHECK_START_ARROW_SHOW  1042
#define IDC_PGL_EDIT_START_ARROW_THICK  1043
#define IDC_PGL_EDIT_LEFT               1043
#define IDC_PGL_STATIC                  1044
#define IDC_PGL_EDIT_START_ARROW_LENGTH 1044
#define IDC_PGL_EDIT_TOP                1044
#define IDC_PGL_TOP_LABEL_CHECK         1045
#define IDC_PGL_EDIT_TOP_LABEL          1046
#define IDC_PGL_BOTTOM_LABEL_CHECK      1047
#define IDC_PGL_CHECK_END_ARROW_SHOW    1048
#define IDC_PGL_EDIT_BOTTOM_LABEL       1048
#define IDC_PGL_EDIT_END_ARROW_THICK    1049
#define IDC_PGL_HORGRID_CHECK           1049
#define IDC_PGL_EDIT_END_ARROW_LENGTH   1050
#define IDC_PGL_VERTGRID_CHECK          1050
#define IDC_PGL_XNUMBER_CHECK           1051
#define IDC_PGL_YNUMBER_CHECK           1052
#define IDC_PGL_XNUMBER_EDIT            1053
#define IDC_PGL_YNUMBER_EDIT            1054
#define IDC_PGL_OBJECTTREE              1054
#define IDC_PGL_LEFT_LABEL_CHECK        1055
#define IDC_PGL_STATIC_PROPSHEET        1056
#define IDC_PGL_EDIT_LEFT_LABEL         1056
#define IDC_PGL_BUTTON_CLOSE            1057
#define IDC_PGL_RIGHT_LABEL_CHECK       1057
#define IDC_PGL_EDIT_NBPORIG            1058
#define IDC_PGL_EDIT_RIGHT_LABEL        1058
#define IDC_PGL_EDIT_NBPAPPROX          1059
#define IDC_PGL_EDIT_TOL                1060
#define IDC_PGL_CHECK_PREVIEW           1062
#define IDC_PGL_RADIO_LEFT              1064
#define IDC_PGL_RADIO_CENTER            1065
#define IDC_PGL_RADIO_RIGHT             1066
#define IDC_PGL_EDIT_ANGLE              1067
#define IDC_PGL_CHECK_LOGX              1068
#define ID_STATIC                       1069
#define IDC_PGL_CHECK_LOGY              1069
#define IDC_PGL_EDIT_LINEWIDTH          1070
#define IDC_PGL_CHECK_FILL              1071
#define IDC_PGL_CHECK_NUMBER_TOP        1076
#define IDC_PGL_CHECK_NUMBER_BOTTOM     1077
#define IDC_PGL_CHECK_NUMBER_LEFT       1078
#define IDC_PGL_CHECK_NUMBER_RIGHT      1079
#define IDC_PGL_SLIDER_NUMBER_TOP       1080
#define IDC_PGL_SLIDER_NUMBER_BOTTOM    1081
#define IDC_PGL_SLIDER_NUMBER_LEFT      1082
#define IDC_PGL_SLIDER_NUMBER_RIGHT     1083
#define IDC_PGL_CHECK_TIME_LABEL        1084
#define IDC_PGL_DATETIMEPICKER_TIMEORIGIN 1085
#define IDC_PGL_EDIT_TIMESTEP_DAYS      1087
#define IDC_PGL_DATETIMEPICKER_TIMESTEP_HOURS 1090
#define IDC_PGL_DATETIMEPICKER_TIMEORIGIN_HOUR 1091
#define IDC_EDIT_STRIP_SIZE             1093
#define IDC_PGL_EDIT_TIMEFORMAT         1094
#define IDD_PGL_PROPPAGE_COBJECT        2000
#define IDD_PGL_PROPPAGE_LINE           2001
#define IDD_PGL_PROPPAGE_LINE2DLOD      2002
#define IDD_PGL_PROPPAGE_TEXT           2003
#define IDD_PGL_DIALOG_GRAPH            2004
#define IDR_PGL_MENU_GRAPHDLG           2005
#define IDD_PGL_JPEG_PROP               2006
#define IDC_PGL_EDIT_JPEG_PROP          2007
#define IDD_PGL_PROPPAGE_MAP            2008
#define IDD_PGL_PROPPAGE_MAP_Z          2009
#define IDD_PGL_PROPPAGE_AXE2D          2010
#define IDD_PGL_ALL_PROPS_DIALOG        2011
#define IDB_PGL_LINE2D_BITMAP           2012
#define IDD_PGL_PROPPAGE_LINE2D         2012
#define IDB_PGL_MAPZ_BITMAP             2013
#define IDD_PGL_PROPPAGE_REGION         2013
#define IDB_PGL_MAPVECTOR_BITMAP        2014
#define IDB_PGL_AXE2D_BITMAP            2015
#define IDB_PGL_OBJMG_BITMAP            2016
#define IDB_PGL_GRAPH_BITMAP            2017
#define IDB_PGL_TEXT_BITMAP             2018
#define IDB_PGL_SELECT_BITMAP           2019
#define IDB_PGL_LINE2DLOD_BITMAP        2020
#define IDB_PGL_REGION_BITMAP           2021
#define VS_PGL_VERSION_INFO             10001
#define ID_PGL_SELECTION_SELECTALL      32775
#define ID_PGL_SELECTION_UNSELECT       32776
#define ID_PGL_SELECTION_HIDESELECTION  32777
#define ID_PGL_SELECTION_UNHIDEALL      32778
#define ID_PGL_FIGURE_EXPORTTOJPEG      32781
#define ID_PGL_FIGURE_OPEN              32784
#define ID_PGL_FIGURE_SAVEAS            32785
#define ID_PGL_VIEW_PROPERTIES          32786
#define ID_PGL_VIEW_ZOOM                32787
#define ID_PGL_VIEW_PAN                 32788
#define ID_PGL_AXE_PROPERTIES           32789
#define ID_PGL_SELECTION_ORDER_TOFRONT  32791
#define ID_PGL_SELECTION_ORDER_TOBACK   32792
#define ID_PGL_SELECTION_ORDER_MOVEUP   32793
#define ID_PGL_SELECTION_ORDER_MOVEDOWN 32794
#define ID_PGL_TOOLS_SELECT             32798
#define ID_PGL_TOOLS_ADDTEXT            32799
#define ID_PGL_VIEW_ZOOMALL             32800
#define ID_PGL_EDIT_DELETE              32801
#define ID_PGL_EDIT_COPY                -32734
#define ID_PGL_EDIT_PASTE               -32733
#define ID_PGL_EDIT_CUT                 -32732
#define ID_PGL_FIGURE_EXPORTTOEPS       32805
#define ID_VIEW_SELECT                  32809
#define ID_PGL_VIEW_SELECT              32810
#define ID_PGL_EDIT_COPYTOCLIPBOARD     32811
#define ID_PGL_OBJECTS_EXPLORER         32812
#define ID_PGL_FILE_EXPORT              32813
#define ID_PGL_VIEW_ZOOMIN              32815
#define ID_PGL_VIEW_ZOOMOUT             32816
#define ID_PGL_VIEW_ZOOMBOX             32817

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS                     1
#define _APS_NEXT_RESOURCE_VALUE        136
#define _APS_NEXT_COMMAND_VALUE         32819
#define _APS_NEXT_CONTROL_VALUE         1095
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


Written By
Engineer
United States United States
Jonathan de Halleux is Civil Engineer in Applied Mathematics. He finished his PhD in 2004 in the rainy country of Belgium. After 2 years in the Common Language Runtime (i.e. .net), he is now working at Microsoft Research on Pex (http://research.microsoft.com/pex).

Comments and Discussions