mirror of
				https://github.com/yuzu-emu/yuzu.git
				synced 2025-11-04 08:53:43 +00:00 
			
		
		
		
	csrng: Use random integer distribution instead of raw engine
Prevents returning the same value every single call.
This commit is contained in:
		
							parent
							
								
									8a537a2021
								
							
						
					
					
						commit
						8cb2e7d881
					
				@ -28,8 +28,9 @@ void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) {
 | 
			
		||||
 | 
			
		||||
    std::size_t size = ctx.GetWriteBufferSize();
 | 
			
		||||
 | 
			
		||||
    std::uniform_int_distribution<u16> distribution(0, std::numeric_limits<u8>::max());
 | 
			
		||||
    std::vector<u8> data(size);
 | 
			
		||||
    std::generate(data.begin(), data.end(), rng);
 | 
			
		||||
    std::generate(data.begin(), data.end(), [&] { return static_cast<u8>(distribution(rng)); });
 | 
			
		||||
 | 
			
		||||
    ctx.WriteBuffer(data);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user