' Central limit theorem
' using Vbsedit's free Toolkit
' rolling a large number of identical, unbiased dice
' https://en.wikipedia.org/wiki/Central_limit_theorem

Randomize 

Set pivot = CreateObject("Vbsedit.PivotTable")
pivot.Initialize 2,1
pivot.SetColumnNames "Sum","n","Number of events"


total=100000

For n=2 To 7
  WScript.Echo n
  For k=1 To total
    s=0
    For i=1 To n
      s = s + Int(6 * Rnd + 1)
    Next
      
    pivot.Add s,n,1
   
  Next
Next


pivot.Finalize


folder=Left( WScript.ScriptFullName, InStrRev( WScript.ScriptFullName,"\"))

pivot.LoadChartTemplate "column"
pivot.ReplaceTag "title","Central limit theorem"
pivot.ReplaceTag "bars","vertical"
pivot.ReplaceTag "stacked","false"
pivot.SaveChart folder & "column1.htm"

Set shell = CreateObject("Wscript.Shell")
shell.Run folder & "column1.htm",1,False


search for scripts

VbsEdit contains all these sample scripts!


Download Now!



Download   Home   Scripts

Copyright © 2001-2024 adersοft