una manera de obtener números bien aleatorios también sería un desplazamiento aleatorio de bits, no es así ?
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúPrivate Function SHL(ByVal Value As Long, ByVal ShiftCount As Long) As Long
' by Jost Schwider, jost@schwider.de, 20011001
Select Case ShiftCount
Case 0&
SHL = Value
Case 1&
If Value And &H40000000 Then
SHL = (Value And &H3FFFFFFF) * &H2& Or &H80000000
Else
SHL = (Value And &H3FFFFFFF) * &H2&
End If
Case 2&
If Value And &H20000000 Then
SHL = (Value And &H1FFFFFFF) * &H4& Or &H80000000
Else
SHL = (Value And &H1FFFFFFF) * &H4&
End If
Case 3&
If Value And &H10000000 Then
SHL = (Value And &HFFFFFFF) * &H8& Or &H80000000
Else
SHL = (Value And &HFFFFFFF) * &H8&
End If
Case 4&
If Value And &H8000000 Then
SHL = (Value And &H7FFFFFF) * &H10& Or &H80000000
Else
SHL = (Value And &H7FFFFFF) * &H10&
End If
Case 5&
If Value And &H4000000 Then
SHL = (Value And &H3FFFFFF) * &H20& Or &H80000000
Else
SHL = (Value And &H3FFFFFF) * &H20&
End If
Case 6&
If Value And &H2000000 Then
SHL = (Value And &H1FFFFFF) * &H40& Or &H80000000
Else
SHL = (Value And &H1FFFFFF) * &H40&
End If
Case 7&
If Value And &H1000000 Then
SHL = (Value And &HFFFFFF) * &H80& Or &H80000000
Else
SHL = (Value And &HFFFFFF) * &H80&
End If
Case 8&
If Value And &H800000 Then
SHL = (Value And &H7FFFFF) * &H100& Or &H80000000
Else
SHL = (Value And &H7FFFFF) * &H100&
End If
Case 9&
If Value And &H400000 Then
SHL = (Value And &H3FFFFF) * &H200& Or &H80000000
Else
SHL = (Value And &H3FFFFF) * &H200&
End If
Case 10&
If Value And &H200000 Then
SHL = (Value And &H1FFFFF) * &H400& Or &H80000000
Else
SHL = (Value And &H1FFFFF) * &H400&
End If
Case 11&
If Value And &H100000 Then
SHL = (Value And &HFFFFF) * &H800& Or &H80000000
Else
SHL = (Value And &HFFFFF) * &H800&
End If
Case 12&
If Value And &H80000 Then
SHL = (Value And &H7FFFF) * &H1000& Or &H80000000
Else
SHL = (Value And &H7FFFF) * &H1000&
End If
Case 13&
If Value And &H40000 Then
SHL = (Value And &H3FFFF) * &H2000& Or &H80000000
Else
SHL = (Value And &H3FFFF) * &H2000&
End If
Case 14&
If Value And &H20000 Then
SHL = (Value And &H1FFFF) * &H4000& Or &H80000000
Else
SHL = (Value And &H1FFFF) * &H4000&
End If
Case 15&
If Value And &H10000 Then
SHL = (Value And &HFFFF&) * &H8000& Or &H80000000
Else
SHL = (Value And &HFFFF&) * &H8000&
End If
Case 16&
If Value And &H8000& Then
SHL = (Value And &H7FFF&) * &H10000 Or &H80000000
Else
SHL = (Value And &H7FFF&) * &H10000
End If
Case 17&
If Value And &H4000& Then
SHL = (Value And &H3FFF&) * &H20000 Or &H80000000
Else
SHL = (Value And &H3FFF&) * &H20000
End If
Case 18&
If Value And &H2000& Then
SHL = (Value And &H1FFF&) * &H40000 Or &H80000000
Else
SHL = (Value And &H1FFF&) * &H40000
End If
Case 19&
If Value And &H1000& Then
SHL = (Value And &HFFF&) * &H80000 Or &H80000000
Else
SHL = (Value And &HFFF&) * &H80000
End If
Case 20&
If Value And &H800& Then
SHL = (Value And &H7FF&) * &H100000 Or &H80000000
Else
SHL = (Value And &H7FF&) * &H100000
End If
Case 21&
If Value And &H400& Then
SHL = (Value And &H3FF&) * &H200000 Or &H80000000
Else
SHL = (Value And &H3FF&) * &H200000
End If
Case 22&
If Value And &H200& Then
SHL = (Value And &H1FF&) * &H400000 Or &H80000000
Else
SHL = (Value And &H1FF&) * &H400000
End If
Case 23&
If Value And &H100& Then
SHL = (Value And &HFF&) * &H800000 Or &H80000000
Else
SHL = (Value And &HFF&) * &H800000
End If
Case 24&
If Value And &H80& Then
SHL = (Value And &H7F&) * &H1000000 Or &H80000000
Else
SHL = (Value And &H7F&) * &H1000000
End If
Case 25&
If Value And &H40& Then
SHL = (Value And &H3F&) * &H2000000 Or &H80000000
Else
SHL = (Value And &H3F&) * &H2000000
End If
Case 26&
If Value And &H20& Then
SHL = (Value And &H1F&) * &H4000000 Or &H80000000
Else
SHL = (Value And &H1F&) * &H4000000
End If
Case 27&
If Value And &H10& Then
SHL = (Value And &HF&) * &H8000000 Or &H80000000
Else
SHL = (Value And &HF&) * &H8000000
End If
Case 28&
If Value And &H8& Then
SHL = (Value And &H7&) * &H10000000 Or &H80000000
Else
SHL = (Value And &H7&) * &H10000000
End If
Case 29&
If Value And &H4& Then
SHL = (Value And &H3&) * &H20000000 Or &H80000000
Else
SHL = (Value And &H3&) * &H20000000
End If
Case 30&
If Value And &H2& Then
SHL = (Value And &H1&) * &H40000000 Or &H80000000
Else
SHL = (Value And &H1&) * &H40000000
End If
Case 31&
If Value And &H1& Then
SHL = &H80000000
Else
SHL = &H0&
End If
End Select
End Function