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 #35171 is a reply to message #35170] Wed, 18 January 2012 17:45 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1791
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

cbpporter wrote on Wed, 18 January 2012 15:44

What Random needs is the ability to give it a seed. So you can produce the same sequence of numbers twice. Or is there already support for this?

These functions should be able to do that:
void SeedRandom(dword *seed,int len){
	if(!sRng) {
		sRng = new(sRb) MTrand;
	}
	sRng->init_by_array(seed,len);
}

void SeedRandom(dword Seed){
	if(!sRng) {
		sRng = new(sRb) MTrand;
	}
	sRng->init_genrand(Seed);
}

But I didn't have the time to test it Wink

Honza
 
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 03:16:15 CEST 2025

Total time taken to generate the page: 0.03971 seconds