Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » random functions proposal
Re: random functions proposal [message #35154 is a reply to message #35151] Tue, 17 January 2012 13:59 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14264
Registered: November 2005
Ultimate Member
Sender Ghost wrote on Tue, 17 January 2012 06:58

Hello, Mirek.
mirek wrote on Tue, 17 January 2012 11:13


BTW, what IS actually missing is double Randomf(); (returning 0 < x < 1)


Something like this?
// Returns random value from 0 to 1 - 10^-9 with 10^-9 precision.
double Randomf()
{
	static const dword n = 1000000000;
	return double(Random(n)) / n;
}



Yes, but that 10^-9 is perahps not enough. We have 56 bits to fill...

Sure, it is enough for most applications, but so far I believe not good enough as addition to library. Especially if it is such one-liner.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Init a ctrl inside INITBLOCK
Next Topic: problem with new and delete
Goto Forum:
  


Current Time: Thu Jul 03 00:14:25 CEST 2025

Total time taken to generate the page: 0.03704 seconds