@@ -48,6 +48,12 @@ canvas {
4848 <v-text-field label =" Number of samples" type =" Number" v-model.number =" nSamples"
4949 :error-messages =" nSamplesError" ></v-text-field >
5050 </v-col >
51+ <v-col cols =" 6" >
52+ <v-text-field label =" Random seed" type =" Number" v-model.number =" randomSeed"
53+ :error-messages =" randomSeedError" ></v-text-field >
54+ </v-col >
55+
56+
5157 </v-row >
5258 </v-card-text >
5359 </v-card >
@@ -86,6 +92,8 @@ canvas {
8692import { compute } from " ./bayesian-wasm/pkg" ;
8793import Group from " ./components/Group.vue" ;
8894
95+
96+
8997export default {
9098 data () {
9199 return {
@@ -105,6 +113,8 @@ export default {
105113 betaError: [],
106114 nSamples: 100000 ,
107115 nSamplesError: [],
116+ randomSeed: 0 ,
117+ randomSeedError: [],
108118 n_bins: 100 ,
109119 result: null ,
110120 dpr: 3 ,
@@ -117,25 +127,36 @@ export default {
117127 if (this .b === null ) invalid = true ;
118128 let alpha = parseFloat (this .alpha );
119129 let beta = parseFloat (this .beta );
120- let nSamples = parseInt (this .nSamples );
121- if (isNaN (alpha) || alpha < 0 ) {
122- this .alphaError = [" valid, positive float required." ];
130+ let nSamples = parseFloat (this .nSamples , 10 );
131+ let randomSeed = parseFloat (this .randomSeed , 10 );
132+ if (isNaN (alpha) || alpha <= 0 ) {
133+ this .alphaError = [" valid, positive floating number required." ];
123134 invalid = true ;
124135 } else {
125136 this .alphaError = null ;
126137 }
127- if (isNaN (beta) || beta < 0 ) {
128- this .betaError = [" valid, positive float required." ];
138+ if (isNaN (beta) || beta <= 0 ) {
139+ this .betaError = [" valid, positive floating number required." ];
129140 invalid = true ;
130141 } else {
131142 this .betaError = [];
132143 }
133- if (isNaN (nSamples) || nSamples <= 0 ) {
134- this .nSamplesError = [" this field must be strictly positive." ];
144+ if (isNaN (nSamples) || nSamples <= 0 || ! Number . isInteger (nSamples) ) {
145+ this .nSamplesError = [" This field must be a strictly positive integer ." ];
135146 invalid = true ;
136147 } else {
137148 this .nSamplesError = [];
138149 }
150+
151+
152+ if (isNaN (randomSeed) || randomSeed < 0 || ! Number .isInteger (randomSeed)) {
153+ this .randomSeedError = [" This field must be a non-negative integer." ];
154+ invalid = true ;
155+ } else {
156+ this .randomSeedError = [];
157+ }
158+
159+
139160 if (invalid) {
140161 return null ;
141162 }
@@ -149,6 +170,7 @@ export default {
149170 b_pos: this .b .pos ,
150171 n_samples: nSamples,
151172 n_bins: this .n_bins ,
173+ random_seed: randomSeed,
152174 };
153175 return JSON .stringify (data);
154176 },
0 commit comments