我使用一个VB ActiveX控件,其中许多函数返回值为Variant类型。比如: X:=CWDSP1.Uniform(n,seed);//该函数产生一个随即数数组。但我得到的X全部为0。以下是它的原始声明和帮助:
/////////////////////////////////////////////////////Syntax
CWDSP.Uniform ( n, Seed)Return Type
VariantPurpose
Generates an array of h random numbers that are uniformly distributed between zero and one.ResWhen Seed ≥ 0, a new random sequence is generated using the seed value. So, if the seed value stays the same, the generated sequence stays the same. When Seed < 0, the previously generated random sequence continues. So even with the same seed, the generated sequence changes every time you call this function.Parameters
n As Variant[Input] Number of samples.Seed As Variant[Input] Seed value.Example
Sub Uniform_Example()
'The following code generates an array of random numbers
'between 0 and 1.
Const n = 20
Dim seed As Variant, x As Variant
seed = 17
x = CWDSP1.Uniform(n, seed)
End Sub
////////////////////////////////////////////////////////////////请各位高手不吝指教。如何在Delphi 中使用这类函数?
如何将X返回值中值取出来?
帮帮我!
/////////////////////////////////////////////////////Syntax
CWDSP.Uniform ( n, Seed)Return Type
VariantPurpose
Generates an array of h random numbers that are uniformly distributed between zero and one.ResWhen Seed ≥ 0, a new random sequence is generated using the seed value. So, if the seed value stays the same, the generated sequence stays the same. When Seed < 0, the previously generated random sequence continues. So even with the same seed, the generated sequence changes every time you call this function.Parameters
n As Variant[Input] Number of samples.Seed As Variant[Input] Seed value.Example
Sub Uniform_Example()
'The following code generates an array of random numbers
'between 0 and 1.
Const n = 20
Dim seed As Variant, x As Variant
seed = 17
x = CWDSP1.Uniform(n, seed)
End Sub
////////////////////////////////////////////////////////////////请各位高手不吝指教。如何在Delphi 中使用这类函数?
如何将X返回值中值取出来?
帮帮我!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货