Question: How to get a random number without trailing zers from rand()?

I used rand() to get a list of random numbers between 0 and 1. It gives me something like

[.30000000, .50000000, .20000000]

But I want this to be like [.3,.5,.2]. As my code tells that both the above lists are unequal !!! How ? kindly explain me.



Please Wait...