ChedderCheeser
Senior Member
Hi guys. I am trying to figure out how I can create RANDOM numbers within a certain range. The first one (w0) needs to be between 10 and 50. The second (w1) needs to be between 25 and 175. Any ideas?
Try a quick search.Hi guys. I am trying to figure out how I can create RANDOM numbers within a certain range. The first one (w0) needs to be between 10 and 50. The second (w1) needs to be between 25 and 175. Any ideas?
Not possible directly due to integer maths only.Inacurate but here is how i do it
Random creates a number between 0 and 65535 so:
65535/436.9
Creates a number between 0 and 150
Ans+25
Creates a number between 25 and 175
You cant.Hi guys. I am trying to figure out how I can create RANDOM numbers within a certain range. The first one (w0) needs to be between 10 and 50. The second (w1) needs to be between 25 and 175. Any ideas?
The "." was not meant to be there, oops...Not possible directly due to integer maths only.
You could look at the 'min' and 'max' commands to limit the results within a certail range
0
2
5
11
23
47
94
189
378
756
1512
3024
6049
12098
24197
48395
31254
62509
59482
53429
41323
17110
34221
2906
5812
11624
23248
46497
27459
54919
44303
23071
46143
26750
53501
41467
17399
34799
4063
8127
16255
32511
65023
64510
63484
61433
57330
49125
32714
65429
65323
65110
64684
63832
62128
58720
51905
38275
11014
22028
44057
22578
45156
24776
49552
33568
1601
3202
6405
12811
25623
51247
36959
8382
16765
33530
1525
3050
6101
12202
24405
48810
32084
64168
62801
60066
54596
43656
21777
43555
21574
43148
20760
41521
17506
35013
4490
8981
17962
35925
6315
12631
25263
50526
35516
5497
10995
21990
43980
22424
44849
24162
48325
31114
62229
58923
52310
39084
12632
25265
50531
35526
5517
11035
22070
44141
22746
45492
25449
50898
36261
6986
13973
27946
55893
46251
26966
53933
42330
19125
38250
10964
21928
43856
22176
44352
23169
46338
27140
54281
43027
20519
41038
16541
33082
629
1258
2517
5034
10069
20138
40277
15019
30039
60079
54623
43710
21884
43768
22000
44001
22467
44935
24335
48670
31804
63608
61680
57824
50113
34691
3846
7692
15385
30771
61542
57549
0
2
5
11
23
47
94
189
122
244
232
208
161
66
133
11
23
47
94
189
122
244
232
208
161
66
133
11
23
47
94
189
122
244
232
208
161
66
133
11
23
47
94
189
122
244
232
208
161
66
133
11
23
47
94
189
122
244
232
208
161
66
133
11
23
47
94
189
122
244
232
208
Of course, if your noise level is too low, you may want to precede your input with a "noise amplifier"If you have an ADC input in use, use it to create the seed. If you don't then use a spare ADC input pin (left open circuit) as a seed. If need be, add a length of insulated wire to the input. One of the rare times that noise (inconsistent readings) is good.