Random decimal number

Hey there,
is there a way to generate a random decimal number between 0 and 0.03, for example? (Note: I have tried rnd() and System.Random.Number, but these only return values between 0 and 1).
Any help is appreciated,
Tim

Random.number will give you a “random” number in the range 0…1. So, if you multiply the result by 0.03, you may get what you’re looking for.

The reason for my being somewhat vague is that I don’t know just how random your numbers need to be. Random enough for a kid’s game, or for cryptographic security?

Var tempInt As Double = System.Random.InRange(0, 3000) / 10000

Var result as double=system.random.inrange (1,100)/100

Not tried it, but sounds reasonable !

Great minds think alike!

… but only one got it right … so congrats to you.

Thanks everyone for the help. In the future, I will definitely remember basic maths!

As long as you’re okay with “kinda random,” then it’s all good.

That’s why on secure systems I use a 30p laser diode, alternatively use RF signal or noise on an ungrounded pin, although both those can be compromised if you know how to do it :wink:

There’s a Swiss chip for secure doing it avoiding external noise.

As cheap as 30p?

Not sure about the price, but their Quantis QRNG IDQ250C2 chip is target to IoT, mobile devices, etc. So this class MUST be cheap or will fail. But a pure light source, as a laser diode, is nothing without all the complimentary divider and circuitry to collect that analogical random quantum states (aleatory photon spins), and digitize them as a stream of 0’s and 1’s injecting then into some register that can be read by some CPU. Are you adding all that to the cost of your RNG solution?

Ha reminds me of a conversation I had with a professor who developed a military laser communication device that thought quantum states were secure until I put him right.

Please, share your cheap solution. I don’t care about people putting me right, let’s do it.

PM me I will send you one

Without sharing it publicly, I have no interest. I can build my own, but not 30p.